loading
Some time ago i found the tv-b-gone kit on the internet, and i really wanted one of those! Problem: I don't live in USA so the shipping costs were huge! After some search on google  I'we found that this guy adapted the code from the ATtiny85v chip inside the TV-B-gone to the arduino. So here it is, a tutorial for those who have an arduino laying around and some other stuff:

-breadboard
-IR LED
-1K resistor
-2n4401 transistor
-jumper wires
-pushbutton

More details and files on my website




Step 1: Make it!

          First, connect the 5v pin from the arduino board to the second horizontal rail of the breadboard and the GND pin of the arduino to the first one. Now, place your pushbutton, LED , transistor and resistor on the breadboard according to the schematic. Connect one of the pushbutton's pin to the ground and the second one to the digital pin 2 on the arduino board.
         Now for the transmitter part, you will have to connect the collector pin of the npn transistor to the 5v rail , the base to the digital pin 3 and the emitter to the anode (+) pin of the  LED. The cathode will be attached to GND trough a 1k resistor.
         *Note:If you're in Europe, you'l have to connect the digital pin 5 to ground trough a 1k ohm resistor.

         Your breadboard should look like this now:
<p>Hi all. for those who encountered errors:</p><p>i had the same problem with all of you, every few lines some error occurs, after a few hours of playing with the code and the libraries and reading the Ken's method (http://www.righto.com/) of coding for hundreds of times, i found that the problem is not the code itself, I've tried fixing every error, changing every port and finally came to this:</p><p>version 1.0.3 (http://arduino.googlecode.com/files/arduino-1.0.3-windows.zip) of arduino IDE for windows, just uploaded it to my UNO R3 without any errors and it works great. i have used no transistors or resistors, just pinned anode of the IR LED to pin 3 and then grounded the IR LED cathode to GND right next to pin 13. turns every single TV that i have tested so far off, 30 years olds from sony to toshiba and high end samsung TVs.</p>
I've hit several problems trying just to verify the code. So for anyone else, apparently some compilers don't like the way NApowerCodes and EUpowerCodes are declared, you need to add a &quot;const&quot; after &quot;*&quot; or it won't recognize the variable as a constant: <br>const struct IrCode * const NApowerCodes[] PROGMEM = { <br>extern PGM_P * const NApowerCodes[] PROGMEM; <br> <br>Now I've gotten no end of trouble with NApowerCodes apparently being undefined: <br>&quot;/usr/share/arduino/TVB.ino:381: undefined reference to `NApowerCodes'&quot; <br>There's no reason why this should be that I've found, though, it's defined in WorldCODES.cpp. Any thoughts on how this should be?
<p>i get the same errors. haven't got around them yet.</p>
<p>I managed to compile it with an older ide release : http://arduino.cc/en/Main/OldSoftwareReleases i used version 1.0.5 and it worked just fine</p>
<p>I tried and got the errors,</p><p>TVB.ino: In function 'void sendAllCodes()':</p><p>TVB:261: error: 'NApowerCodes' was not declared in this scope</p><p>Anyway this could be fixed?</p>
<p>can i use arduino nano?</p>
<p>Thanks for good tutorial, it works very well (the EU version). I made it without the resistor and added second LED (parallel to the first one) and it has longer range. I turned on and off the TV in a restaurant from about 15-20 meters distance through glass, I consider it a very good result. I think I'm gonna add some switch for quick and easy change between EU and US version and may be I'll try adding more diods.<br><br>Also, if you have trouble with compilling or seeing three tabs, put all three files into folder named &quot;TVB&quot;.</p>
<p>Any fix for the error message: &quot;undefined reference to 'NApowerCodes'&quot;</p><p>... and ... &quot;undefined reference to 'EUpowerCodes'&quot;</p><p>... yet?</p>
<p>Ok so I am beginning to get frustrated as I have built everything but cannot get the code to compile due to several error codes. I click on TVB.pde and it doesn't download but rather opens in a new tab on Chrome (Mac User). I cannot see three tabs when I copy and paste it into the IDE, don't see a download button, and also cannot get it to compile in 1.0.5. Do I need to open all three files in three tabs and then compile? Help</p>
<p>I am using an Uno R3. Does that matter? It is a 328 something or another and not an ATTiny</p>
<p>Ok so I am beginning to get frustrated as I have built everything but cannot get the code to compile due to several error codes. I click on TVB.pde and it doesn't download but rather opens in a new tab on Chrome (Mac User). I cannot see three tabs when I copy and paste it into the IDE, don't see a download button, and also cannot get it to compile in 1.0.5. Do I need to open all three files in three tabs and then compile? Help</p>
<p>Ok so I am beginning to get frustrated as I have built everything but cannot get the code to compile due to several error codes. I click on TVB.pde and it doesn't download but rather opens in a new tab on Chrome (Mac User). I cannot see three tabs when I copy and paste it into the IDE, don't see a download button, and also cannot get it to compile in 1.0.5. Do I need to open all three files in three tabs and then compile? Help</p>
<p>Hey, just an idea. This will probably sound like evil and blasphemy, but I've been using the IR LED without a resistor. No, really! It improves the range immensely. I think that, because It's only on so momentarily due to the IR protocol, it shouldn't burn out the LED, and mine has been working well for a little bit now. Besides, if it breaks, I'll just solder another one up. After all, they are dirt cheap or even free if you salvage them.<br><br>Does anyone else have experience with using LEDs this way? What were the long-term results?</p>
<p>the circuit of the original TVBgone also uses no resistor</p>
Well yeah, but that runs off of a 3.7 volt cell, which is about the forward voltage of the LED anyway. 5v is pushing it, but it's not that bad for the little rapid flashes that are used.
<p>Well, the IR333 that is used in the TVbGone actually has a forward voltage that is abt 1.4 Volt at 100mA but goes up to 2.6 Volt at 1 Amp. It is fed from 2x AA batteries so it is 3 Volt. As the saturation voltage of the 2n3904 that is used is about 0.3 that leaves 2.7 Volt for the IRLED. As with rising currrent its forward voltage goes up to 2.6 and the batteries will never actually deliver 1 amp. It should be OK.<br><br>Other common IRLEDś as the IR204 and the SFH485 have a forward voltage of abt 1.4 resp 1.5 V.<br>The transistor used (2n4401) has a saturation voltage of abt 0.7 which leaves 4.3 Volts for the diode (that isnt further specified).<br>So 5 Volt is indeed pushing it a bit but i guess it is OK as I presume the author's device is still working.<br>The reason of course being that it uses PWM so the diode might be off half the time.<br>What would concern me is that for whatever reason the transistor (and thus the diode) might be switched on continuously for even a short while by e.g. a hanging program or testing.<br><br>I have a setup with the IR204 and SFH585 in series with a 20 ohm resistor and a BC547 (Vcesat=0.2V), so that leaves a drop of 1.4+1.5+0.2=3.1 Volt. leaves 2 volt, so ideally I would be pushing 100mA through the LED's.<br>I find that with that I can control my TV very well.<br><br>For a TVb-Gone I can imagine one wants more range as the TV in question might be further away or behind glass or whatever.<br><br>Regardless though, as said, the author got it to work with no resistor so it shld be fine</p>
<p>your video does not exist</p>
<p>Can I use 2 LEDs for extended range? If so, will I need to modify the code?</p>
<p>Yes you can. I used 4 for mine. you just have to put 2 lds in parallel and connect all the base leads of the transistor(the middle ones) to pin 3.</p>
<p>is this supported by arduino because i keep on getting errors plz help</p>
do you think i could upload the code too an attiny85, to make it smaller <br>
<p>the code was originally designed for attiny85. this is just a ported version for the atmega. you should be able to program an attiny with an AVR programmer and the original TV-B-Gone code</p>
What type of infrared LED works best? <br>On a side note, unless you are using more than one led in series ( I found that 3, 1.5 volt LEDs works best for 5 volts), you can burn out the LEDs really quick! Also, series means: <br>Input + (LED) - to + (LED) - to + (LED) - to ground
<p>That is why I used a resistor. You can also use 3 leds in series, but i found that connecting them in parallel, with separate transistors and resistors, all triggered by the same pin (3) gave me the best results. I used High power infrared LEDs</p>
<p>There are a bunch of errors in the code.</p><p><br>sketch_jun10a.ino:33:18: error: main.h: No such file or directory<br>sketch_jun10a.ino: In function 'void xmitCodeElement(uint16_t, uint16_t, uint8_t)':<br>sketch_jun10a:89: error: 'IRLED' was not declared in this scope<br>sketch_jun10a:98: error: 'IRLED' was not declared in this scope<br>sketch_jun10a:110: error: 'IRLED' was not declared in this scope<br>sketch_jun10a.ino: In function 'void setup()':<br>sketch_jun10a:194: error: 'LED' was not declared in this scope<br>sketch_jun10a:195: error: 'IRLED' was not declared in this scope<br>sketch_jun10a:196: error: 'DBG' was not declared in this scope<br>sketch_jun10a:200: error: 'REGIONSWITCH' was not declared in this scope<br>sketch_jun10a:201: error: 'TRIGGER' was not declared in this scope<br>sketch_jun10a:209: error: 'NA' was not declared in this scope<br>sketch_jun10a:210: error: 'DEBUGP' was not declared in this scope<br>sketch_jun10a:213: error: 'EU' was not declared in this scope<br>sketch_jun10a:214: error: 'DEBUGP' was not declared in this scope<br>sketch_jun10a:218: error: expected `)' before ';' token<br>sketch_jun10a:220: error: expected primary-expression before ')' token<br>sketch_jun10a:220: error: expected `;' before ')' token<br>sketch_jun10a:221: error: expected `)' before ';' token<br>sketch_jun10a:223: error: expected primary-expression before ')' token<br>sketch_jun10a:223: error: expected `;' before ')' token<br>sketch_jun10a:231: error: 'EU' was not declared in this scope<br>sketch_jun10a.ino: In function 'void sendAllCodes()':<br>sketch_jun10a:242: error: 'REGIONSWITCH' was not declared in this scope<br>sketch_jun10a:243: error: 'NA' was not declared in this scope<br>sketch_jun10a:247: error: 'EU' was not declared in this scope<br>sketch_jun10a:256: error: expected `)' before ';' token<br>sketch_jun10a:257: error: expected `;' before ')' token<br>sketch_jun10a:260: error: 'NA' was not declared in this scope<br>sketch_jun10a:268: error: expected `)' before ';' token<br>sketch_jun10a:269: error: expected `;' before ')' token<br>sketch_jun10a:278: error: expected `)' before ';' token<br>sketch_jun10a:280: error: expected primary-expression before ')' token<br>sketch_jun10a:280: error: expected `;' before ')' token<br>sketch_jun10a:281: error: expected primary-expression before 'x'<br>sketch_jun10a:283: error: 'x' was not declared in this scope<br>sketch_jun10a:284: error: expected primary-expression before ')' token<br>sketch_jun10a:284: error: expected `;' before ')' token<br>sketch_jun10a:288: error: expected `)' before ';' token<br>sketch_jun10a:289: error: expected `;' before ')' token<br>sketch_jun10a:294: error: expected `)' before ';' token<br>sketch_jun10a:296: error: expected `;' before ')' token<br>sketch_jun10a:359: error: 'TRIGGER' was not declared in this scope<br>sketch_jun10a.ino: In function 'void loop()':<br>sketch_jun10a:378: error: 'TRIGGER' was not declared in this scope<br>sketch_jun10a.ino: In function 'void delay_ten_us(uint16_t)':<br>sketch_jun10a:399: error: 'DELAY_CNT' was not declared in this scope<br>sketch_jun10a:400: error: 'NOP' was not declared in this scope<br>sketch_jun10a:403: error: 'NOP' was not declared in this scope<br>sketch_jun10a.ino: In function 'void quickflashLED()':<br>sketch_jun10a:412: error: 'LED' was not declared in this scope<br>sketch_jun10a.ino: In function 'void sleepNow()':<br>sketch_jun10a:436: error: 'TRIGGER' was not declared in this scope</p>
<p>sorry for replaying so late. you probably tried to compile the main.h file. you have to open the TVB.pde file and upload that one.</p>
i copied the main.h into my ide and hit upload and it gave me a bunch of erros like no void loop or setup help?
Sorry that was my mistake...I meant TVB.pde. You only have to open the TVB.pde and everything should open by itself. upload the pde file on the arduino only
Hi, Just wondering what the point of the transistor is as most LEDs dont draw enogh to burn out a pin?
It's not about burning the pin, the transistor is there because a simple arduino pin does not &quot;give&quot; enogh current to power the led at it's full capcity..So the transistor is there to make the TVB more powerful.
Hey I tried using this setup and I am having trouble. I have everything wired up and connected and I have the firmware flashed and I have even tested to make sure that the led is working using my cell phone camera. But I cant get the thing to turn off any TV's, no matter how close I seem to get to it and having it pointed directly at the TV. Can anyone tell me what they think is wrong?
oh and the boards LED does flash so I know the codes are being sent.
Are you from europe? If you want to turn on/off TVs from there you have to connect the digital pin 5 to GND trough a 10k resistor. Hope this will fix your problem...
I can't get the sketch to upload, it keep giving tons of errors.
i kept having errors too when I tried to upload it to my arduino micro and as soon as I gave up and used my uno all the errors went away.
Why a transistor ?
can i use a 2n3904 Transistor
How do people make circuit drawings like this one?
Hi, you can make drawings like this using CADsoft Eagle or, like i did, using a nice free and easy program called <a href="http://fritzing.org/download/" rel="nofollow">Fritzing</a>
Ah, yes Fritzing. I couldn't remember the name. Thanks!

About This Instructable

39,704views

87favorites

License:

More by EdDruino:Arduino TV-B-Gone 
Add instructable to: