My Projects: My Gadget – One button to control everything around the house.

Difficulty: 4

LogoSoon after I figured out how to voice control my media centre, I realised that I needed an easier way to trigger it. The trigger would set the volume of my media centre to a level I could naturally talk over, so I could navigate around it using my voice. I was using the 0 button of my remote control for this task, so I still needed to keep my remote control in hand. There was very little to be gained by the voice control if I were to still continue using traditional remotes to trigger it. I only needed the one button as all other commands were given by voice. I needed a one button infrared (IR) remote. The only remotes I could find commercially were for garage doors or car alarms, but these did not use IR technology, so I had to make my own.

Four months have passed since I started working on this project and I have succeeded in getting it working, though aesthetic improvements will still need to be made. I have been enjoying tinkering with it. This is a very simple device compared to many other electronic projects, so someone with experience may have it going in a few hours.

While I was making my gadget, I discovered that it would be capable of doing far more than just enabling the voice control of the home theatre PC. What I made was a very simple tool. A single button that I could point at any computer or robot around the house, to let it know I needed it to start listening to me. This could ultimately mean that I would have a portable button combined with my voice to control any electrical device in my house. The more I think about it, the more likely this is to become a reality, in time.

I have come up with a number of other methods to trigger the voice control systems in my house. I will explain these solutions over the coming weeks, months and (hopefully) years. If these future solutions end up being inadequate, my gadget will become a necessary accessory. The need to carry something around the house with us all the time is a bit of hassle, no matter it’s size and ease of use. I want to be able to trigger the technology with empty hands, hence why I want to avoid using my gadget. One thing is for sure, we do need something to trigger voice control in high noise areas. A computer needs to know if we are talking to it or another family member.

This article will explain how I have gone about making my gadget. While my gadget does currently work reliably, it is at this stage only a proven working prototype. These instructions will show you two possible methods you can use to make it. The first method is simple to get going, and I recommend this option for anyone who wants fast results without too many complications. The second method will achieve the same result, but will allow you to investigate IR technology in more depth. I have not played around with circuit design much yet, but the information in this article should give you enough to start playing around with your own design if you so choose.

All of my future articles will somehow be related to my gadget – a single button to control everything. Much of this is about changing or using current, past and future technology to make my gadget be more useful. I know that it will work as I am currently using the one button approach to control a few things around my house, and I am enjoying the benefits of the technology.

Tvbgone adafruitI had been reading Lifehacker and Make when they were writing about a nifty new device called TV-B-Gone. TV-B-Gone is an invention by Mitch Altman which uses a single button to send IR codes to turn off basically any TV set. Because all the codes are different from brand to brand, it sends one code after another until it has sent all of it’s codes. The result is that pretty much any TV can be turned off with the one button on this device.

After a bunch of TV-B-Gone units were sold, Mitch combined with Adafruit industries to make the code and schematic available to the public to tinker with. The electronics and most of the code of the TV-B-Gone already worked to serve my purpose. In fact, it provided more than I needed.

350 TVBGoneThere were a number of TV-B-Gone versions made by fans who successfully managed to make the device smaller, though it still functioned as a TV-B-Gone. All I needed to do was make one of these smaller versions (or design my own similar circuit) and then make the device send the 0 code of my remote, instead of the TV off codes. While this sounds like an incredibly simple concept, I was soon to learn that figuring out the IR codes sent from a remote is far from simple.

Why use Infra Red (IR)?:

I believe IR is the only current wireless technology that is suitable for this task. It has proven itself to be very reliable in our lounge rooms for many years. It is also a very cheap option. Most TV tuner cards come with an IR receiver, so I will be making use of the left over IR receivers I have wherever possible. Because the original TV-B-Gone is capable of sending multiple codes, I have the option to use a unique IR code for each room, or identical codes throughout the house. If my gadget slows down after adding multiple codes, I will need to use identical codes and then buy multiple identical receivers of any brand. It doesn’t matter either way.

