2. 433Mhz

2.1. Introduction

In the Netherlands, and perhaps beyond out borders too, there is a simple system for remote switching of lights, called Klik aan Klik uit (KAKU). Although not the cheapest option available, it is quite affordable, especially if you use the APA3-1500R Starterset.

Although a complete Internet solution is available using "The Cloud", I decided that one of my Pi's would be just as good.

There are a number of steps to be taken to get a working solution. I have tied to keep it as simple as possible. This means that I have not always chosen the cheapest solution.

2.2. Step 1: Transmitter hardware

The KAKU works at 433MHz. That means we need a 433MHz transmitter. These things are cheap and it does not really matter which one you choose. I took this one. I use female-female jumper wires to connect the transmitter to the Pi.

IMG_4137.JPG>

Pin
Color
Function
Comment
1
black
Ground
2
blue
Data
3
red
Vcc
5V; maximum is 12V
4
yellow
Antenna
marked ANT; should be 16.7 cm

These are connected to the Pi as follows:

IMG_4134.png>

In practice, this means that GPIO14 is used:

pipin.png>

2.3. Step 2: Transmitter software

To test the set-up, we need some software to send control signals. In general, all source software is under ~/src in my set-up. You might want to follow that. So, mkdir ~/src if that directory does not exist. Also, you need GIT, so sudo apt-get install git if you haven't done that earlier.

The software set-up comes in two parts:
  • the libraries to send the signals
  • a front-end to do the switching

First, install the libraries:
cd ~/src
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

The ./build will also install the libraries.

Next, a simple CLI front-end:
cd ~/src
git clone https://github.com/chaanstra/raspKaku
cd raspKaku
g++ -o kaku kaku.cpp -I/usr/local/include -L/usr/local/lib -lwiringPi

Get a simple wall-plug from KAKU, plug it in ans do sudo ./kaku 1 A on within two seconds. And Lo and Behold: It switches! You can switch it off again with sudo ./kaku 1 A off

If you are experimenting with the kaku command you will notice that it folds address space. This is because the original Klik Aan Klik Uit protocol was rather limited in number of devices. In the directory, there is also a newkaku.cpp which implements the new KAKU protocol. Apparentlythe new protocol allows 26 bits addresses, which is sufficient for most (anything up to 67108863).

2.4. Receiver


IMG_4456.JPG>

Before you start connecting, some soldering must be done. The GPIO pins on the Pi will accept 3.3V, but not the 5V that comes out of the receiver. Depending on the source you use, the GPIO-pins will use 0 and 1 when:
logical value
minimum
maximum
0
0V
0.54V
1
2.3V
3.3V

A voltage divider with resistors will do the trick:

recres.jpg>

The output of the voltage divider is connected to gpio15.