I do a lot of traveling by car, and I usually end up staying in whatever motel is nearest the interstate when I start to feel tired. Often I find that the room has an inexpensive TV that doesn’t have a sleep-timer function. So I created the TV-Go-Sleep, a timer that turns off any TV, after whatever delay time I command. You can build it in an afternoon.

The timer is built around an Arduino microcontroller that’s been loaded with an open source TV-B-Gone library and a few lines of my own code. A simple pushbutton is used to set the delay time, which is shown on a 7-segment display. When the timer expires, the Arduino uses infrared LEDs to transmit all the TV “off” codes it knows, and the TV shuts down. Good night!


  • Ian

    I have a problem vith the code it says IRLED was not declared and much more errors like that.

  • Eloy Salinas

    Sounds like a needed library file was not #included

  • Tom Rodgers

    I’m glad to see people are trying this build, but I’m sorry it’s not working for everyone!

    The IRLED variable is defined (along with several others) in the “main.h” file, which needs to be “#includ”-ed when the “Universal_Sleep_Timer_Arduino_Code” sketch is compiled. As written, the code does not include a path to that header file, so it should be in the same directory as Universal_Sleep_Timer_Arduino_Code. That will probably solve all of the “[whatever] not declared” errors at once.

    It’s difficult to know what sorts of issues might be arising from the different configurations of different peoples’ computers. The code worked fine for me, of course, but someone else may have their directory tree or default file locations arranged differently.

    I can’t be sure without looking at Ian’s computer, but I think putting “main.h” in the same directory as the sketch itself should take care of this…

    • aaron

      i tried that and it just said “error compiling” can you help?

  • jalela balkrushna

    show some other project

  • jalela balkrushna

    give information about arduino based home automation project

  • Dmitriy Kovalenko

    Can’t compile the code for Arduino Mega 2560… Compiler gives an error “Huh?..Bootloader” and it seems it won;t compile nothing until I change the Arduino board… Please help…

    • Tom Rodgers

      Hmmm – I would like to help, but I’ve never had this problem…

      I’ve seen the program work on a Duemilanove, an Uno, a Mega, and an Ardweeny, and a stand-alone ATMega 328 (which is more-ore-less the same thing as an Ardweeny).

      As you probably know, it sometimes takes some trial and error to get the right combination of board, com-port, and baud rate. Have you used this specific board before, or is it possible that the problem is actually with the hardware?

      Are you getting a message that there is a problem with your bootloader or with the avrdude?

  • Catwalk803

    This item could solve a lot of problems in our house. However, we are not techies and don’t pretend to be. Bottom line, can you sell me one premade? Boyfriend refuses to purchase a new tv because the SLEEP button is too many steps for him and he uses it on/of during sleep periods. Help please!

    • aaron

      sure how much we talking?

  • Gege

    Doesn’t work in Germany…mabey the code isn’t made for german TVs ?

  • najs


    Nice project! I’ve followed the steps but i got suck at uploading the Universal_Sleep_Timer_Arduino_code.ino to my arduino. It says “Redefinition of ‘struct IrCode’. Do u have any idea what I’m doing wrong?

    Would be nice with a little help!

    Thanks in advance (-:

  • Rajdeep

    I cant upload the code. PLZ help me