Update 2/11/2014: Thanks to everyone who voted for this project in the Raspberry Pi contest!

This project is a combination of several difference resources:

The end result is voice-activated control of up to three electrical outlets using the Raspberry Pi. Here's a video of the final product in action (read on for a detailed parts list, circuit diagram, and code):

A couple notes before you begin. This project is up-to-date as of December 2013, but Gordon and Steve may update their respective software in the future. If you notice any major changes to WiringPi or Voice Command that make my instructions obsolete, please leave a comment or send me a message. Also, while my previous Instructable was written to be super beginner friendly, this one is a little more advanced so it skips over a lot of the introductory material. I refer back to the single-channel version several times, instead of duplicating the content here.

Here is a list of the parts I used. Of course, if you know what you're doing you can make substitutes as needed, or shop around for cheaper suppliers. Quantities in parenthesis.

Materials & Tools

The cost of this project depends heavily on what you already have lying around. If you already have a Raspberry Pi, webcam/mic and basic electronics equipment (tools, breadboard, jumper wire etc) it will only be about $40 for the wireless remote, relays and MOSFETs, and the cost goes up from there.

*My Quickcam Pro is 5 years old and I'm not sure if this exact model has been discontinued, or if it is the same thing as the "Webcam Pro 9000", which pops up on Amazon. You may need to do some poking around online to find out if your webcam is compatible with the Raspberry Pi (keep in mind that you only need the mic, and don't care about video). This wiki has an extensive list of verified peripherals.

Step 1: Open the Remote and Remove the Circuit Board

The first thing you'll need to do is open the plastic case of the remote to expose the circuit board.

1. Remove the battery cover and take the battery out for now.
2. Use a small Phillips head screwdriver to remove the single screw holding the front and back halves of the plastic case together.
3. Use needle nose pliers to bend off the keychain ring.

This exposes the underside of the circuit board, which you can remove from the case entirely to get a look at the top half. However, I find it easier to work with the circuit board attached to the front half of the case. This way, you can easily push the buttons when you're testing the circuit (next step). The battery also tends to stay in better when it's in the case. There was an unoccupied hole in the case that lined up with a hole in the circuit board - I used the small screw to attach the circuit board to the front half of the case (see the last two pictures above).
<p>And ben me am in china and here in china google it has been blocked i can't use google until i use VPN to access google so my question is will it affect any thing in this project if i can't access google Ex; google speech and sorry for to many question because i really like this project that why am try doing my best to succeed and thanks again for your other reply</p>
<p>hi, i will be using a double channel wireless remote instead of using the one used on this project. how many relays and mosfet do i need to use?</p>
<p>Hi - you need one relay and mosfet per button on the remote.</p>
<p>hi, i will be using a double channel wireless remote instead of using the one used on this project. how many relays and mosfet do i need to use?</p>
<p>hi, i will be using a double channel wireless remote instead of using the one used on this project. how many relays and mosfet do i need to use?</p>
<p>Hi isaac,</p><p>Ah, sorry about that. I figured you weren't in the US but didn't realize you'd have to deal with China firewall issues. To be clear, I am NOT saying that you need to stop asking me questions about the Instructable or Raspberry Pi in general. I just can't really help with specific questions about Voice Command because I really don't know that much about it.</p><p>Unfortunately I have no idea how access to various Google services works in China. VoiceCommand does work by connecting to a google speech-to-text service, so if that is blocked, then the project would not work. </p><p>There might be some alternatives though. Check out &quot;Jasper&quot;, which is another program designed to do voice commands on the Raspberry Pi:</p><p><a href="http://jasperproject.github.io/">http://jasperproject.github.io/</a></p><p>On their &quot;Configuration&quot; page they have a section on &quot;Choosing an STT (Speech to Text) Engine&quot;:</p><p><a href="http://jasperproject.github.io/documentation/configuration/">http://jasperproject.github.io/documentation/confi...</a></p><p>that list several alternatives to the Google tool, some of which do not require internet connections at all.</p><p>I have never used Jasper so would not be able to help you with setup, you would need to follow the documentation on their page.</p>
Thank you so much ben i will try to use jasper program because it the first time i will be using
<p>first time i wrote this command- speaker-test to here the song if it's coming but it didn't come so i type this command sudo apt-get install alas-utils mpg321 lame to install i think it's sound driver because i follow the guy from youtube then it was saying error so i should type the command sudo apt-get update then i did the update and upgrade for the system then i try again then it work the i type the command speaker-test then the sound came in the speaker so i manage to get the sound but in the part of you hear anything (y/n)? at the first time before i got a sound i put n then it was saying i may have problem something like alsamixer so i went through youtube then i manage to get a sound but but if i put y it tell me it to hear the voice but no voice is coming but in a steven video i heard he was saying about something like pause audio he say if i didn't configure the pause audio i can not here the word fill so that the part i didn't understand what kind of the pause audio he was talking about and i think that the problem that why am not getting the voice in voicecommand -s</p><p>And another thing in voicecommand -e when i have already set the command then when i press ctrl x to Exit and y to save it give me the text were i should save the file then when i press enter to accept it tell me this message Error writing /home/pi /.commands.conf: No space left on device. so what should i do in problem like this</p>
<p>Isaac -</p><p>- I'm afraid I can't help you much on the first paragraph. At this point you are following other people's tutorials, and I didn't write those so I really can't help you with them. I am not a Raspberry Pi or Linux expert and don't have any experience with the alsamixer or speaker-test commands. I'm sorry that I can't be of more help.</p><p>- For the second paragraph, what size SD card are you using? If it is only 4GB, you may be running out of space on the SD card. If it is 8GB or more, then you can type sudo raspi-config in a terminal and select and select &quot;Expand filesystem&quot;. That will expand the image to fill up the whole SD card (initially when you flash the card it is only a 4GB image).</p>
<p>ben if it shows like this what is a problem because i speak the command pi but it not taking command and no respond</p>
<p>isaac - I'm sorry but I'm really not sure how else to explain this. I did not write the VoiceCommand software and am not really able to help you troubleshoot it. It was written by a guy named Steven Hickson. His website is here and you may be able to reach him through that:</p><p>http://stevenhickson.blogspot.com/</p>
<p>Hi isaac - you had a couple questions but I'll answer them all in one place:</p><p>- The Raspberry Pi does not have a hard drive like a regular computer. <em>All</em> of the files, including the operating system itself, are stored on the SD card. So, if you re-flash the SD card, that will overwrite all of your previous files. It sounds like you already did this, but in the future you can back up files in advance (for example, if you have a Python script you want to keep, you can email it to yourself, then re-download it after you reflash the SD card).</p><p>- I noticed in your screenshot that the VoiceCommand setup asked &quot;Did <br>you hear anything (y/n)?&quot; and you typed &quot;y&quot;, but you said in your <br>comment you didn't hear anything. &quot;y&quot; stands for &quot;yes&quot; and &quot;n&quot; stands <br>for &quot;no&quot;, so if you did not hear anything you should type &quot;n&quot; and maybe <br>VoiceCommand will adjust the sound automatically. You might want to try <br>that before you try the next point.</p><p>- Sound: the Raspberry Pi has two options to output audio, HDMI and the 3.5mm jack. Are you using an HDMI TV/monitor with built-in speakers, or do you have a separate speaker plugged into the 3.5mm jack? Sometimes the Pi will not properly recognize the right audio source and you have to set it manually. To do this, open a terminal and type <strong>sudo raspi-config</strong> then hit enter. Use the arrows to scroll down to Advanced Options and hit enter. Then select Audio and hit enter. Then you can select whether to force audio over HDMI or the 3.5mm jack. It may ask you to reboot after picking one.</p><p>- As for not getting a response, if sound is not working or VoiceCommand did not complete installation then you will not hear a response, so you should try to fix the previous problem first. Just to check though, do you have a USB microphone plugged in to your Pi?</p>
<p>And even when i say command pi am not getting response </p>
<p>thanks ben i download the image file and re-flash the SD card in put it in raspberry pi now the voicecommand -e it's working now but am getting this problem of not getting sound in opening configure file when it reach in that part of &quot;First I'm going to say something and see if you hear it &quot; but i can't hear any voice in my speaker i don't know what's the problem</p>
<p>i try again to use manually way now it say this</p>
<p>Isaac - do you know which version of the Raspberry Pi you have? Is it a model B+ or a Raspberry Pi 2? I checked Steve Hickson's blog and it looks like he has a more recent post with an SD card image that includes Voice Command pre-installed:</p><p><a href="http://stevenhickson.blogspot.com/2014/08/voicecommand-image-file-and-controlling.html">http://stevenhickson.blogspot.com/2014/08/voicecom...</a></p><p>That post is from August 2014 and says it's compatible with the B+. If you have a model B+, then I would suggest that you re-flash your SD card with the image provided on that page, and that might solve the problem. If you are running a Raspberry Pi 2, which has a newer operating system, I am not sure if it would work. You would have to contact Steve Hickson to ask.</p>
And another thing after i re-flash the SD card and put another image file in the SD card will the first image file i install in raspberry pi still remain in raspberry pi or when i re-flash the SD card it will also be formatted
Ok sorry ben it's just my computer it's stuck at the time i was posting comment then when it's start working it appear i have send many same post and The raspberry pi am using it's B+ same as the one you use so i will go to the link you send to me and download the image file and try it again
<p>Also it looks like you are posting duplicates of many of your comments - I think that could be a bug with Instructables' site, but try not to hit the submit button more than once.</p>
<p>hi ben i have a problem i try to type the voicecommand -e but it tell me file directory cannot found then i try install the PiAUISuite and i try again it say like this</p>
<p>Hi - unfortunately I don't think I'll be able to help you here. I haven't seen that error before but it looks like something might have gone wrong with the VoiceCommand installation. Since I wrote this a couple years ago, I'm really not sure if VoiceCommand works with the latest Raspberry Pi software or if there are problems. I think you can try to contact the author via his blog, he may be able to help if you show him that screenshot.</p>
Which blog should i use to contact with authour
<p>hi ben i have a problem i try to type the voicecommand -e but it tell me file directory cannot found then i try install the PiAUISuite and i try again it say like this</p>
<p>hi ben i have a problem i try to type the voicecommand -e but it tell me file directory cannot found then i try install the PiAUISuite and i try again it say like this</p>
<p>hi ben i have a problem i try to type the voicecommand -e but it tell me file directory cannot found then i try install the PiAUISuite and i try again it say like this</p>
<p>https://www.youtube.com/watch?v=EM5gnNg7JTI This is a link that shows the guy use sudo python command to configure the gpio so is it ok if i use the command or i must use the terminal command as you explain</p>
<p>hi ben i have a problem i try to type the voicecommand -e but it tell me file directory cannot found then i try install the PiAUISuite and i try again it say like this </p>
<p>There are multiple options for controlling the GPIO pins on the Raspberry Pi. You can use Python if you want but you will need to modify the VoiceCommand config file appropriately. Step 7 in my instructions assumes you are using WiringPi (installation described in Step 5). For example in this line:</p><p>light one on==tts &quot;Yes, sir.&quot; &amp;&amp; gpio write 0 1 &amp;&amp; sleep 1 &amp;&amp; gpio write 0 0</p><p>&quot;gpio write 0 1&quot; is a WiringPi command, not Python. So, if you want to use Python instead you would need to replace all those commands with the appropriate Python commands, and you would not need to install WiringPi.</p>
Okay thank you very much i appreciate your work
<p>And is it ok if i use command, sudo python to configure GPIO or i must use the LX terminal to configure</p>
<p>I don't understand your question. Can you tell me which step you are referring to?</p>
<p>Hi if i want to add another light so they can be 3 is it possible?</p>
<p>okay thanks for you reply</p>
<p>Hi - not quite sure what you're asking. The remote in my project can control up to three outlets, I just happened to only film two in the video. If you buy a different remote you can control more outlets, for example here is one that controls 5:</p><p><a href="http://www.amazon.com/Etekcity-Wireless-Electrical-Household-Appliances/dp/B00DQELHBS/">http://www.amazon.com/Etekcity-Wireless-Electrical...</a></p>
<p>thank you for you help. the mosfet has a minimum gate-source voltage threshold of 2v and maximum of 4v. is this okay?</p>
<p>I <em>think</em> so but honestly I'm not completely sure. I don't quite understand how to interpret those &quot;min&quot; and &quot;max&quot; values since it's such a big range. When working with 3.3V logic I have traditionally used something like <a href="https://www.jameco.com/Jameco/Products/ProdDS/2001373.pdf">this</a> which has a Vgs in the 1-2.5V range, so you know 3.3V above that. WIth the IRF740, if Vgs is somehow all the way up at 4V, then it might not work or turn fully on. I'm not an electrical engineer so you might be better off asking that question somewhere where you can get a better answer (the tech forums here, stackexchange, or maybe the official Raspberry Pi forums).</p>
<p>can i use a different mosfet for this project? like this one Power MOSFET IRF740, SiHF740</p>
<p>Hi - look at the data sheet and find the threshold voltage for the MOSFET. As long as it's below 3.3V (the voltage of the Pi's GPIO pins) you should be fine.</p>
<p>And after finish to test and plugging everything when your using the device as you shown in a video do i still need to use the monitor to see when i use it or i can disconnect the monitor and use only voice command to operate it?</p>
<p>I believe you should be able to disconnect the monitor once everything is running, however I have not tried this myself. Should you ever need to make changes but don't want to reconnect a monitor, there is a method called ssh you can use to do this:</p><p>https://www.raspberrypi.org/documentation/remote-access/ssh/</p>
Thank you ben for your help
<p>No problem, good luck!</p>
<p>thank you very much for your replying and i haven't understand the step 8 of testing it. my question is how to configure those GPIO commands mode can you help me to explain how to configure GPIO</p>
<p>Hi - you need to open a &quot;terminal&quot; on the Raspberry Pi to type in those commands. If you followed the instructions in step 5 and 6, then you have already used a terminal. On older versions of the Raspberry Pi operating system I believe there was a desktop icon labeled &quot;LXTerminal&quot;. On newer versions I believe you can find this option under the &quot;Menu&quot; on the desktop.</p>
<p>https://www.dipmicro.com/store/HLS8L-DC5V-S-C this is a link for the relay</p>
<p>Hi - yes that relay will work, but please be aware that the arrangement of the pins is different. So, you will not be able to follow my breadboard diagrams directly. You will have to look at the pinout on the data sheet to figure out how to connect them:</p><p>http://www.dipmicro.com/?datasheet=HLS8L.pdf</p>
<p>i haven't buy yet because i didnt get the specific relay the one you use in this project so i was asking which kind of another relay i can use that can work same as the one you use </p>
<p>Hi - it's a &quot;5 volt SPDT&quot; relay. SPDT stands for &quot;single pole double throw.&quot; You can read more about the relay from the data sheet:</p><p><a href="https://www.sparkfun.com/datasheets/Components/General/JZC-11F-05VDC-1Z%20EN.pdf">https://www.sparkfun.com/datasheets/Components/Gen...</a></p><p>If you are unable to order from SparkFun and need to use another vendor, if you search for &quot;5V SPDT relay&quot;, you should be able to find something that will work. I can't give a more specific recommendation unless you tell me what vendor you plan to use to buy the parts.<br></p>
I bought this model of relay HLS8L-DC5V-S-C it's one of the SPDT relay
<p>And i haven't got the specific model JZC-11F of SPDT relay 5v so i was asking is the and simillar relay i can use of 5v </p>

About This Instructable


806 favorites


Bio: I'm a mechanical engineer/roboticist turned informal science educator. For my day job I write K-12 science and engineering projects for the STEM education ... More »
More by Ben Finio: Jam Jar Wedding Favors Deer-Proof Raised Garden Beds Fall-themed Mason Jar Wedding Centerpieces
Add instructable to: