Control Raspberry Pi Wireless Sockets (433MHz) – Tutorial

Often you want to be able to control (household) devices with a higher voltage with the Pi. Raspberry Pi wireless-controlled sockets are ideal for this because they are very easy to control and you do not have to interfere with the circuit. For that and many other projects, there are wireless sockets, as they can be easily remotely controlled from a distance in the house with small radio transmitters.

In this tutorial, I will show you how to set up and configure Raspberry Pi wireless-controlled sockets and how they can be controlled with the Pi.

Required Hardware Parts

For the wireless-controlled sockets, it is important to be able to set the code by means of a DIP switch. There are also models with a generic code. I once tried such a device and could neither read the correct code nor send a correct signal. Although there are now tables with the codes, anyone who wants to be on the safe side can just take, for example, the above linked (without generic codes).

 

Setup

The setup does not really differ from the one shown here.

Raspberry Pi radio-controlled sockets

Raspberry Pi 433Mhz transmitter/receiver setup

 

Let’s get to the setting of the sockets and remote control:

In the remote control, a 5-digit code can be set by setting the DIP switches. You must also set this code in the sockets (opening on the back side). In addition, a name (A-E) must be specified. In my example, I have taken the 00011 as code and marked the socket as E.

 

Raspberry Pi remote control radio remote control

Wireless socket remote control

 

Raspberry Pi Radio Sockets (433MHz)

Raspberry Pi wireless socket (433MHz) house code

Due to the different codes, it is possible to remotely control almost any number of sockets.

 

Software for controlling the 433 Mhz Raspberry Pi wireless sockets

It is important that you already have wiringPi installed. If it’s not already done, here is described how it works.

Now we update all packages and install git, if it’s not already available:

sudo apt-get install git-core
sudo apt-get update
sudo apt-get upgrade

Now we get the 433Mhz library from Ninjablocks and compile:

git clone --recursive https://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils
make all

First, the code of the remote control must be read out. If you already know this, you can skip the step. Otherwise, we start

sudo ./RFSniffer

and press the corresponding buttons on the remote control. The received code is now displayed (for me it is 5510417 for on and 5510420 for off). After reading the code, you can also remove the 433Mhz receiver if it bothers you.

Now we create a new C ++ file with the following content:

sudo nano control.cpp

Afterwards, the file has to be compiled:

g++ -DRPI ../rc-switch/RCSwitch.cpp control.cpp -o control -lwiringPi

And by means of

sudo ./control 1

you can turn the socket on. Of course, you can think of other things here and for example, integrate the file via Python. Your creativity is in demand 🙂

Leave a Comment

Your email address will not be published.

Subscribe to Raspberry Pi Tutorials and don't miss any new Tutorial!