Something for the weekend: Sound Sensor radio-controlled socket

22nd January 2016

If you’ve used our Energenie radio-controlled socket, you’ll already know there are lots of different ways you can control it. The versatility of the socket means you can find the perfect method of control to suit your needs and preferences.

You can use a Raspberry Pi, hand controller or Mi|Home gateway to control your socket, which you might think means you have plenty of options. However, you can now control the sockets with sounds that you can generate!

Not only is this a handy way of controlling the sockets you use as part of your home automation system, it is also quite fun. You can find out exactly how to achieve this type of control in our guide:

What you will need:

– A Raspberry Pi A,A+,B,B+ or 2
– Mouse, Keyboard, HDMI, monitor
– An Energenie Pi HAT
– Pimote:
– Radio controlled socket:
– Or the Pimote starter kit:
– Linker sound sensor:
– 8 male to female jumper cables
– 2 female to female jumper cables

ENER002_f linker-sound-sensor ENER314_A

Energenie Pimote:

The Energenie Pimote only require 8 pins. Pins: 1, 2, 6, 11, 13, 15, 16, 18, 22

Screenshot 2016-01-22 at 15.49.42

You will now have access to the remaining 16 pins. Users may also reassign pins. Note that the female pins on the
Pi HAT cannot be changed. The trick is to use the jumper lead connectors to connect from your desire pin to the
pin you wish to use.

How it is controlled by Software:

Screenshot 2016-01-22 at 15.55.48


The pin header connects to the add-on board as follows to allow you to control the GPIO lines as outputs to drive the radio frequency transmitter.

Screenshot 2016-01-22 at 16.24.55


Each board transmits a frame of information using On-Off-Keying (OOK) which is a basic form of Amplitude Shift Keying (ASK). This frame includes source address (20 bits) and control data (4 bits). See Appendix 1. The source address is randomly selected (so unique for that board), pre-programmed and cannot be changed. The socket will accept commands frames that have the source address that it learns during the learning process described later.

Screenshot 2016-01-22 at 16.27.56

The sound sensor will need to connect to 3 GPIO pins.

Sound Sensor – GPIO

GND – PIN 39



The sound sensor will send an analogue output to the raspberry Pi. PIN 40 will read a voltage, a voltage near 3.3 V is interpreted as a logic one while a voltage near zero volts is a logic zero. Each sound will generate a series of pulses (logic 1s and 0s). Counting the pulses will determine the volume of the sound generate.

Alternatively, using an ADC can convert the analogue signal into a digital input which the raspberry pi can use to interpret the volume of the signal then using the python script you can set a threshold. Using this approach produces a latency affect from the point the sound is detect the instant where the socket command is triggered. The approach we take in this project has an improved response time whilst sacrificing some accuracy. Change the value of the variable J. The higher the value of J the lower the sensitivity.


You will now be able to control your Energenie radio-controlled sockets via the generated sounds, allowing you to make the most of the features and benefits of the sockets in an easy way.

This means you can save money by controlling your electricity usage and ensure you know which sockets are turned on at any time.

Keep an eye out for our next weekend project!




Get in Touch

Please use the form below to get in touch