loading
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
Cost

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>I am currently working on this for a school project. I'm wondering, since the raspberry pi doesn't have built in speakers, did you have to add some?</p>
<p>Correct. The Raspberry Pi has two ways to output audio - HDMI (if you connect it to an HDMI monitor or TV with built-in speakers) and the 3.5mm &quot;headphone&quot; jack where you can plug in external speakers.</p>
<p>Your project is very impressive and I would like to learn to make it too. But Raspberry Pi 1 model B that you are using is not longer in my country. If I use Raspberry Pi 2 Model B, whether the setting circuit wiring on a breadboard system you describe previously changed or not? Thank you for your explanation</p>
<p>Hi - luckily all the newer model Raspberry Pis are backwards-compatible with the original GPIO pin layout. The original model only had 24 pins; the newer ones have 40 but the first 24 are still in the same order, so nothing changes. </p>
<p>what if the wireless adapter socket not just plugged in the lights but in a fan and TV. Fan and TV can be turned on with a voice like a lamp or not? If not, what settings should be added so that it happens?</p>
<p>Any appliance (lamp, TV, fan, etc) that plugs into the wireless socket will work. I just used lights as an example.</p>
<p>Okay. Voice command software does not explain her fit or not with Raspberry Pi 2 models B. What do you think, I should buy Raspberry Pi 1 model B+ or no problem to buy Raspberry Pi 2 Model B? Your suggestions are very helpful. Thank you very much for answering all my questions :)</p>
<p>Be careful not to get the physical model of the Raspberry Pi (B+, 2, etc.) mixed up with the version of the operating system (Raspbian). Raspbian is designed to be largely backwards-compatible so the newest version will always run on older Raspberry Pis. You would have to contact the author of VoiceCommand to find out if his software is compatible with the latest version of Raspbian (forget his website but it's listed in my Instructable somewhere). If not, you could try to find a place where you can download older versions that are compatible.</p>
<p>how can I connect wireless microphone with Raspberry pi ?.</p>
If it's a USB microphone you use it like any other USB device and just plug it into one of the Pi's USB ports.
<p>this is the relay ive been talking about. ive seen projects on raspberry pi using this relay module.</p>
<p>I'm not familiar with that module personally, but if you've seen other Raspberry Pi projects using it, then I don't see why it wouldn't work.</p>
<p>this the relay module ive been talking about. ive seen projects using raspberry pi and this relay module.</p>
<p>can i use a relay module instead of the relays and mosfet you use?</p>
<p>Not sure what a relay module is - is it a package with multiple relays in it? If so that should work. Not sure if you will still need the mosfets; the RPi's GPIO pins can't supply much current so it depends if they can drive the relay coils directly.</p>
<p>can i ask what os you are using in your raspberry pi?</p>
<p>Raspbian. I wrote this a couple years ago but it should still work on newer versions of Raspbian.</p>
<p>sir i only have 4 relays, 4 mosfet and a 4 channel wireless outlet remote. my question is how many of the outlet will work if i only have this material?</p>
<p>It depends on what type of remote you have. Does the remote have two buttons per channel (separate on and off), like the one I used? Or does it have a single button per channel to toggle on/off? You need one relay per button, so if there are 2 buttons per channel you will only be able to do 2 channels, but if there is only 1 button per channel, then you can do all 4.</p>
<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>

About This Instructable

116,932views

822favorites

License:

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:Raspberry Pi Controlled Irrigation SystemJam Jar Wedding FavorsDeer-Proof Raised Garden Beds
Add instructable to: