Five Dollar RF Controlled Light Sockets

This is tens of thousands of dollars worth of market research I’m about to spill, so buckle up. I have a spreadsheet filled with hundreds of projects and products that are solutions to ‘home automation’ according to their creators. The only common theme? Relays. Home automation is just Internet connected relays tied to mains. You’re welcome.

[Todd] over at Fabricate.io found an interesting home automation appliance on Amazon; a four-pack of remote control light sockets for $20, or what we would call a microcontroller, an RF receiver, and a relay. These lamp sockets are remote-controlled, but each package is limited to four channels. Terrible if you’re trying to outfit a home, but a wonderful exploration into the world of reverse engineering.

After cracking one of these sockets open, [Todd] found the usual suspects and a tiny little 8-pin DIP EEPROM. This chip stores a few thousand bits, several of which are tied to the remote control. After dumping the contents of the EEPROM from the entire four-pack of light sockets, [Todd] noticed only one specific value changed. Obviously, this was the channel tied to the remote. No CRC or ‘nothin. It doesn’t get easier than this.

With the new-found knowledge of what each lamp socket was looking for, [Todd] set out to clone the transmitter. Tearing this device apart, he found a chip with HS1527 stamped on it. A quick Googling revealed this to be an encoder transmitter, with the datasheet showing an output format of a 20-bit code and four data bits. This was a four-channel transmitter, right? That’s where you put each channel. The 20-bit code was interesting but not surprising; you don’t want one remote being able to turn of every other 4-pack of lamp sockets.

With all the relevant documentation, [Todd] set out to do the obvious thing – an Arduino transmitter. This was simply an Arduino and a transmitter in the right frequency, loaded up with bit of carefully crafted code. [Todd] also figured out how to expand his setup to more than four lamp sockets – by changing the 20-bit code, he could make his Arduino pretend to be more than one transmitter.

With Arduino-controlled lamp sockets, the world is [Todd]’s oyster. He can add Ethernet, WiFi, Bluetooth LE, and whatever trendy web front end he wants to have a perfect home automation setup. It’s actually a pretty impressive build with some great documentation, and is probably the cheapest way to add Arduino/Internet-enabled relays we’ve ever seen.

 

46 thoughts on “Five Dollar RF Controlled Light Sockets

    1. In the US you have 120vac in your outlets.

      That’s something that forces you to use up to 32amp circuit breakers.

      And you have wall outlets that would not be considered safe in the rest of the world.

      You tell me what’s dangerous?

      1. I’ve never seen a 120v 32 amp baker in house wiring, and I’ve been in fuse boxes from the 70’s through the breaker boxes of the late oughts.

        I’ve definitely never been forced to use one.

        Just checked my breaker box and I’ve got a few 30 amp breakers and a 50 for the stove, all of those are for 240v though. Otherwise everything is 15 to 20 amps…

        Maybe I missed the memo that we were all forced to use 32 amp breakers… was it part of Obama care?

  1. We have a “cheap home automation” opensource project called Sensorino where the price is also about $5 per lightbulb or less, since most of the time you’ll have multiple relays and light switches connected to one Arduino.

    Arduino clone at aliexpress – $2.12
    2A solid state relay (capable of dimming) – ~$1
    nRF2401+ module – $0.80
    5V power supply – ~$1.50

    Our Arduino firmware even has a rule engine so you can send it simple automation rules to keep the light switches working even when your home “server” is down.

      1. It hasn’t reached completness yet, we have the “node”-side code but not a nice web UI with a floorplan view of your home/facility (work in progress) or an automation rule composer, so the other parts are in a feature freeze, and yes, the websites aren’t maintained.

        I need to have a look at mysensors.org.

    1. Getting those parts into a box that’s reasonably attractive, safe, and something you’ll be comfortable using long-term is where some run into difficulties, or blow the budget. And the off-the-shelf products, even if inferior, end up looking more attractive.

      For example, consider what seems like a simple detail – how do you install AC sockets in your project box? The panel-mount snap-in variety sockets are cheap and widely available, but only work with a narrow range of panel thickness, which the plastic project box you’ve picked out might exceed. Use thinner plastic, weakened by cutouts for multiple sockets, and while inserting or removing a stiff plug you might crack the plastic – or at least be worried you will, as it flexes alarmingly. Using an aluminum or steel box or mounting panel solves that problem, but introduces a new one by blocking your nRF24L01+ signal. And so on….

      I looked for finished Sensorino projects that might serve as examples or inspiration for final construction details, and found none. (Though it appears two websites that may be related to it are down at the moment.) If you could provide some examples I’m sure many would be interested, myself included.

      1. Those are good points, specifically if you target general (non-maker) users. On top of that, parts that you can legally resell in Europe or in the US, are often much more expensive than getting some for yourself from aliexpress.com.

      2. I personally think it’s worth the cost to get high voltage electronics that are safe. Above anything else, I don’t want to be slain by my $5 lightbulb. It’s somewhere worth spending the money, I’ve seen enough cheap chinese shit go up in flames or fail in ridiculous ways to know that it can not be trusted.

    2. Hey there, I’m looking to dot eh same thing, but I know a lot about microcontrollers and not a lot about power supplies.

      What sort of power supply does one use to convert from power grid to the 5~ volts for the micro-controller, that is also small enough to fit inside an IoT casing?

      I live in New Zealand, so we’re on 240 volts here. :)

      1. Mostly anything in the category of wall-plugged USB chargers, since they’ru e mass produced ==> cheap. Right now there’s one for $0.88 a piece on aliexpress. The PCBs inside them are quite small, although I’m sure you could go smaller if you built something specifically for a 50mA arduino instead of a 1A smartphone.

      2. You would use a “cap dropper” circuit that can supply tens of milliamps. No transformer. See http://www.designercircuits.com/DesignNote1a.pdf for an example. Rectify the AC line, then clamp it to 5.1V or another low voltage with a Zener diode. The current limiting component is either a resistor or, more efficiently, a capacitor.

        It’s super dangerous, but ¯\_(ツ)_/¯ and hopefully nobody is touching the inside of an LED light bulb or dimmer or the other kinds of products they are used in.

        There are also transformerless power supplies that use a high voltage buck converter such as TEA1721 or VIPER12A. These have almost the same cost as a traditional transformer based or flyback supply in a regular 5V power supply.

    3. so that is ~5.24 for the important parts of the BOM. now add a circuit board, power, regulators, plug and socket, housing and your BOM alone is over 10USD. Multiply by ~2.6 to get a somewhat reasonable margin if you will be selling it and your product is five times as expensive as what you aimed for…

  2. The kind that use a regular AC plug also cost $5.00/piece (Bye Bye Standby 6 outlets pack) and have a button on the AC part for learning the code from the remote and for toggling the relay locally if you need to. Also, the protocol is documented and they have actual safety certifications in case you like avoiding fires.

  3. “Home automation is just Internet connected relays tied to mains. You’re welcome…”

    Sorry but this is 100% wrong. Home automation is the software to make smart decisions based on sensor inputs. And home automation that works well does not rely on the internet in any way.

    I really hope you guys go and actually learn what home automation is and the definition of automation versus remote control. because 99% of all projects here claimed as home automation is nothing more than remote control.

    Granted I have been a professional automation systems designer and programmer for 10+ years, so I have a tiny bit of experience in this stuff.

    This project CAN be used with an automation system (If you like DIY look at misterhouse), and it’s a very cool discovery.

        1. to you maybe.

          in my world, the servant already knows what i want, when i want it, based on previous behavior pattern(s), pre-defined rulesets and real time observation.

          plus, who wants to see or reach for a string in order to ring a bell (much less hear one)?
          the servants can use out their own system (protocol) for internal communication.

          get it?

          1. sounds like not much available in your HA universe while there are no limits to GPs HA universe.

            So I guess I don’t “get it,” I don’t need the overly complicated garbage you fetishize. I need a sensor, a relay, and an if statement. same as 99% of other HA applications.

    1. It depends on your background and perspective. If you’re a programmer, the hardest part is the hardware and “remote control” aspect. Once that part is solved, depending on how complex a system you need, the software might be trivial. You might even be able to whip up your own software faster than you can research, select, and learn to use off-the-shelf software like Misterhouse. That is, in fact, what I did.

      Beyond that, the “automation” vs. “remote control” terminology debate is largely semantic. A button IS a sensor input. Even if it’s just a button on a screen. If that sensor input is processed by any form of computer that ultimately controls the device, and you have control over that computer, then you have the option to have it make smart decisions as well. Even if you choose not to exercise that option, it’s still technically a home automation system, or very close to it.

      Say you have a slew of X10 or similar devices attached to various devices in your home. You have a computer, controlling those X10 devices, and running Misterhouse. Is that an automation system? By my definition it is.

      What if the software is merely configured to respond in the most straightforward manner, of turning a single device on or off immediately in response to direct user input? it appears that by your strict definition, you’d consider that remote control, as no “smart decisions” are made. But add a single timed event, a macro that takes an input from a PIR sensor, or a macro that turns off a nightlight when the user turns on a larger light in the same room – and suddenly it’s an automation system. Even though the only change to the entire system might be a single setting, or line of code. Seems like your definition is excessively narrow.

      I do agree 100% that the Internet should not be involved in any way in automated functions. It should only be a form of user input, and not the sole form either. Though I can also see why Brian might have stated it that way, as the line between Internet and local networks is getting increasingly blurred. Often deliberately and needlessly so, by various manufacturers who wish to retain control over how their products are used.

      1. dont agree with the ‘excessively narrow’ definition, it seems pretty clear. and i think you described it well.

        after all, is flipping a normal light switch home automation? of course not. neither is flipping that switch remotely via microcontroller/radio.

        now i think there is an additional, subtle difference between ‘automated’ and ‘full automation’ (in my mind). I see something that is automated something being driven by a simple state-device, where full automation is something being decided based on external observation, complex rules, and integration with other/foreign sensor data.

        obviously scripts as we know them are full of decision making points, but in the most simple case (door opens, light turns on) the boundaries and state-machine is very tightly bound.

        with full automation, the system can break outside of this simple state-machine, and instead automatically make complex and informed decisions based on live data, other sensors, and the states of OTHER state machines currently in play. this extra complexity gives a completely different UX than remote control, or simple automated behavior.

        1. Makes sense. But “full automation”, as you described, tends to be problematic.

          As the complexity of the logic goes up, so does the difficulty of preventing it from acting wrongly, when there is a condition the algorithm (or designer of such) can’t or didn’t predict. Depending on what’s under control, you may need to intervene immediately. In which case you have to drop what you’re doing, change mental gears to determine out why the complex logic is failing and fix it, or at least figure out a temporary override; either of which could potentially make things worse if you’re not careful. Not much fun at home, I prefer to approach such issues on my own schedule.

          As a real-world example, I recall reading about a self-learning thermostat (the Nest?), for which reviews on Amazon were sharply polarized. Those who loved it seemed to have very predictable schedules, to the point where they could have been served as well by a simpler thermostat with manually programmable schedules. Others with more varied schedules tended to hate it, finding the device unpredictable, hard to override, prematurely wearing out equipment in order to assert excessively precise control, etc.

          Personally, I would never try a Nest. I’ve tried adding clever and complex features to my home automation system, and generally find that somewhere down the line, some special case comes up that causes frustration cancelling out months of a bit more convenience. I generally stick to fairly simple state engines and schedules now.

          I think that’s why people tend to underutilize automation systems, often using them as nothing more than fancy remote controls. And, in some cases I’ll agree with [timgray1] that a fancy remote control may be falsely called automation, though not with his claim this applies to 99% of the projects here. Though to the user of such a remote, it may still *feel* like automation – by providing the same convenience and saving effort.

    1. Non-pollable devices worked great for me for about 10 years. But the electrical/RF environment in and around my house just kept getting noisier, until they were no longer practical. For others though, they may still work well enough for non-critical things. Just avoid controlling anything that can burn your house down if accidentally left on!

      1. real/practical reason that makes it easy to understand why polling is important, particularly when devices are poorly designed, from an amazon review:

        “My issue is that when the electricity goes off it resets the lights, so even if they were off when the electricity went off they will come on when the electricity comes back on. Imagine using these in a bedroom at night and having the electricity flicker – the lights are now ON ON ON ON! We have them in a storage area and if the electricity flickers and we don’t know it, the lights could be on for days. This will not be the solution for our weird switch placement problem we had hoped it would be.”

        1. That does suck. Was that review for the product used in this project?

          Though if you’re using an intelligent controller, you might be able to work around the issue. When I used X10 a lot, whenever a device state change was needed my software would reissue the command periodically, at increasing intervals, during times the powerline transceiver was otherwise idle. So even if there was a lost command, it would typically self-correct within a few seconds, despite inability to poll. To deal with brownouts that reset device state, all devices were refreshed at least once every five minutes. The transceiver itself was also able to detect some brownouts, triggering the software to immediately refresh. It worked very well until my electrical environment became so X10-hostile, that even intermittent communications to many devices became impossible.

      1. LOL, that’s one way to describe a “transformerless AC-to-DC power supply”. [Drifter], Google the quoted words if you want to see how a variety of them work. Indeed they are a product of a lot of compromises, and many are just barely adequate.

          1. Safe to use what for? Most of the time you are not poking your screwdriver in AC connected enclosures. In this case the thing receives a radio signal as outside input. I’m not sure how you would get electrocuted by that. If you are doing development/probing while it is connected to AC, you are just a tiny bit stupid.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s