2. 433MHz

2.1. Introduction

In the Netherlands, and perhaps beyond our 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.

5V; maximum is 12V
marked ANT; should be 16.7 cm

These are connected to the Pi as follows:


In practice, this means that GPIO14 is used:


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. In buster, this should be part of the distribution, but it doesn't hurt to make sure it is installed.

sudo apt-get install wiringpi

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 ./newkaku 1 A on within two seconds. And Lo and Behold: It switches! You can switch it off again with sudo ./newkaku 1 A off

Install newkaku in /usr/local/bin and make it set-uid:

sudo cp newkaku /usr/local/bin
sudo chmod u+s /usr/local/bin/newkaku

2.4. A website to switch

CLI is for real geeks; if you want to show your familiy and friends that it works, you will need a simple website.

2.4.1. Install a webserver

First that means that you should install a web server. My choice is Apache. I also dislike installing by hand. I therefore use an Ansible playbook.


- name: install apache
  become: yes
      - apache2

- name: enabled mod_rewrite
  apache2_module: name=rewrite state=present
  become: yes
    - restart apache2

- name: enable cgi
  become: yes
      state: present
      name: cgid
    - restart apache2

- name: copy default site
  become: yes
      src: 000-default.conf
      dest: /etc/apache2/sites-available
    - restart apache2


- name: restart apache2
  become: yes
  service: name=apache2 state=restarted


LoadModule cgid_module modules/mod_cgid.so

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ScriptAlias "/cgi-bin/" "/var/www/cgi-bin/"

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

If you are not using Ansible, use the 000-default.conf and put it in sites_enabled

2.4.2. The website

I made a directory /var/www/data/kaku where all the data for my CGI script is stored. In that directory, there are two files:

  • data
  • codes

In the codes file, the codes for switching are placed:

101;switch 1;11110001
102;switch 2;11110002
103;switch 3;11110003
104;switch 4;11110004

The data file is used for a simple timer interface to the cronjob.

The scripts are in CGI script and cronjob (a workable version) or at https://github.com/ljmdullaart/kakuweb (the most recent version).

2.5. note

Raspberry Pi is a trademark of the Raspberry Pi Foundation.