Voice controlling your home w/ Raspberry Pi

In this post we will be controlling 433 MHz light switches using a ready-to-use voice controlling software and a modified fork of a 433 MHz transmitter software, all on the Raspberry Pi. Basically I used a ready-to-use voice controlling software called Voicecommand, in which you can assign keywords and commands and assign what the software will do when heard those commands. In this case I assigned shell scripts to the voice commands – which executes the program to send 433 Mhz codes, give voice feedback to what exactly what action it performes and also send notification to XBMC – which pops up on the top of the monitor to even notify you of the action in text. To use the 433 Mhz transmitter with the Raspberry Pi I needed a 433 Mhz transmitter library or software, or else it would be too time consuming to finish this project. I found something called RCSwitch-Pi which seemed like a good program. Unfortunately I didn’t get it to work with my specific switches, so I modified the source code to make it work to my needs. I changed it so it only needs the Unit Code values to my switches. So now you don’t have to spend hours trying to understand the source code and the programming language and having to modify it yourself!

A demonstration of all explained is shown in the video below.

Hardware requirements

  • Raspberry Pi with a working internet connection
  • USB Microphone – I use a MONACOR DM-500USB
  • 433 MHz radio transmitter – I used a TX433N
  • 433Mhz switches – I used wall outlet 433 MHz receiver switches
  • 3,5mm speakers or TV connected by HDMI for sound output

Installing dependencies

First of all root login to your Raspberry Pi, and keep root-logged during the entire guide. This is important or else the software won’t work.

If you don’t have the Git client installed yet. you need to run this command. Git is used to download all the necessary software and configuration to make anything at all work.

apt-get update
apt-get install git -y


First you have to install the WiringPi library. WiringPi is used to be able to send and receive data through the GPIO pins using high-level languages like shell or python.
These commands are taken from: https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/

cd ~/
git clone git://git.drogon.net/wiringPi
cd wiringPi

Now we need to tweak the audio settings. Here is what you need to run to automatically enable the audio capabilities at boot, this way you don’t have to manually enable the audio module each time you reboot to make the audio in the software to work:

apt-get update
apt-get dist-upgrade -y
apt-get install alsa-utils mpg321 lame –y

then edit /etc/modules (nano /etc/modules) and paste this into the bottom of the file:


Now reboot  your Raspberry Pi.

When it’s booted run this to make 3,5mm the default output

sudo amixer cset numid=3 1
sudo alsactl store

or run this to make HDMI the default output

sudo amixer cset numid=3 2
sudo alsactl store

Installing the voice control software

Now lets start downloading the voice controlling software. 

This voice controlling software we are going to use is made by Steven Hickson. Instructions regarding installing his software is from his blog;

These commands will install the software and open up a configuration for the software.

cd ~/
git clone git://github.com/StevenHickson/PiAUISuite.git
cd PiAUISuite/Install/

Download my shell scripts and config which is used to make the voice controlling software talk to the 433MHz software.

cd ~/
git clone https://github.com/PrinceBalabis/RaspberryPi

now run:

sudo cp RaspberryPi/voicecontrol2/defaultcommands.conf .commands.conf

to add my settings to the voice controller config.

Customizing voice controlling settings

To edit the voice controlling software settings run:

sudo voicecommand -e

Customize it to your needs, for more information about these settings, go to http://stevenhickson.blogspot.se and read the voice controlling software posts.

To test if the USB microphone is working you can run a speech-recog software that the voice controlling software use for speech-to-text.

cd ~/PiAUISuite/VoiceCommand
pkill -9 arecord 

If it’s not repeating back what you said with text, something is wrong with your microphone settings.

Connecting the 433 MHz transmitter

Here is the datasheet for my 433 MHz RT: http://www.velleman.eu/downloads/7/tx433n_datasheet.pdf

The input pin on the 433 MHz transmitter should connect to GPIO pin 17/0 on the raspberry Pi(in my case it was pin 2)
Here is a bad picture of the connection. I’m using a breakout kit and a breadboard. Also I’m running the Pi from the GPIO pins, for a more stable overclock than running USB-power.
For the next step you are going to need get your Unit Code Values for your 433 MHz switches. These are the codes specifically set for each group and channel. We won’t go over how to get these in this tutorial, but if you don’t know them, either Google your 433 MHz switches for it’s unit codes, find it’s datasheet, or do what I did; use a 433 MHz receiver and listen and record for the unit code values when you press the buttons on the RT remote.

I wrote tutorials on how to get the unit code values, either using a Raspberry Pi, or Arduino:
Raspberry Pi tutorial: http://www.princetronics.com/?p=596
Arduino Tutorial: http://www.princetronics.com/?p=561

My switches: http://www.kjell.com/.mvc/Document/File?id=0800bd2c-4d5b-4c03-9b38-a2a800a98698

Some of the unit code values for my 433 MHz switches are:

[table caption=”433 MHz switches codes” width=”400″ align=”center”]

Now test if the 433MHz transmitter works by running the command

~/RaspberryPi/433mhz/send {UNIT CODE VALUE HERE}

Where {UNIT CODE VALUE HERE} is the unit code value of the group and channel of the switch.

Example usage to turn on my Group 4 Channel 1 switch:

~/RaspberryPi/433mhz/send 5510485

to turn it off again I run

~/RaspberryPi/433mhz/send 5510484

To make sure the voice controlling software uses your Unit Code Values. cd into ~/RaspberryPi/voicecontrol2 to find the example shell scripts(.sh) that the voice controlling software is currently using.

Just nano into the .sh-files and change the Unit Code Values to the ones your switches are using – and also they already contain code to display the top GUI notifications on XBMC – remove them if you don’t have XBMC running or don’t want it.

To customize when these shell scripts are used by the voice controlling software run this to get into its settings

sudo voicecommand -e

Now when we know the transmitter works, it’s time to see if it works with the voice controlling software.

Voice controlling usage

To start the voice controlling software run

pkill -9 arecord 

Now it keeps listens for the keyword ‘pi’. When you say ‘pi’ and it manage to pick it up, it should say ‘Yes sir?’. Thats your queue to say the voice command.

My voice commands:

[table width=”500″ align=”center”]
Hi,just says ‘hello’ back
Walls on,Turns on two switches which is connected to two of my wall paintings
Walls off,Does the thing said above except it turns them off instead
Bar on,Turns on one switch which is connected to the bar-lights
Walls on,Turns off one switch which is connected to the bar-lights
Light off,Turns off all switches
Lights on,Turns on all switches

To make the software autostart on boot run

sudo cp ~/RaspberryPi/voicecontrol2/voicecommand /etc/init.d/voicecommand
sudo chmod 755 /etc/init.d/voicecommand
sudo update-rc.d voicecommand defaults 100

To remove the autostarting feature run

sudo update-rc.d -f voicecommand remove
sudo rm /etc/init.d/voicecommand

Extra: Text To Speech usage

To use text to speech, which is something you can use in the voice controlling config you run

tts ‘{COMMAND}’ 2>/dev/null

Where {COMMAND} is the text you want to convert to speech and outputted through audio.

Here is an example of this command, where the point is to say ‘hello world’ through your audio output.

tts ‘hello world’ 2>/dev/null


If you have any questions feel free to ask me by using the Contact page or by commenting below.


A second year computer engineering student at Malmö University in Sweden just having some fun with this blog. Computer Engineering and Mobile IT: Bachelor of Science in engineering

You may also like...

