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>Nice one. Why not use 433Mhz transmitters and receivers? You can get 433Mhz power outlets too, they cost approximately the same. Then get some 433 Mhz transmitters from ebay, which are very cheap and connect them with GPIO ports? This way you can save a lot of headache, or am I seeing it wrong? </p>
<p>In short...because I had never built anything with transmitters/receivers from scratch, and didn't know how. I like taking stuff apart, and that also allowed me to enter the Hardware Hacking contest at the time.</p>
<p>hi,</p><p>i have made this project for my college exhibition, now i am facing a problem that my raspberry pi is giving very very late reply and even turning on the things very late. can you help me with the &quot; duration , threshold , &quot; configuration stuff.</p><p>============================================================</p><p>#This is the default config file</p><p>#These are the special options you can set (remove the #)</p><p>!verify==1</p><p>!keyword==raspberry</p><p>!thresh==2</p><p>!continuous==1</p><p>!response==yes boss</p><p>!quiet==0</p><p>!ignore==1</p><p>!filler==0</p><p>!duration==2</p><p>!com_dur==2</p><p>!improper==access denied</p><p>#!hardware==plughw:1,0</p><p>#Here are the commands</p><p>===========================================================</p><p>this is my setup . i am using the logitech camera same as yours . please please help</p><p>REGARDS </p><p>PYT</p>
<p>Hi - to be honest it has been quite a while since I did this project, and I was just using software written by someone else - Voice Command by Steven Hickson. The full documentation for his software is on his site:</p><p><a href="http://stevenhickson.blogspot.com/2013/06/voice-command-v30-for-raspberry-pi.html" rel="nofollow">http://stevenhickson.blogspot.com/2013/06/voice-co...</a></p><p>If I remember correctly, those parameters (threshold, duration) have to do with the Pi LISTENING for the keyword (threshold is the loudness of the sound, duration is how many seconds it will listen). The problem with the delay is that the Pi is not actually processing the voice commands locally, it is connecting to a Google voice-to-text service. So, if you have a slow internet connection, or Google is particularly busy at the moment, there isn't much you can do. You can definitely see that there is a bit of a lag in my video. If any of the delays ARE actually due to slow processing on the Raspberry Pi, then it might be faster with a new Raspberry Pi 2 instead of an older model, but I'm really not sure.</p>
<p>well thanks a lot ben.</p><p>you said was actually right . it was the internet speed problem which i was facing. but really thanku </p><p>regards</p><p>pyt</p>
<p>would this be strong enough for a power strip?</p>
<p>It should be fine. The wireless outlets are designed to control anything you would normally plug into an outlet. None of the high-voltage AC is actually going through the Raspberry Pi circuit itself. If you are plugging a TON of stuff into a power strip and you are really concerned about the rating of the wireless adapters, you'd have to look up the specs (I don't see them on the product page):</p><p><a href="http://www.amazon.com/dp/B003ZTWYXY/ref=TE_M3T1_ST1_dp_2#productDetails" rel="nofollow">http://www.amazon.com/dp/B003ZTWYXY/ref=TE_M3T1_ST...</a></p><p>But I'm guessing at that point you'd trip the power strip instead.</p>
<p>are your first 2 jumper wire not m/f?</p>
<p>If you're referring to the red and black ones at the very top - correct, those are m/m wires used to connect the power and ground buses on opposite sides of the breadboard. The m/f wires are connected to the GPIO pins on the Pi.</p>
<p>I created something similar and wrote a detailed blog post. Check it out:<a href="http://timleland.com/wireless-power-outlets/" rel="nofollow">http://timleland.com/wireless-power-outlets/</a></p>
<p>Your project is awsome!!</p><p>I have a question this project works without computer?</p><p>thaks</p>
<p>I'm not quite sure what you're asking. The Raspberry Pi is a type of tiny computer, and this project requires a Raspberry Pi. You do not need a &quot;regular&quot; computer (PC or Mac) to do the project though. Is that what you meant?</p>
In first place, I would like to congratulate you for such an excellent instructable!! :)<br><br>I'm thinking to make a wired version of this instead of using remote. So I am thinking to use external relays connected to AC power and lights. Then control the external relays by the existing relays. Would that work?<br><br>Also please let me know which mic can I use as a substitute to your webcam. I need to design the project in less cost. <br><br>Note: I'm a beginner. I have not used Raspberry pi till now. This would be my first project.
<p>Thanks! To answer your questions - there are products that make it very easy to control an outlet with a hardwired connection to a microcontroller, no relays required, like this:</p><p><a href="https://www.sparkfun.com/products/10747" rel="nofollow">https://www.sparkfun.com/products/10747</a></p><p>The problem with that one is that it's very expensive - $30 (USD) to control just one outlet. I'm sure SparkFun's shipping to India isn't cheap either, so I'd recommend looking for something similar from an Indian supplier (I'm not really familiar with electronics vendors over there). </p><p>The good thing about it is that it safely contains the high voltage wiring so you do not have to touch it at all, beyond just plugging in an appliance like you would normally. You just handle the logic-level wiring to your microcontroller like you would with any other Arduino or Raspberry Pi project, which is perfectly safe. If you are a beginner, you should <strong>NOT</strong> wire relays up to high-voltage AC yourself. It is dangerous and can kill you or burn your house down if you do not know what you are doing.</p>
By saying I'm new to this means I'm new to programming controllers. I'm a Telecom Engineer. I have knowledge about electrical and electronic circuits. :)<br><br>Very thanks for the reply. :)<br><br>Glad to see your enthusiasm!!
<p>Ah, OK. Sometimes complete beginners think they can dive right into high-voltage wiring and of course that is not safe.</p><p>I forgot to mention - <em>most</em> USB webcams or mics should be compatible with the Raspberry Pi. My webcam was just plug-and-play, I didn't have to install any drivers. If you are going to buy something, I would just do a quick Google search first to see if you can find anything about compatibility with the Raspberry Pi, or if you need to install certain Linux drivers to get it to work.</p><p>Good luck!</p>
<p>I am having trouble I have build everything and also edited the file with the code. But when I am putting the command of gpio write 0 1 it says not found and I have checked all my wires 5 times. Please help</p>
<p>Can you type the EXACT error message that you get? The GPIO pins can be set high or low even if there is nothing attached to them, so I doubt this is a wiring issue, it is probably a software issue. I wrote this Instructable 8 months ago so I cannot promise that nothing has changed with either the WiringPi or VoiceCommand software, that might make this out of date.</p>
I have set all the wires exact showen in the guide image and when I type in the terminal gpio write 0 1 <br>I get the message command not found and I dont here the click sound of relay
<p>First you need to type</p><p><strong>gpio mode 0 out</strong></p><p>as described in Step 8, to initialize the GPIO pin. <em>Then</em> you type</p><p><strong>gpio write 0 1</strong></p><p>Did you do that? </p>
I did typed gpio mode 0 out and it is showing me this<br>-bash: gpio command not found
I even tried typing sudo gpio mode 0 out but no luck give me the same error of command not found
<p>Did you install WiringPi as described in Step 5? If you are getting &quot;command not found&quot;, my only guess is that WiringPi is not properly installed.</p>
I reinstalled wiringPi the code is working now but I dont here realay clicking sound. I have seen in the instructions image its all same but I have noticed that, the pic you have put with the diagram has different wiring. I can follow the pic but I am un sure which wire is going in which spot which is hidden behind the relay so can u put the other side pic too so I can see the pic and follow it.
<p>Unfortunately I actually disassembled this project a while ago so can't take new pictures. If you tell me exactly which wires you think are wrong in the diagrams (refer to the color, give breadboard row/column info, be as specific as possible) I can check to see if I made an error.</p>
I have set all the wires according to the digram but its not working.
<p>Hmm. As far as I can tell from the photos your wiring looks right. This is difficult to help solve over the internet, but next I would try troubleshooting individual things to try isolating the problem:</p><p>1. Make sure your Raspberry Pi's GPIO pins work. If you have LEDs, you can just use your code to drive LEDs instead of the same circuit. If you have a multimeter, you can measure the output voltage of each pin.</p><p>2. Make sure the relays work by applying 5V directly across the coil from the power and ground buses, instead of using the Pi's GPIO pins and the MOSFET. For example, for the first relay - remove the MOSFET, then use a jumper wire to connect hole J7 to the ground bus. This should apply 5V directly across the coil (since hole A7 is connected to +5V) and you should hear a click. </p><p>3. For the MOSFETs - did you order the exact part I recommended from SparkFun, or something else?</p>
I ordered exact parts and same model of remote to make this.
<p>Ok. Please try the first two troubleshooting steps I listed then.</p>
I tested it and found out my all relays are not working.
<p>If you're 100% sure you connected everything correctly and the relays are not working, I'd contact the supplier (SparkFun?) for a refund and see if you can get new parts. But, I would double and triple check that you are properly applying 5V across the relay coil (the two pins that are directly across from each other, not the three pins that sort of form a triangle - look at the relay's <a href="https://www.sparkfun.com/datasheets/Components/General/JZC-11F-05VDC-1Z%20EN.pdf" rel="nofollow">datasheet</a> if that helps) before you tell them that they're broken.</p>
in digram the remote ground is down near sixth relay but in real pic it is near the first relay.
<p>Ah, OK - that shouldn't matter because the ground buses run the entire length of the breadboard (the &quot;buses&quot; are the two long strips on each side, one with a red line and one with a black line, for power and ground respectively). You <em>should</em> be able to plug a wire anywhere into the bus and it won't make a difference. <em>However</em>, I found out recently that some of these breadboards have the buses broken into halves, somewhere around row 30. This could be the case with your breadboard. If you have extra jumper wires, try using them to connect the &quot;top half&quot; of your breadboard's ground bus (somewhere in rows 1-30) to the &quot;bottom half&quot; (rows 31-60), and see if that solves your problem.</p><p>Also, if you have a multimeter with a &quot;continuity test&quot; mode, you could use that to confirm whether the entire ground bus is connected, or if it is broken in half.</p>
rp gpio pins
you were right that bus was split in every 30 places and I have connected them but still no luck to make it work. I have tested there is power in breadboard. I have attached some pic of my work in different angles so u can see the wiring.
<p>hi i want to know dose raspberry pi listens to you every time without going to sleep ? </p>
<p>The Raspberry Pi does stay on continuously. You have to say the keyword first (&quot;Pi&quot; in my video) for it to process a voice command, but it does not go to sleep in between commands.</p>
<p>thanks and where can i change the word pi because i dont want to use pi word for it to listening i want to use different word like computer etc.</p>
<p>In the configuration file there should be a line something like</p><p><em>!keyword==pi</em></p><p>change &quot;pi&quot; to whatever you want to use a different keyword.</p><p>See Steven Hickson's website for the full documentation:</p><p>http://stevenhickson.blogspot.com/2013/06/voice-command-v30-for-raspberry-pi.html</p>
<p>Thanks you were really helpful...</p>
<p>Thanks you were really helpful...</p>
<p><a href="http://codesforprogram.blogspot.in/" rel="nofollow">http://codesforprogram.blogspot.in/</a></p><p>more arduino posts</p>
From the video, you said &quot;turn lamp on&quot; and voicecommand repeated &quot;turn lamp on&quot;. <br><br>Is there such option in voicecommand to set to do that? Thanks.
<p>What I said in my other comment. Change the response text in the config file:</p><p>light one on==tts &quot;<strong>Yes, sir</strong>.&quot; &amp;&amp; gpio write 0 1 &amp;&amp; sleep 1 &amp;&amp; gpio write 0 0</p><p>to whatever you want, like</p><p>light one on==tts &quot;<strong>Turning lamp on</strong>.&quot; &amp;&amp; gpio write 0 1 &amp;&amp; sleep 1 &amp;&amp; gpio write 0 0</p><p>It is hard-coded, VoiceCommand is not automatically repeating what I say. Notice that I say &quot;turn&quot; and VoiceCommand says &quot;turning&quot;.</p>
From the video, you said &quot;turn lamp on&quot; and voicecommand repeated &quot;turn lamp on&quot;. <br><br>Is there such option in voicecommand to set to do that? Thanks.
<p>Hi, nice project. How you configured the VoiceCommand to repeat your command that you have spoken?</p>
<p>Oops - I might have misunderstood your question. Do you mean &quot;repeat the command out loud&quot; or &quot;execute the command more than once&quot;?</p>
<p>In the config file (Step 7), change the text in quotes:</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>I have it set to &quot;Yes, sir.&quot; but you can change it to whatever you want.</p>
<p>Hi, nice project. How you configured the VoiceCommand to repeat your command that you have spoken?</p>

About This Instructable


783 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: