Picture of $3.50 DIY TV-B-Gone Micro
I previously made a slideshow on my DIY TV-B-Gone, and many people requested I make an Instructable. So, the first in a series of DIY TV-B-Gone clones, is the TV-B-Gone Micro!

Technically, because TV-B-Gone is a brand name, this is a "TV-B-Gone clone."

The TV-B-Gone is a neat little device that can turn almost any TV on or off. It uses a microcontroller hooked up to IR LEDs to output a library of on/off codes. Adafruit sells a kit, and has the code as well as the schematic on their website.

Here's a micro clone of the TV-B-Gone that runs on a coin cell battery, is slightly bigger than a quarter, and costs about $3.50 (compared to $20) to make!
Remove these adsRemove these ads by Signing Up

Step 1: Materials and Tools

Picture of Materials and Tools
TVBGONE schematic.JPG
Here is a list of what you will need.

Materials: All of these prices are if you buy only one of each part. If you buy in bulk, like I did, it will actually have a cheaper unit price. For me the total was less than $3.50, for you maybe more if you only buy one of each part.

You will also need some 2032 batteries to power it. DON'T FORGET!

  • AVR programmer (I used a USBtinyISP, a good, cheap programmer made from a kit)
  • Computer with internet access; I predict you are using one right now :-)
  • Soldering iron with solder
  • Helping hands tools, very helpful
Now let's get started!

Step 2: To Use an Oscillator or Not...

The first thing you need to do is decide whether to use to use an oscillator. Here is the info to let you make your choice:

Advantages of and Oscillator:
  • It is much more accurate and doesn't vary near as much as the internal oscillator. This can make the difference between it working and not.
  • It adds about 50 cents extra cost.
  • It takes up more space.
  • It adds slightly more complexity.
I highly recommend you use one, but it is not required. I'll include instructions for both ways.

Step 3: Prep for Programming

Picture of Prep for Programming
If you have a programming board, you can skip this step. If you are using a USBtinyISP or similar, use a breadboard to wire the chip to the proper connections of the programmer. More instructions on how to do this can be found here. The pinout for the chip can be found on the datasheet here.

Step 4: Program the Chip Part 1: Fuses

Picture of Program the Chip Part 1: Fuses
"Fuses" are a very small part of the microcontroller's memory that tell it how to operate, such as which oscillator to use, enabling the reset pin, and so on. Will will need to change the fuses to run off of an external oscillator. I used http://www.engbedded.com/fusecalc, which is a free AVR fuse calculator. I included images of this, but you don't need to use the calculator because I listed the commands here.

I use AVRdude to interface between the programmer and my computer. A tutorial on how to use AVRdude can be found here.

If you are using an oscillator, use

Avrdude -c usbtiny -p attiny85 -U lfuse:w:0xfe:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

If you are not, use

Avrdude -c usbtiny -p attiny85 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

Proceed to the next step for programming the real code!

Step 5: Program the Chip Part 2: Code

Picture of Program the Chip Part 2: Code
The first thing you will want to do is connect the oscillator on the breadboard. Because it is now set to run with one, it has to have one to be programmed with one.

Download the firmware v1.1 from Ladyada.net at http://ladyada.net/media/tvbgone/tvbgone11.zip. This is for their kit, but I used it to program this and it worked. Unzip the folder and find the tvbgone.hex file. Copy this and put in C:\users\username where AVRdude can find it. Now, in AVRdude, type

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

and wait for it to put the code on the chip. Now let's get building!

Step 6: Begin Construction!

Picture of Begin Construction!
Bend pins 1 and 8 around so that they nearly touch, and solder them together. These are Vcc and RESET, which will both be connected to the button.

Step 7: Add the Button

Picture of Add the Button
Cut off two of the four leads of the button, making sure you get two that are pointing to the same side. Flip the chip upside-down and solder one lead of the button to pin 8 as shown in the picture.

When the button is pressed, it will give the chip power. When the button is un-pressed, the chip gets no power and will turn off.

Step 8: Add the Resistor

Picture of Add the Resistor
Bend pins 5 and 6 together, and solder them. Cut one lead of the 150 ohm resistor very short, and solder that end to pins 5 and 6, with the body of the resistor facing down the chip as shown.

The resistor limits the amount of current that the microcontroller can give to the transistor. Pins 5 and 6 are the outputs, and bending them together doubles the amount of current they can source to 20 ma. This is probably not needed, but is used as a precaution.

Step 9: Add the Transistor

Picture of Add the Transistor
Bend the outer two legs of the transistor outward, and cut the center (the base) short, as shown. Also cut the lead from the resistor short, too. Orient the transistor as shown in the picture (flat side up) and solder the base to the lead from the resistor.

The transistor allows the microcontroller, which can source only 10 ma per pin, to drive these LEDs, which can draw up to 100 ma. When a current goes through the base, it allows power to flow through the LEDs (at the collector) to ground (the emitter) in this circuit.

Step 10: Start the Ground Bus

Picture of Start the Ground Bus
Bend the emitter (left lead) of the transistor at a right angle as show, and solder it to pin 4, the gnd of the microcontroller.This will be connected to ground of the battery later.

Step 11: Add the Resonator

Picture of Add the Resonator
If you decided not to use a resonator when you were programming, you can skip this step and leave pins 2 and 3 unconnected.

Bend the outer two pins of the resonator inward, and the inner pin upwards. Solder the the outer two to pins 2 and 3 of the microcontroller. Bend the leftover emitter lead from the transistor over, and solder it to the middle pin of the resonator to connect it to ground.

Step 12: Solder the LEDs Together

Picture of Solder the LEDs Together
Set the two LEDs next to each other, with the blue one on the left and the flat sides facing up. Bend the top lead of the the clear one to the left, and the bottom lead of the blue one to the right. Solder them in parallel, and cut the excess as shown.

From now on, most of the pictures will be wrong. I did it a different way, then experimented and found that this one was better. Pretend the LEDs in the rest of the pictures are like this, sorry for the inconvenience!

Step 13: Add the LEDs

Picture of Add the LEDs
Solder the negative lead of your LEDs to the collector of the transistor, and leave the positive pointing down the side as shown.

Step 14: Add the Capacitor

Picture of Add the Capacitor
Bend the positive of the capacitor out and along the side of the capacitor, and cut it short. Bend the negative out for about 2mm and then bend it straight up. Fit the capacitor in and solder the positive of the capacitor to the positive of the LEDs as shown.

The capacitor filters the power from the battery to provide a smooth voltage for the microcontroller even with the LEDs flashing really fast.

Step 15: Form More Connections

Picture of Form More Connections
Bend the negative of the capacitor over and solder it to pin 4 of the microcontroller. This connects it to the ground of the circuit.

Step 16: Form More Connections Part 2

Picture of Form More Connections Part 2
Bend the positive wire from the LEDs around the capacitor as shown. Take an extra length of lead from something you cut off earlier, and solder it into place so that it connects the positive of the LEDs to the unused lead of the button. This connects the LEDs to the positive of the battery.

Step 17: Add the Battery Holder

Picture of Add the Battery Holder
Fit the battery holder under the circuit as shown; it should line up perfectly. Solder the positive and the negative as shown in the picture.

The positive goes to the far end of the button, giving power to the LEDs and, when pressed, the microcontroller.

The negative goes to the negative of the capacitor, grounding what needs to be grounded.

Step 18: Optional: Add an Indicator LED

Picture of Optional: Add an Indicator LED
TVBGONE schematic 2.JPG
Unless you hold up a camera to the front, there is no indication that it is going. Here's a modification to add a visible light LED that blinks between each code to show what it's doing.

3mm LED - $0.06
Another 150 ohm resistor - $0.05

First, take your LED and bend the positive lead (not on the flat side) straight out. Keep the negative lead (with a flat side) pointing the same direction and cut it so that it's about 3mm long. Solder this to pin 7 of the microcontroller, with the positive lead facing toward the switch.

(look at picture 2)

Next, cut the positive lead very short. Cut one lead of the resistor very short also, and solder the two together. Bend the other lead of the resistor around to the positive battery terminal, cut it, and solder it into place.

(pictures 3 and 4)

Now when you press the button, the LED will blink between each code. It will also blink 4 times quickly when all the codes have been sent.

Step 19: Add a Battery and Have Fun!

Picture of Add a Battery and Have Fun!
Slip in a 2032 coin cell battery, and have fun blasting TVs with a small, compact, and DIY device! Because the wires are exposed, be careful not to let anything conductive short out the connections. A good way to protect the circuit would be to infuse and cover the circuit with hot glue or sugru.

Note: I am not responsible for what you do with this, act at your own risk.

If you make one, please send me pictures!

Don't forget to rate and leave comments, I like comments :-)

Step 20: Update: Using a v1.2 Preprogrammed Chip

Picture of Update: Using a v1.2 Preprogrammed Chip
Due to the requests for preprogrammed chips, I made a modification to the design so that you can use Ladayada's preprogrammed chips with v1.2 firmware. It requires a PNP transistor instead of a NPN, and the way every thing is hooked up is different. I have not tested it, but it should work.

Buy the preprogrammed chip here for $5: http://www.adafruit.com/products/75

The circuit layout will be slightly different than the one for the Instructable.

« Previous41-80 of 305Next »
happydupa1 year ago
Dark Sponge, you rock! I've wanted one of these forever but couldn't justify the high cost of a pre-made one. I can't wait to start building. One request. I hate the coin batteries. Can you tell me if I can substitute a 9v for the coin? If not, can you suggest how I would modify the circuit to accept one?

dark sponge (author)  happydupa1 year ago
You can replace it with 2 AA batteries in series or build something similar to this, which uses a 9v instead. http://www.instructables.com/id/DIY-TV-B-Gone-SHP-And-Save-45/
oluzon1 year ago
i did everything excatlly likeyou did except i used arduino to program attiny, then i used a program to upload the hex file to my attiny, i tried doing the circuit twice, but it stilll dosent work, help?
kcatx1 year ago
Nerver mind I got it working I was looking at the pics and it looks like u connet something to pin 7 but then I looked at the schematic and saw there was nothing connected
kcatx1 year ago
Hey I need some help I built the tv b gone on the bread bored and it worked great and now that I have soldered it together it won't work do u think I fryed my attiny85 I am using 1.1 firmware
aaron01271 year ago
Hey can i buy one of those ic chips from you preprogramed?
Great instructable!
i've made my own TVBG on my breadboard and it's work!
I added 2 IR so, totally there 4 leds and powered by 2 AA battery. Can't wait to try this with the big screen TV in school LOL
psp36011 year ago
I just finished putting the v1.1 together on a breadboard to test it and I was wondering if I could add two IR LEDs for a total of four, would I have to increase the battery voltage from 3v to something like 4.5v? (Wouldn't be much of a problem since I'm going to use AA batteries, just need to use a 3 battery holder instead of 2) or would I just have to add a transistor?


Great instructable by the way!
I just built one and I'm having a bit of an issue that I can't figure out. I tested the chip on a breadboard and it worked. I built the micro and the first time I pointed it at a TV it turned on. Then it wouldn't shut the TV off. After trying a few times with no luck I started checking out the LED's through a camera. Whenever I press the button something different happens. Sometimes they will "blip" once, sometimes they flash a couple of times then stop, and every once in a while they blink like they're running through the sequence. I've triple checked all the connections and everything appears to be in order. I'm also assuming that it's wired up correctly because it did work that first time. I tried ruling out a faulty button by bypassing it with a jumper but got the same result. Anybody have any thoughts about what might be going on?
dark sponge (author)  thegoodjeremy2 years ago
Yes! I had a similar problem when I first breadboarded it. Putting in a filter capacitor fixed it. I then found the lowest value that would still get rid of these stops. Try using a much larger filter cap and see what happens.
Dylon1242 years ago
Is the 22uF capacitor used only to decouple the voltage from the cro2032 battery. Because you may not need it since the battery's voltage is pretty stable. good job though!
crusso2 years ago
Great instructable!!!!!
Just one question: would it work with an ATTINY85-20PU?
dark sponge (author)  crusso2 years ago
I'm pretty sure it would. You might want to double check codes for burning the fuses but I don't think it's that different.
would a 22uF 50v capacitor work?
hilukasz2 years ago
do you even need the resonator? since you can reset the fuses on attiny so it runs at 8mhz?
dark sponge (author)  hilukasz2 years ago
Nope! See steps 2 and 4.
I'm building a V1.2 with one of these: https://www.sparkfun.com/products/10732 Instead of two. What parts can I remove? Can I get away with just the capacitor, the led thing, the resonator, and the microcontroller? I plan on connecting the power wire directly to the batteries, and the digital wire to the microcontroller. Also, if I do that, should I add an extra capacitor, or just have the power for both run through the same one. And lastly, can you help me modify the code so that it stops when you let go of the button instead? Or maybe let me change between the two options with a switch? I'm putting it inside a toy sonic screwdriver. Please reply ASAP, I have a birthday party coming up and I need to finish it.
dark sponge (author)  furrysalamander2 years ago
If you use that LED, the only things you can take out are the transistor and the resistor that connects it to the microcontroller. Just connect the CTL pin of the LED chip to the output pin on the microcontroller. You shouldn't have to add an additional capacitor, but if the microcontroller resets often you may want to substitute a larger one.

As for the code, you shouldn't have to modify it. I would recommend leaving the button in the way it is right now to save battery, but if you want to wire it for single press operation there should be a schematic on Adafruit's website. The microcontroller would be wired directly to power but the sense pin (pin 6 I think) would have the button between it and ground.

Version 1.1 has worked perfectly fine for me and I've never found a TV I can't turn off.

Good luck and have fun! I'll try to respond more quickly next time if you have any more questions.
Okay, so I've poked around in the code, and I now know that the 1.1 has way less codes. Is there a way to merge the codes and the format from 1.2 with the main program from 1.1 so that I can use a 1.1 circuit? Or probably simpler, just modify the 1.2 code to work with a 1.1 circuit? I really need help, and I'm pretty sure that this can be done. Also, as far as hold down button until tv turns off and let go, this would require changes to the circuit as well. PLEASE PLEASE PLEASE help me figure this out, this is my best friend and I need to have everything ready to order within the next two days because their birthday is on the 13th. :-|
Wait, does v1.2 have more codes? I'm fine with sticking with v1.1 if they have the same amount of codes!
Please please please help me!
mbotond2 years ago
Which microprocessor replaces the Attiny85v? I can't find Atmel products in Romania.
pabhilash2 years ago
Hi! Great I'ble.. so i have a question. I have a spare ATMEGA328 i can use(got it off an arduino clone). Can i use that instead of the ATTINY? (p.s, i'm assuming it already has a bootloader installed because i have uploaded sketches to it a few times.) Thanks! :)
dark sponge (author)  pabhilash2 years ago
Sadly, no. If you want to use the precompiled code, you need to use an Attiny85v.
karabey2 years ago
Does anybody have the actual Codes?
dark sponge (author)  karabey2 years ago
There is a link in step 5 for a .zip download containing the code.
degen S.2 years ago
hey i,m new at this programing i was wondering if you could just give me a step by step instruction on the arduino software i've done a lot of research on arduino and if you could just give me a step by step tutorial that would be great. i bet it would help a,lot of people too. but if you could that would be fantastic. and ya that,s were i
know arduino and i just need to know what type arduino you used and the software.
ke7ofi2 years ago
What would I need to do to only use the narrow beam LED and a AA batter? I can't really code, but I could struggle through it. Range isn't really an issue, as I'm fitting it in a sonic screwdriver with a reflective cone to boost range a bit, and I'll be close enough that it shouldn't matter.
nodoubtman2 years ago
20$ shipping cost is ridiculous..!!! mouser :(
earthtown2 years ago
Packaged mine in a "door alarm" from Big-Lots (4 for $1...also got a reed switch, batteries, and speaker in parts). Added some sparkfun.com swag just to be flashy...the "geek" sticker wouldn't fit on there, I tried.
dark sponge (author)  earthtown2 years ago
That looks awesome! Thanks for posting pics!
If i use the internal oscillator, I just omit the external one from the schematic, right?
dark sponge (author)  Michael_Bell2 years ago
batman963 years ago
Hi Dark Sponge, You seem to know the most about tv b gones. I build electronic stuff, but I use discrete components, and have yet to use any micro controllers. I wanted a Tv B Gone, but wanted to build my own, I think I asked you about using a universal remote as one a couple of years ago. So here is what I did. I found the Tv B Gone data as a wav file on the net. I loaded it onto my mp3 player only to find that it can't play wav files. I converted it to mp3 and then heard some nice fax machine sounds. I made a Infa Red plug for my mp3 player out of a mono jack and two leds one facing each direction, (I found how to wire it in a article about using a Iphone as a universal remote). So the Idea is that I bring my mp3 player when I am going to be in waiting rooms and such, so when i want to shut off a tv I just plug that in instead of headphones. But my mp3 player doesn't have enough power to light them, If I run it though a small amp taken from a set of old computer speakers it works fine and shuts off all of my tvs, but that is to big to take with me. I already tried turning up the audio file on the computer, it is louder, but still doesn't light them. I know it works, obviously the I phone puts out enough power to work, the IR leds I am using are the dark ones, although I tried the ones out of a ball mouse too. Are there any that have a lower voltage? Thanks, Batman96
sorry for replying to such an old comment, but can you post a link to the wav file?
That's OK.

I have no idea where the website I got the files from are, but if you PM me your email I can send them to you, it seems you can't upload a file into a comment.
Also I have individual WAV files for each TV type, and I have them all combined into 4 WAV files, tell me which you want, or if you want all of them. All together the files are about 15MB.

I've found that there are no mp3 players that put out the required voltage to light the led's, you have to run the audio through some sort of amplifier, I wanted to make a very tiny in line amp that used a transistor and watch batteries, but I couldn't get enough quality, the sound degradation was so bad that the TV wouldn't recognize the signal, so you either have to use a bigger amp like I did, or make a high quality mini amp.
dark sponge (author)  batman963 years ago
In that situation I would advise just building a simple amplifier with a transistor that would plug into the mp3 player and be powered by a separate battery. I don't know why it doesn't already light them, it should have enough power. But If it works with the computer amp, a smaller pocket amp should work too. You could maybe even get it to run off of a coin cell. Good luck!
Is there a way to use Arduino code?

I have an Arduino to ATtiny programmer...do you think that would work?
avrdude -c arduino -p t85 -P [your arduino comport here for example if it was comport 15 it would be '-P com15'] -b 19200 -U flash:w:tvbgone.hex
dark sponge (author)  blinkyblinky3 years ago
I think you can use the Arduino as a programmer to send this code to the ATtiny chip. You could also try to write your own code in arduino, but I would recommend just using the premade stuff.
« Previous41-80 of 305Next »