How to Automate Your Home Without Rewiring

Radio-controlled servos allow you to control lights without having to deal with high voltages

4 min read
How to Automate Your Home Without Rewiring
A radio-controlled servo arm buzzes in office visitors without the need to connect a receiver directly to the intercom circuitry.
Photo: Paul Wallich

I don’t like working in the dark. But I also don’t like mains current. Maybe it’s the smoke and flames, maybe it’s the flying droplets of molten metal, maybe it’s the chance of sudden death, but I just like to make my mistakes at lower voltages and amperages. So years ago, when I found out that all the light fixtures and most of the sockets in my basement (where I have my workbench) were on the same circuit, I put my plans for converting everything to remote control on indefinite hold.

But lately I’ve been exploring more mechanical solutions: If I can’t play with the power lines, why not just use microcontrollers and servos to push buttons, pull lightbulb chains, and flip switches directly?

It started at the office space in downtown Montpelier, Vt., that I share with a couple of dozen other freelancers and small entrepreneurs. There’s an intercom-buzzer setup for letting people in, but no one likes interrupting a coding spree or a conference call to walk over to answer the door. So I thought it would be easy and fun to build a widget that would push the door button remotely while avoiding any landlord trouble that could come from monkeying around with the intercom system itself.

Several prototypes later, I’d learned some valuable lessons. First, solenoids are expensive and power hungry and can push a button effectively only if they’re mounted to within a fraction of a millimeter of their ideal position—too close in and you risk crushing the button into its housing; too far out and the button won’t depress far enough to register. And a solenoid completely blocks the button, so you can’t push it with your finger either. Then I thought of using a servo to swing a button-pushing arm in and out of the way, but getting stand-alone 555-timer-based circuits to control a servo’s motion reliably is harder than I first imagined.

So I decided to replace the simple timer-based circuit with an ATTiny84 microcontroller in a 16-pin package (well under US $1 if you order 25 or more). This controls a $5 microservo mounted on a little 3-D-printed housing attached to the intercom, and the controller and servo are powered via a DC adapter plugged into a wall socket.

I designed the housing using OpenSCAD, an open-source, text-based, solid-geometry program that’s particularly suited for people like me, who can’t draw but can still type a precise description of what they want. Add a rectangle here, cut out a cylinder there, and voilà. Then I sent the design to the little PrintrBot Jr sitting next to my desk using Repetier, a free controller program. I use PLA (the somewhat incorrectly named polylactic acid) plastic at the office because the molten ABS that’s commonly used for 3-D printing smells really unpleasant.

Then I used the Arduino IDE to program the controller, thanks to the community of hackers who have made definition files and libraries for the ATTiny series in addition to the ATmegas that grace regulation Arduino boards. (There is one minor factor-of-8 error in the microsecond delay code in the core library for the ATTiny, but that was easily fixed.) When I push a button on a radio-transmitter key fob, a matching receiver (about $12 for the set) changes the signal on one pin of the controller. In response, the ATTiny84 sends a series of pulses to the servo, which commands the servo to swing its arm into the button, wait 3 seconds, and then swing back out of the way.

I didn’t have to be as precise in mounting the arm as with a solenoid, because I made it easy to adjust the swing of the servo arm after installation. My code, which uses only about 1200 bytes of the 8 kilobytes available in the ATTiny84, can precisely tweak the swing based on which of the microcontroller’s spare I/O pins are connected to the supply voltage and which are connected to ground.

To flip light switches in my basement, I’ve used a similar servo arm but have taken a slightly different approach with the remote control, because I don’t have a convenient wall socket and must rely on battery power. The transmitter-receiver devices I used at the office are out of the question, as the receiver draws close to 5 milliwatts and takes too long to wake from sleep mode and register a signal for a snappy response. At 5 mW, without sleeping, a typical stack of four 2000-milliampere-hour AA batteries would last only a few weeks.

Instead, I’m stuck, so to speak, with the Nordic Semiconductor nRF24L01+, a mesh-network transceiver with way more features than I need. But it can wake up, do its business in a few milliseconds, and go back to sleep. (It’s $20 a unit from Sparkfun, but from a Shenzhen, China, supplier in the backwaters of the Internet, it’s a fifth that price if you order enough items to justify the terrifying shipping charge.) Once again, hackers have built and made available RF24-series libraries for the ATTiny84 as well as for regulation Arduinos. Power consumption in standby mode is a few dozen microamperes, which matches well with the similar amount used by the microcontroller in deep-sleep mode. Consequently, I expect to get six months out of the batteries, maybe more. Once I get a bunch of units built, say one for each light fixture, I’m going to test different power-saving strategies with the nRF24L01+, such as whether it’s thriftier to have the device sleep deeply and take more time waking up, or to have it sleep lightly and wake up—and thus go back to sleep—more quickly.

Oh, and if you’ve been wondering about the power consumed by the servos, don’t bother. Even drawing a whole ampere—considerably more than a microservo actually draws—for 3.6 seconds is all of 1 mAh. Another idea would be to charge a battery from the light source: I’ve discovered that if I cram a small solar cell right next to the tube of a fluorescent light fixture, I can get a couple milliamperes of charging current, but I’m not sure I want to bother with that.

About the Author

As a IEEE Spectrum contributing editor, Paul Wallich regularly writes Hands On articles. Projects from previous columns include a child-tracking drone and a laser engraver built using an old DVD burner.

This article is for IEEE members only. Join IEEE to access our full archive.

Join the world’s largest professional organization devoted to engineering and applied sciences and get access to all of Spectrum’s articles, podcasts, and special reports. Learn more →

If you're already an IEEE member, please sign in to continue reading.

Membership includes:

  • Get unlimited access to IEEE Spectrum content
  • Follow your favorite topics to create a personalized feed of IEEE Spectrum content
  • Save Spectrum articles to read later
  • Network with other technology professionals
  • Establish a professional profile
  • Create a group to share and collaborate on projects
  • Discover IEEE events and activities
  • Join and participate in discussions