Linux Kernel Module to Control 434Mhz RC Outlets

Some time ago, I wrote about using an EDIMAX Smart Plug with Python. The EDIMAX has build in Wifi and runs its own web server. While this is convenient, it also makes the EDIMAX quiet expensive. Lately I got notice (thanks Eric), about very cheap 434MHz based plugs sold by Pollin for less then 10 EURO per 3 pieces (including a remote control I will not need anyway). Also there are libraries for using them with a cheap 434MHz transmitter as well as some remote control software for the RaspbarryPi.

What I didn’t like about the existing solutions was the fact, that the driver ran in user spacing using wiringPi to access the GPIOs. To my opinion there is absolutely no need to wrap all this low-level stuff in user-space. The Linux kernel itself provides a very good abstraction layer to access GPIOs in a machine independent way. Also exposing functionality could be done easily through sysfs.

Thus, I decided to somehow rewrite the above code (rcswitch-pi) to live in a Kernel module being accessible through sysfs. The complete results could be found here.

Operating the outlets now becomes very simple and could be done from almost any programming language. Even from bash.

E.g. to turn the power on for address ‚11111‘ and channel ‚A‘ one could use:

echo "11111A1" > /sys/kernel/rcswitch/command

Or to turn the power off for the same device:

echo "11111A0" > /sys/kernel/rcswitch/command

I also included optional power-management, allowing the transmitter to be turned on/off (if VCC of the transmitter is connected to an GPIO):

Power on the transmitter:

echo "1" > /sys/kernel/rcswitch/power

Power off the transmitter:

echo "0" > /sys/kernel/rcswitch/power

Get current power state of the transmitter:

cat /sys/kernel/rcswitch/power

This far, I only tested the module on my 8Devices Carambola board (running kernel 3.3.8). But it should work without modifications for any other Linux board.

For more instructions, please see the projects README.

More links regarding RC outlets:

And some pictures of mine:

433MHz transmitter

434MHz transmitter

RC outlets

Pollin RC outlets

Leave a Reply

You must be logged in to post a comment.