Other wireless technologies go through walls. Using IR, only the receiver that is meant to see the signal will respond. The other codes will be filtered by walls. If I want to talk to a computer outside my current area, I can identify which computer listens by pressing my gadget and saying the name of the computer I want to talk to. It’s unlikely a robot will understand me if I yell to it from across the house. Instead, I will be able to press my gadget and talk naturally to it from the room I am in. Then the command or audio will be sent clearly through to it using one of the many wireless or wired technologies available to us.

How to make my gadget:

Below are the steps I have taken so far to make my gadget. It involves electronics and some coding, so it may be a bit complicated for beginners. I found the trickiest part is decoding the IR codes, but that is avoidable using Method 1. If you have been interested in electronics, this would be a great kit to start out with. This is my first kit since finishing my electronic study in 2003. It has given me much enjoyment to finally use what I had learnt. I had thought they were wasted years. By making it myself, I can gain a better understanding of how this technology works. The final product costs around $5, but there are various purchases required to make it all possible bringing it up to around $80. This figure is likely to rise.

Hardware: All prices are in US dollars.

TV-B-Gone Kits: I started off by purchasing two TV-B-Gone kits. This is the kit I am basing my gadget on. It already operates exactly as I want, but the codes are not right for my task. I bought one of them in case my soldering was a bit sketchy, but the second turned out to come in handy as I used it to make a simple programming board to program the chips. They are $20 each unassembled and available from Adafruit Industries.

USBtinyISP AVR Programmer kit: This kit is used to program the Attiny85 chips. It plugs directly into a modified TV-B-Gone board so there is no need to run a wire to each leg of the chip. They are $22 each unassembled and are also available from Adafruit Industries. I purchased 2, but have only required 1 of them.

USB-UIRT: This is a very powerful device. It can act as an IR receiver or transmitter. I have found these devices to be of decent quality at a good price.

The following tools are only needed for Method 2.

USBIRToy: This assembled device is what am using to show me IR signals on my computer. The software that works with this device will show the digital output of the remote. This is what I need to decode and add into the chip itself. USBIRToy is $20 assembled and available from Seeed Studio. Amazingly, the price includes shipping.

Open Workbench Logic Sniffer: This is another project from Dangerous Prototypes. This can be attached to the USBIRToy to analyse the codes. I am not sure if this is required because the software with the USBIRToy is pretty good and gives many of the same features, but I purchased one. It is still in it’s packet. This could easily be used in other projects. Logic Analyzers are normally very expensive so this is a great alternative. It is also available from Seeed Studio for $45, and you will need to get some probes for $6 each.

Components: While the TV-B-Gone kit contains all the components needed for this, I did purchase extras of many of the parts for testing. I used the components listed in this kit as a reference for what to buy. I haven’t used many of them yet, but I figure that if my gadget is required, each member of the family will want one or two.

Software: All the software is free, at least for non commercial use.

MyGadget Firmware: I used the original firmware from the TV-B-Gone version 1.2, but I altered it to remove TV-B-Gone references as they aren’t relevant for this. I also removed the code which detects if it uses European or US codes. As we only want a few codes, we do not need to choose between 2 databases. This also removes a resister from the TV-B-Gone kit. I may end up using the original 1.0 version as I don’t need the added features 1.2 delivers. The only thing lacking is the required IR code.

AVRDude: This software is used to program the chip. It is a command line program which works reliably with the USBTinyISP AVR Programmer.

Programmers Notepad: This software is pretty much a notepad, but it is tailored for programmers. It highlights key words and detects which language is being written. It makes programming much easier than using a traditional black and white editor.

Open Logic Sniffer: This Java software shows .ols files in a graphical way. Much the same as you would see on a Logic Analyser display. It works very reliably and should show recorded IR information adequately to manually decode them to different formats.

WinLIRC: I am not sure how useful this will be for this project, but I have been tinkering in it. It does help gain a knowledge on the IR protocol. It lets us use home made USB receivers in Windows. It has a USBIRToy plugin that allows us to send IR codes through it. I have had limited success with it, but it has a huge community support so it is likely I will be using this in some of my projects.

