← Builds / BLD-02

Arduino motion sensor that turns off the TV

Build an Arduino motion sensor that turns the TV off automatically when the room is empty, with a warning light and a sleep mode for film nights.

BuildElectronics

Every parent knows the sound of a TV playing to an empty room. I got fed up with it, so I built a small Arduino motion sensor that sits next to the TV, watches for movement and turns the TV off automatically when everyone has wandered off.

Watch the full build

Pressing play loads the video from YouTube (privacy).

How the motion sensor works

The device uses a passive infrared (PIR) sensor to detect motion. If nothing moves for four minutes, an LED starts flashing as a warning; wave an arm within the next minute and the timer resets, otherwise an Arduino Nano fires an infrared LED that sends the TV's own "off" signal, exactly like the remote would. The sensor turned out to be sensitive enough that it almost never flashes when someone is actually in the room.

Power took some thought. If I'd powered it from the wall, it would keep sending "off" every five minutes and end up toggling the TV back on. Instead it runs from the TV's USB port, so it only has power while the TV is on.

Building the electronics

I built the electronics on perfboard mounted on standoffs inside a small project box, drilling the board and box together so the holes lined up. Two potentiometers set the brightness of the status LED, and a push button bypasses the sensor to send the off signal immediately, which is handy for testing with a new TV without waiting five minutes. Components that weren't soldered to the board use clip-on leads, and everything is locked in place with hot glue.

A sleep mode for film nights

There's also a "grown-ups" mode. I found a button on our remote that the TV ignores (record), cloned its signal with an infrared receiver and a sketch that reads remote codes, and programmed the device to go to sleep when it sees that signal. That way you can watch a film without having to wave at the wall every few minutes.

Hiding it behind a floating panel

A black box next to the TV would look ugly, so I hid it behind a floating white front panel that overlaps the box from most angles. I cut the panel with a circular saw against a straight edge and sanded the rough edge clean. A short acrylic rod, polished through wet-and-dry and metal polish, acts as a clear window for the IR receiver, the same trick I used for the status light on my coffee machine keypad lock. The status LED is glued flush behind the white plastic so it glows through the panel without needing another hole. The front panel is hot-glued on and the whole thing hangs on the wall with Blu Tack.

As the person paying the electricity bill, hearing the TV switch itself off still brings me a lot of joy.

More from the workshop