TV-B-Gone is a small gadget that can turn on and off virtually any TV in the world developed and sold as a kit by Adafruit. They also provide the source code and compiled firmware under Creative Common Share Alike license.
I would like to thank original developers at Adafruit for this great work and sharing ideas before starting showing my modification.
First trial
At first, I downloaded the firmware v1.1 and flashed an ATtiny85-20 and made it with only one transistor and two wide angle IR LEDs with two supercaps as shown below. The switch is connected to the supercap + so it will beam only when you press the button. It worked fine, but the problem was it drained the supercaps too quickly. The first reason is, of course, low capacity (compared to batteries) of the supercaps, but there are other reasons, too. I didn’t have a resonator at 8MHz, so I burned the oscillator selection fuse bit of the ATtiny85-20 as internal 8MHz. The internal oscillator has benefits of omitting an external component and programmable, but there are serious down side; its frequency can be unstable and varies depending on the temperature and power supply, AND it consumes more power at high frequency settings.
After this first trial, I added a 8MHz ceramic resonator and uploaded v1.2 firmware on an ATtiny85V-10 and found it can last double the time than ATtiny85V-20 using internal oscillator. One full cycle of pulsing all the codes takes a little less than a minute and with this latest testing configuration, more than 30 times of full cycle worked with 2 supercaps before the voltage dropped below 1.7V (two in series).
Need to save battery
I have thought about to turn off the device before the full cycle finished once it either turn on or off a TV. Adafruit's firmware database is designed as the codes for popular TV models emits first. So in most cases, long before it emits all the codes, my target TV is turned on or off. I thought about to add a power switch but that wasn’t very attractive to me.
Idea and solution!!
A couple days later, I suddenly got a good idea to utilize the Region Detection pin (pin6 of the ATtiny85v). Once the program detects the region from the level of pin 6 (float (internal pull-up): US, pull-down: EU), it is not used any more until all the codes pulsing is finished. So, in US mode for example, after it started pulsing and when you want to stop it, forcing the pin6 to ground will exit the do loop in software and the device will go sleep. I tested both US and EU mode with modified code and worked fine. This way, you can save battery.
Here in this introduction, I included a picture of the assembled TV-B-Gone JeonLab, but the circuit, which will be shown and explained step by step, is quite simple, so you may be able to assemble one on any prototype board or even on a bread board.
Remove these ads by
Signing UpStep 1Circuit modification
There are three circuits showing in this step: North American (US) models only, European (EU) models only, and all-in-one model with region selection switch.
The PCB I made and showed in the Intro section is the all-in-one model.
As you can see in the circuit diagram, the NA (or US) model has no pull-down resistor on the pin 6. When you successfully turn on or off a TV in the middle of code generation (the visible LED blinking), simply push the button S2 will pull the pin 6 to the ground and the firmware will stop the process and go to sleep mode which doesn't consume the battery.
However, in EU model, the pin 6 is grounded by the pull-down resistor, R3, 10k, always. But pulling up the pin 6 by pressing the button S2 and connect to Vcc, the modified firmware will stop the process and sleep.
The UNI (all-in-one, NA+EU) model simply has both in one by adding a slide switch.
| « Previous Step | Download PDFView All Steps | Next Step » |


















































1. Yes
2. Yes
3. I habe try it with AVR studio 5.1, basecom and some other , but it diesnt worked
4.done
5.done
6.done
7. I got some error messages:
main.c:271: warning: passing argument 1 of 'putnum_uh' makes integer from pointer without a cast
vrdude: ser_open(): can't set buffers for "LPT2"
make.exe: *** [program] Error 1
> Process Exit Code: 2
> Time Taken: 00:02
what did i need to do now?
It has two ports...one on the outside, one intrnal.
I think the outside ones are LTP2, witch i have set in the makefile and are connected with the programmer.
These are the only LPT-ports i have,
Did you mean I need to have the 4 files opened in the background at the same time in PN and compile from the main.c file?
I have try it this way, but i got an error message again:
> "make.exe" program
avrdude -p attiny85 -P LPT2 -c stk500v1 -b 19200 -B 1 -U flash:w:tvbgone.hex
avrdude: ser_open(): can't set buffers for "LPT2"
make.exe: *** [program] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
the programmer i use in one for ATmegas.
This one:
http://www.rn-wissen.de/index.php/AVR-ISP_Programmierkabel
I have change it to stk200 wich is compatible with my ISP programmer, but i got now an other error message:
> "make.exe" program
avrdude -p attiny85 -P lpt1 -c stk200 -b 19200 -B 1 -U flash:w:tvbgone.hex
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
make.exe: *** [program] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
I have checked the connection, but im not sure what connection i need...XTAL1 and XTAL2 or ADC2 and ADC3 to connect to the AVR-board
I have a pci parallelport with 2 ports and in the hardware device the are shown as LPT2 and LPT3 (i dont know why because LPT1 doesnt exist).
I try again to change to LPT1 and 9600 baud and report back.
can you help me to compile the modified Firmware to flash it to the tiny?
I have tried to compile it by myself, but i cant done it because im a newbie in compiling.
would bve great if you can help me.
2. Did you modify the main.c as I explained as above step 3?
3. Which compiler are you using? If you don't have any, google "winavr," download and install it.
4. Go to Winavr folder you installed and find subfolder "pn" (programmer's notepad).
5. Run pn.
6. open up your modified main.c 7. open up Makefile and modify it as I explained in this post.
7. From the menu, Tools-[WinAvr] Program will compile your program. If you have Arduino_ISP programmer, choose [WinAvr] Make All. It will compile and upload the .hex file to the ATtiny85v chip.
Keep me posted.
I Have a question bout your circuit.
Where did the connections from LSP1 and LSP2 from the circuit are going to?
thx
As you can see in the circuit diagram, LSP1 is connected to the VCC pin of the ATtiny85v, which means it is to be connected to the power supply (batteries or supercaps) positive. The LSP2 is to the ground (battery minus).
Thanks.
This means , i need to connect the GND and VCC-connections wiht the LSP connections and connect all together to the power supply, right?