How To Control the Lights with a TV Remote

In this day and age of the Internet of Things and controlling appliances over the internet, the idea of using an old-fashioned television remote to do anything feels distinctly 2005. That doesn’t mean it’s not a valid way to control the lights at home, and [Atakan] is here to show us how it’s done.

To the experienced electronics maker, this is yesterday’s jam, but [Atakan] goes to great lengths to hash out the whole process from start to finish, from building the circuitry to switch the lights through to the code necessary to make a PIC do your bidding. It’s rare to see such a project done with a non-Arduino platform, but rest assured, such things do exist. There’s even some SPICE simulation thrown in for good measure, if you really want to get down to the nitty-gritty.

Perhaps the only thing missing from the writeup is a primer on how to execute the project safely, given that it’s used with a direct connection to live mains wiring. We’d love to hear in the comments about any changes or modifications that would be necessary to ensure this project doesn’t hurt anyone or burn an apartment complex down. Sometimes you can switch lights without a direct connection to the mains, however – like this project that interfaces mechanically with a standard light switch.

16 thoughts on “How To Control the Lights with a TV Remote”

I made a similar circuit in 2007 whit a PIC programmed in assembler to operate over 4 relays using a NEC standard TV remote. It still works and now I’m using it to on/off a relaxing night light to see the TV (italian page translated by google)

No, it wasn’t… it was Dennis Richie that developed it, based on ideas from an earlier language, B, at a time when the founders of the Arduino movement were still in nappies.
Arduino is actually a C++-based environment; C++ being a C derivative.

The functions setup() and loop() are typical in embedded C code. You’d start your code, setup the ports and interrupts and stay in a the loop forever. Often you’d see while(1) or a macro forever(). arduino doesn’t have a lock on those function calls.

Nicely done. Very thorough writeup describing process of analyzing protocol and implementing it using state machine. Libraries are cool if you need to do something quickly, but for learning how something works and how to solve a new problem articles like this are gold.

I don’t know why you seem opposed to promoting safer circuit design. It’s the responsible thing to do, and anyone on Hackaday who might be using their hobby as a springboard to a career would be well served by more professional attitudes and knowledge in this area. Yes, some safety requirements err way to far on the side of inconvenience, but I think the vast majority of them are quite sensible and are derived from real-life negative experiences.

As for the circuit under discussion here, these are the safety tweaks I came up with: 1) I would insist on a fuse in series with C1 if the device was being used in my house. 2) I would recommend a fuse in series with the relay contacts. 3) I would suggest making C1 a ‘Y’ capacitor, so if it fails, (and they do – I replaced one just recently), it will fail open rather than shorted. Of course, it goes without saying that any mains-connected board needs to be in an enclosure. Here, the safety requirements for a commercial device are a whole ‘nother discussion; but for a one-off like this, I would accept a plastic box designed for electrical or electronic devices.

Note the additive and interdependent nature of some of these measures. For example, the fuse and the Y-cap vastly reduce the likelihood of overheating and flames, making a plastic enclosure safer. Without at least the fuse, you’d really want a metal enclosure for fire containment – but then you’d also need to ground it to mitigate the shock hazard.

I’m not quite expert of safety in this kind of applications but application note http://ww1.microchip.com/downloads/en/AppNotes/00954A.pdf suggests X-cap rather than Y-cap. I’m confused about which one to use. Would you mind explaining your reasoning? This would be so helpful. Thanks.