$3.50 DIY TV-B-Gone Micro
by dark sponge in Circuits > Microcontrollers
256860 Views, 548 Favorites, 0 Comments
$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!
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!
Materials and Tools
Here is a list of what you will need.
Materials:
You will also need some 2032 batteries to power it. DON'T FORGET!
Tools:
Materials:
- Attiny85v microcontroller - $1.82
- CR2032 battery holder - $0.62
- 8MHz resonator - $0.50
- Wide-angle IR LED - $0.20
- Narrow-bean IR LED - $0.18
- NPN transistor - $0.10
- 150 ohm resistor - $0.05
- 22uf capacitor - $0.02
- Small pushbutton - $0.27 (note: this is slightly different than the one I used)
You will also need some 2032 batteries to power it. DON'T FORGET!
Tools:
- 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
Downloads
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:
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.
Prep for Programming
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!
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!
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!
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!
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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!
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!
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.
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.
The capacitor filters the power from the battery to provide a smooth voltage for the microcontroller even with the LEDs flashing really fast.
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.
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.
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.
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.
Optional: Add an Indicator LED
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.
Materials:
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.
Materials:
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.
Downloads
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 :-)
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 :-)
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.
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.