EventGhost: This software can be used to run tasks as it receives a recognised trigger. This software can be used to make any remote control work with any computer. It is very useful for automating anything. I use it to receive a predefined IR signal and when it sees that signal, it emulates the trigger button.

Making my gadget:

I have two methods for making my gadget. By using Method 1, you should end up with a single button remote that can trigger the voice control. While Method 2 hasn’t worked well for me yet, I am fairly confident that it will work for someone willing to put in the time to discover the correct IR code for their individual setup. Both methods require making the TV-B-Gone kit, the AVR programmer and the programming board. The difference between the two methods is the software we put onto the chip.

Both methods:

  1. Make up one of your TV-B-Gone kits: I soldered mine together and tested it. Amazingly, it worked first try. My TV turned off after around 3 seconds. After a few more successful tests (one from 30 metres away) I knew it would be more than adequate for my needs.
  2. Make the AVR Programmer kit: This kit also went together with no problems. There is not much to these kits, so taking time and following the step by step instructions on the Adafruit website is likely to result in a good outcome.
  3. Make the programming board: This uses the second TV-B-Gone kit, but only a few components need to be put on the board. These are C1, C2, X1, ICSP and EBC. Once this is made, the board will plug directly into the AVR Programmer. It is possible to use a breadboard and wires to program the chip, but the programming board was a much simpler option for me.



AvrdudeProgramming the chip:

Once you have a valid .hex file, copy it into the avrdude folder. This is included in mygadget firmware. Open up a command prompt and navigate to your avrdude directory. The command to write to the chip is:

avrdude -c usbtiny -p attiny85 -U flash:w:mygadget.hex

You will see the chip being wiped and flashed with the new .hex file. After fiddling around a bit with this, you will find it very quick to make alterations to the code, make the file and write it to the chip. I was surprised how easy this was to do.

Method 1: Working Reliably –  Recommended

