Enocean Wireless and Battery Free Switches | Home Automation Tech Blog

Fun with Embedded Electronics

Enocean Wireless and Battery Free Switches

One of my biggest issues with my home automation system is the need to have some kind of switch to be able to switch on and off lights. I was reluctant for a long time to put control in the likes of the toilet or bedroom for lack of being able to switch them on and off. I had tried to build a battery power 433Mhz system but range was poor and battery life too just didn’t work. Add to the need to have a battery in the first place and a way to change it out, it was scrapped and now lies in my collection of unused PCB’s etc.

The second try was to come up with a way to power it from the mains but that either means running cables to the switch module or picking up power at the switch itself. That idea was scrapped as most homes don’t have a neutral at the light switches.

Then along comes Enocean (http://www.enocean.com) with their range of energy harvesting modules. The PTM210 was the idea choice. Now, cost wise these are not cheap at around US$35 each plus a housing for it but the very fact of the way it works, I find that price to be acceptable. As commercial switches based on this are designed to stick on the wall I needed something that would fit over an existing switch. It would serve 2 purposes, the first was to keep the switch in the ON position so that the ESP12 based lamp modules had power to keep them connected to the WiFi netwok and secondly to allow a single switch module instead of having an extra module on the wall.

Enocean offer a 3D STEP model of the rocker part that can be used to operate the modules so I loaded this into my 3D CAD software and set about making a housing for them.

I sent of the modules to Itead Studio for printing and they sent back about 2 weeks later some very nice STL printed plastic parts. The surface finish is ultra smooth and a white colour with a sort of semi transparent finish. Here is the final switch module with the PTM210 next to it.

20160930_113303   20160930_113312

The 2 rockers can be used to switch ON and OFF a device, giving you 2 devices under control or you can do as I am and have 4 switches and I use Node-red to send a toggle command to each device. Here is what it looks like on the wall. The labeling is temporary as I plan to get the next batch made with engraving and then infill this with black paint.

20161002_104845

This sits nicely over the existing switch and is held in place with removable double sided tape on the switch and not the wall so if I move home, I simply take this off the wall.

Enocean Pi

To receive the messages from the switches, I used an Enocean Pi from Element14 and this plugs directly onto the GPIO header on the Pi and outputs the data to the UART. There is a Node-red Plugin for the Enocean receiver and this simply outputs the switch code, rocker (A or B) and which button state (UP or DOWN) was pressed. Node-red takes care of the rest.

20161002_105418

I am currently designing a mounting box to 3D print for the Pi to fit into with the LCD panel. It will do all the Node-red stuff and bonus as a touch panel for some devices.

GETTING NODE-RED WORKING WITH THE ENOCEAN

You need to download and install the package from github as the original developer has not yet submitted this to npm.

https://github.com/davemclaughlin/node-red-nodes-enocean-serial

Once you download this, copy this to the Node-red node-modules directory in your installation and type the following so that Node-red knows about it:

        npm link node-red-contrib-enocean-in-out-0-1.html

You should now have 2 new nodes in Node-red once you restart it.

enocean

To use these, you need to inject serial data from the Enocean Pi or other serial device (USB) and then link them together and parse the payload. All the settings are in the INFO tab for the Enocean node.

enocean2

In the sample above, I detect the switch in payload.ID and the which rocker A or B in payload.rocker and finally which button state, upper (0) or lower (1) in payload.state.

Once you have this setup you are ready to control any Node-red device with your Enocean switch modules. The module only supports basic Enocean messages such as the switches which is more than enough to allow you to control your devices without any batteries from anywhere in your home within range of the Pi or PC.


Post a Comment