18 Responses

  1. Alfred says:


    I bought the same stuff that you are using in this tutorial (switches and transmitter, from Kjell & co). Do you know if the unit codes for the switches is always the same for each set of switches? Could you please respond to me with all the values that is working for you? There would also be interesting to know how you used the receive unit to decode the remote. Thanks!

    • Prince says:


      If they’re the same model then yes the unit codes should be the same!
      Unfortunately I lost my transmitter remote when I moved, so I cannot test and send you the unit code values, but I can make a tutorial showing how to get those!

      I’ll actually make two tutorials. I originally used an Arduino and a 433 MHz receiver to read what unit values the transmitter remote sends. But you can also use a Raspberry Pi to do the same thing. Both tutorials should come up sometime today.


    • Prince says:

      I just finished making two different project tutorials on how to read 433 MHz codes from your remote transmitter. The first one is how to do it with your Raspberry Pi, and the second one is how to do this with your Arduino. Using the remote you got together with your switches you can print out the unit codes for the different groups and channels.

      Raspberry Pi tutorial:

      Arduino tutorial:

      If you have any more questions then just keep asking them coming, and if you find any more unclear instructions in any of my project posts, tell me and I can tidy em up!


  2. sears home says:

    I think this is onne of the most important information for me.And i’m glad reading your article.
    But want to remark onn some general things, The site style iss great, the articles is really
    excellent : D. Good job, cheers

  3. swapnil says:

    I am using PiAUISuite … but im taking input through a webcam mic… i have tested the mic of webcam..its working perfect but… the PiAUISuite doesnt take the input from my webcam…

  4. YangCheng says:

    I am uing PiAUISuite on my raspberryPi, now I have a problem.
    does PiAUISuite have to connect to google.com to tranfer the command that I give it from usb-micphone? you konw in china, you just can not get service from google.com,so do you have any idea about my porblem?
    thanks ~ i am looking for you help ,and sorry about my english.

  5. Good job friend.I haven’t played everyone games….But for example games like: marvel heroes, wwf wrestlemania, chopfliter, sonic, rehn and stimpy among others are epic games that aren’t in your video, is only a suggestion because i like a lot your video..greetings from colombia.

  6. Artificial intelligence creates content for the site, no worse than a copywriter, you can also use it to write articles. 100% uniqueness :). Click Here:👉 https://stanford.io/3FXszd0

  7. engaree says:

    USA, Press Release, Teva Pharmaceuticals Issues Statement in Response to Federal Trade Commission Claims on Patent Settlements June 24, 2009 cialis online no prescription Mice were injected 3 to 4 weeks after birth, at least 28 days of rest post injection were allowed before mice were used for experiments

  8. MichaelElown says:

    Wow thanks representing this record! From time to time is a remarkably obscure period all over the clique because pandemic Covid-19 become our life. active cbd gummies This greatly non-natural mental health. In the seventh heaven gone by the board a discrimination of security and confidence in the future. After all it is a regretful perception when with your thoughts you hurt yourself both mentally and physically.

  9. Artificial intelligence creates content for the site, no worse than a copywriter, you can also use it to write articles. 100% uniqueness,7-day free trial of Pro Plan, No credit card required:). Click Here:👉 https://stanford.io/3V6fSRi

  10. hi!,I like your writing so much! share we communicate more about your post on AOL? I need an expert on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  11. Paul Brown says:

    I can’t blame you guys for what you voted for… but this list also shows the unfortunate situation that you guys were deprived of two SNES classics that deserve to be in the top 5-10. Metal Combat: Battle Clash II. THIS WAS MADE BY NINTENDO. It was an amazing sequel that did things you would never expect from a Nintendo game. Unfortunately, because it was a Super Scope game a lot of people didn’t pick it up. But it is one of those rare games that still holds up today, even without nostalgia. It was also one of Nintendo’s first forays into making a game that was story-driven: even battle opened and closed with dialogue that moved the story forward, as well as plot twists and alternate endings (depending on your skill). Terranigma: This was an action RPG that Japan oddly enough released in Europe, but not here in the west. It was very atmospheric, and really became heady and interesting after the first few dungeons when a major plot twist revealed that you were essentially the only human left alive on Earth. You then travel the world seeking to revive the continents and restoring the world. I highly suggest emulating both games as you are not likely to be able to obtain your own copies. Or a superscope.

  12. Hey! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My site looks weird when viewing from my iphone. I’m trying to find a theme or plugin that might be able to correct this problem. If you have any suggestions, please share. Thanks!

  1. 05/13/2014

    […] Voice controlling your home w/ Raspberry Pi | PrinceTronics […]

  2. 01/31/2015

    […] Voice Controlling Your Home […]

  3. 04/29/2015

Leave a Reply

Your email address will not be published. Required fields are marked *