This method makes my gadget send out the Sony Off code. As I don’t have a Sony TV, the IR code won’t interfere with any of my gear. You can use any IR code you want using this method. I just chose the first in the list for convenience.

  1. Eventghost GadgetPlug in a USB-UIRT into your computer and install the drivers.
  2. Install EventGhost
  3. Add the USBUIRT plugin
  4. If installed correctly, EventGhost should show what IR data has been received in the left pane.
  5. Create a new macro
  6. Drag the received IR code into the macro
  7. Create an action to emulate the keystroke [ or 0.

This is a very simple way to get things up and running, and it works as it should.

Honourable mention: The USBIRToy is also suitable for this task as an alternative to the USB-UIRT. It is a third of the price, but it has a delay when receiving the signal of around 1.5 seconds. This doesn’t make it impractical, but instant results are always best.

I am also having considerable problems getting the same code received each time. I am keeping my eye on the Dangerous Prototypes website as the USBIRToy is being constantly given both firmware upgrades and component upgrades. It is a great piece of electronics which will continue to become more useful and reliable as it is developed. For $20, I think it would make an ideal IR receiver as more are needed around the house if extras are required.

A number of other IR receiver could be used for this method. Just add the plugin for HID device and select your receiver.

Method 2: Work in progress

Using this method, I am trying to install the 0 code of my normal remote control into my gadget. The result will be pretty much the same as the method above. There is very little be gained by using this method, though it is probably the right way to do it. This is how I started off trying to make my gadget work as I did not have a USB-UIRT. It is much more complicated.

  1. Install a USBIRToy, ensuring firmware and drivers are up to date
  2. Install the USBIRToy record and playback application
  3. Open a command prompt and navigate to the folder you installed the application
  4. Run the following command. Change the com port to the com port of your USBIRToy
    • irtoy -d com3 -p -f mygadget -o
  5. You will get to take a sample of the remote button you want to use as a reference, and an ols file will be created.
  6. Install Open Logic Sniffer
  7. Open the ols file in Open Logic Sniffer

LogicSnifferNow is where I got stuck. You need to follow the instructions on this page to decode the signal from the ols file to the format compatible with the TV-B-Gone code. A lot of care has gone into the page to lay out the exact process. It is quite timely and complicated, though I don’t see how it could have been written any simpler.

Once you have figured out the code and altered gadgetcodes.c from mygadget firmware, make the file and write it to the chip. Repeat the steps above until it works.

This should logically work. I can’t figure out where any problem could be apart from in my own calculations. Saying all this, Method 1 is a whole lot easier and it should not cause problems. You could use any number of TV off codes as your triggers for around the house, so long as it doesn’t conflict with your current TV sets.

Making my gadget smaller: Work in progress

The TV-B-Gone is far more powerful that we need it to be for this task. It may even be too powerful as it can currently go around walls. If we remove 2 or 3 of the diodes, the signal will drop to a more suitable level. This will also mean that two or three transistors can be removed. The firmware has removed the need for the US/EU selection resister. The whole unit can be powered by a CR2032 button battery. All of a sudden the device is the perfect size to fit comfortably under the thumb.

Making my gadget look good:

There would be various cases that could be used to hold the electronics. You will need to use your imagination and creativity to make it just right for you. I am likely to put it into a wooden shell. If my gadget is a necessary device, it wouldn’t hurt to make it nice to use and to look at. It will spend a lot of time in hand.

I would probably add it onto a retractable chain that I can attach to my belt.

Commercial release:

I have no plans currently to release my gadget commercially. As I said above, I believe that there are better options available to us which I will explain in future articles. How can I sell something I don’t see as being the best option? I don’t want to spend my time dealing with manufacturers and legal issues. I want to progress onto my next projects. Saying that, I wouldn’t be surprised if there are copies made by other companies.

Commercial versions may come out which will learn codes from existing remotes, or which can be programmed through a computer. Bluetooth could be added as it has the benefit of proximity detection, though I do not want to add this because I don’t want my gadget to hold identifiable information. There is no need for anything more than IR. It will not be used solely for any security purposes. If I lose it on a bus, I don’t want to be concerned that anyone can use it. There are lots of ways to change it such as adding an internal microphone, embedding it into a watch, making it rechargable or doubling it up as a USB key. I don’t see these extra features to have much benefit as they will increase the cost, create security concerns and a single button will be more than enough.


TV-B-Gone kit: Design notes: A bunch of useful information about adding your own codes into the TV-B-Gone
$3.50 TV-B-Gone kit: Doesn’t look like much, but its got all the necessary parts and it is small.
TV-B-Gone Micro: Tiny version of the TV-B-Gone
Tutorial on AVR Programming: A detailed look at programming AVR chips
Tutorial on AVR programming boards:
USBIRToy record and playback application: It opens up a lot of automation options, as well as creating .ols files from IR receiver.


As you can see, it is not the easiest item to create, but it is a challenge for me and look forward to designing it exactly how I want it in the future. I want to emphasize that I hope my gadget is an unnecessary device, though I am not sure yet if it will be possible to remove the need for it. I would prefer not to carry this with me around the house. I have come up with a number of simple solutions to trigger voice control around the house, I am just not sure how all of them will work together as they have not all been made or tested yet. The solutions I have currently tested all work wonderfully well, making my gadget avoidable.

My aim over the next 5 to 10 years is to show how technology can work for us around the home. I also want to show that we already have all the technology we need to make this possible. The final result will ultimately be that we have far more time to do the things we want to do, and to enjoy the technology that gave us grief as we adapted to it over the years. The home we imagined as what would be “the future” is very very close.

I will be automating, or voice controlling everything in my house over this time using comparably cheap electronics and computers, both new and recycled. If you want the same technology in your house, you will have the option to follow my articles and take the cheaper DIY route. My solutions will cost a fraction of the price of current home automation hardware, and each project will link in with the last. I can’t wait to show you my next project.

Related Posts