My smart home @ 433 MHz

openHAB site openHAB chart

In this post I want to share some details about my simple low budget smart home system based on 433.92 MHz receiver/transmitter controlled by Arduino. It can be easily extended with many cheap wireless devices, such as door bells, remote sockets, smoke alarms, leak detectors, etc. I’ll describe how to control remote socket, receive alarms from wireless smoke detector and draw a plot of room temperature obtained from regular wired sensor.

433MHz RF kit 433MHz sockets 433MHz smoke alarm

Hardware: Raspberry Pi, Arduino, 433MHz RF kit, 433MHz remote socket and alarm, DHT22 temperature sensor. The choice of remote devices is always a bit of a lottery, but it seems that anything that is compatible with cheap GSM alarm systems should do. There’s also a list of working devices you can check out.
Software: Raspbian, openHAB, Arduino IDE, RC-Switch, DHT library.




I downloaded rc-switch and Adafruit DHT libraries and installed them via Arduino IDE. Both have nice tutorials if you need help with wiring and testing.

First I needed to decode commands used to control remote socket and find out smoke alarm code. To do that I used ReceiveDemo sketch which comes with rc-switch library. I just launched it, opened Serial Monitor and started pushing buttons on socket remote control and test button on the alarm. I made sure that the codes for the sockets work by modifying and running SendDemo sketch. In my case the tricky part was to use 180 ms pulse length instead of 178 as reported by ReceiveDemo.

Then I came up with very basic protocol for serial interface. To operate sockets, I send “sXu” and “sXd” strings to Arduino where X is socket number and “u” means “on” and “d” means “off”. For example, “s2d” turns off socket #2. When rc-switch receives an alarm, Arduino sends out “raY” string where Y is detector number.

openHAB installation

There’s an openHAB repository for Raspbian, so installation is pretty easy.

First, make sure you have Java Runtime Environment installed:

sudo apt-get install openjdk-7-jre-headless

Then follow openHAB Wiki to add repo and install openHAB runtime. We’ll need some additional packages:

sudo apt-get install openhab-addon-binding-serial openhab-addon-persistence-rrd4j

Copy distribution config file:

sudo cp /etc/openhab/configurations/openhab_default.cfg /etc/openhab/configurations/openhab.cfg

Don’t forget to enable permissions for serial access as described in Wiki:

sudo usermod -a -G dialout openhab

openHAB configuration

This was the most complicated pаrt for me because openHAB is very complex and flexible. First one has to define items which are, for example, switches, temperature values and strings coming to and from serial interface. Then there are rules which tell openHAB what to do when something changes (commands are received, values change or scheduled time comes). To display something on the web page or mobile app one needs to setup a sitemap. Finally, to store values like temperatures and switches’ states, persistence is required.

Let’s define a remote socket, serial communication string, and temperature value:

Now add some rules to check temperature every minute, receive radio signals and send radio codes when switches are clicked in openHAB:

Of course you can use any other external command (e. g. sendmail) or internal openHAB commands to react on events like alarms. Please see openHAB Actions Wiki page for details.

Now let’s make a nice interface!

Store socket state and temperature in rrd4j Persistence Service (the one we installed earlier):

Configure openHAB to use this persistence by editing main config file (/etc/openhab/configurations/openhab.cfg):


If everything’s OK you should be able to access openHAB web interface at http://[raspberry_pi_address]:8080/ The main log files to check if things don’t work are /var/log/openhab/openhab.log and /var/log/openhab/events.log.

openHAB Classic UI

Final touches

When everything is working as expected it’s recommended to reduce logging verbosity and config polling as described in Performance Tuning. You can also install mobile app with native interface. To be able to access your openHAB instance from the outside world, you can either set up port forwarding on your router or set up my.openHAB account. The latter is much easier and gives you additional features, like mobile app or SMS notifications. Happy hacking!

Your comment: