This instructable guides you through connecting a Raspberry Pi to Watson Speech to Text and change the color of a LED through speech. For example, you may say "Turn the light green" to change the color of the LED to green.

<p>I am trying to merge this project with the conversation project. My goal is to have the LED turn green if the name was recognized before passing to conversation and text to speech. This will give the user a notification that the services are working. However, when I run the conversation app as sudo, I no longer get audio through the bluetooth speaker. Since sudo is required to run the LED, this is an issue. Has anyone worked through this before and gotten the audio to work through sudo or the light to work without sudo?</p>
<p>Did you unblock the sound modules? Raspberry Pi has a known issue of PWD conflicting with audio jack. This means you cannot use the PWD pin (used for the LED) and the audio together. To solve this, we suggested on the last step to block all the sound modules https://www.instructables.com/id/Use-Your-Voice-to-Control-a-Light-With-Watson/step7/Run-the-Code/ so if you done that, you need to undo this first and then use an external sound card to get the audio. Here is the sound card we've been using https://learn.adafruit.com/usb-audio-cards-with-a-raspberry-pi/instructions</p>
<p>Hi, </p><p>Thanks for the interesting tutorial and nice recipe! </p><p>I have a Common Anode + LED instead of the one used in tutorial so I went ahead and made a quick change to the code to make it work with my LED, if someone wants to try, here is the separated branch in my fork:</p><p><a href="https://github.com/dnguyenv/tjbot/tree/common-anode/recipes/speech_to_text" rel="nofollow">https://github.com/dnguyenv/tjbot/tree/common-anod...</a></p><p>Changes:</p><p>- Removed rpi-ws281x-native library, use rpio npm lib<br>- Changed the main tss.js file to work with my LED<br>- Added my wire diagram (https://github.com/dnguyenv/tjbot/blob/common-anode/recipes/speech_to_text/tts.png)<br>- Changed README to be relevant to the change</p><p> Best - Duy</p>
<p>Hi.</p><p>When I run stt.js program it shows the message:<br>&quot;TJBot is listening, you may speak now.&quot;<br>but don't give me time to speak and close the program right after showing the message. No errors, nothing, just show the message and close the program.</p><p>I am using an USB sound card with both input and output. Both arecord and aplay commands works just fine, I am able to record and listen to the audio I've recorded. I am also able to use the voice control to control bb-8.</p><p>Any suggestions?</p><p>Thank you.</p>
<p>Hi MauricioM82,<br><br>You are correct, the issue is definitely related to the app having difficulty setting up audio. For arecord on command line, do you pass any parameters for your app to work correctly ? For example if your sound input might be listed with an unexpected hardware ID or might need several parameters to work. <br><br>To find out your hardware device ID run arecord -L ,and then specify that as a parameter when you instantiate the mic in stt.js.<br><br>In the sample apps we provide, we use the mic npm library (</p><p><a>https://www.npmjs.com/package/mic) </a> to record audio. You can provide hardware options when you instantiate your mic to record audio e.g </p><p>var micInstance = mic({ 'rate': '44100', 'channels': '2', 'debug': false, 'exitO<br><br>nSilence': 6, 'device': 'plughw:1,0' });<br><br><br>A related issue (solved) on recording from a bluetooth and usb mic can be found here </p><p><a href="https://github.com/ibmtjbot/tjbot/issues/12">https://github.com/ibmtjbot/tjbot/issues/12</a><br><br></p>
<p>Great!</p><p>Thank you for your help. So, I specified the device when instantiating the mic and it worked, it now recognizes my voice.</p><p>The problem now is that the led don't change colors (it's green, and always green).</p><p>I did the suggestions on the Troubleshooting part of the article but after reboot I see several &quot;snd&quot; modules loaded, like</p><p>snd_usb_audio 118800 3 <br>snd_hwdep 5727 1 snd_usb_audio<br>snd_usbmidi_lib 19801 1 snd_usb_audio<br>snd_rawmidi 18516 1 snd_usbmidi_lib<br>snd_seq_device 3621 1 snd_rawmidi<br>snd_pcm 75762 1 snd_usb_audio<br>snd_timer 19288 1 snd_pcm</p><p>Any suggestions?</p><p>Thank you in advance.</p>
<p>Maybe I found the answer.. I may be using a different type of led.</p><p>We have the ground pin and one of each other is for one color.</p><p>Does the led used on the article has a special name, or some way I can identify it to purchase in a store?</p><p>Thank you.</p>
<p>Great!<br>We use the RGB Neopixel LED based on the ws2812 protocol.</p><p><a href="https://www.adafruit.com/products/1734">https://www.adafruit.com/products/1734</a><br><br>Really look forward to seeing what you build! Pictures, videos ? You can share on twitter #tjbot<br><br>V.</p>
<p>I live in Brazil and it's really hard to find the adafruit version or anything similar around here. And shipping from adafruit site to Brazil is way way way to expensive.</p><p>Maybe someone could ship a kit from the site to me via regular mail? :D</p><p>Thank you for all your help.</p>
<p>We used a NeoPixel LED. Here is a link to the specs: https://www.adafruit.com/products/1734</p>
<p>Can anyone suggest a cheap usb microphone I could buy because my budget isn't big enough for a $70 one</p>
<p>Hi Jamie, I've been using https://www.amazon.com/gp/product/B00IR8R7WQ/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1 and it works well for the price.</p>
<p>can i use raspberry 2 instead of raspberry3</p>
<p>It should work on Raspberry 2. I haven't tested it, but <a href="/member/victordibia">victordibia</a> confirmed he was able to run it on Pi2.</p>
<p>hi, yes right i have a talking robot with Watson Conversation. i fixed the credentials, but still my loudspeaker do not work, i tried it with an apple headset, but also no sound. i used sudo raspi-config and changed the audio settings, but no sound. </p><p>i also tried the code </p><p>sudo amixer cset numid=3 1, but no sound</p><p>Alexander</p>
<p>Alexander, I'm glad your payload quota error is resolved. If you direct the sound to the right channel and still don't get any output sound, I guess the problem is the blacklist. Try the troubleshoot on step 7 and make sure the Pi is not blocking the sound output: https://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/step7/Run-the-Code/ </p>
<p>hi,</p><p>i have the talking tjbot and also getting the error</p><p>TJ is listening, you may speak now.</p><p> ===== An Error has occurred ===== </p><p>You may have exceeded your payload quota.</p><p> [object Object]</p><p> Press &lt;ctrl&gt;+C to exit.</p><p> <br> <br> <br> <br><br><br> i checked all credentials and compared with my bluemix credentials, they are all ok. in conversation i do not have only export.username, export.password, also i have export.conworkspace, but i do not see it in the bluemix credentials! what i have to enter in export.conworkspace.</p><p>greetings</p><p>alexander</p>
<p>Hi Alexander, you are right, the payroll quota error is usually caused by incorrect credentials. </p><p>Which recipe are you trying to run? The &quot;Use your voice to control a light with Watson&quot; doesn't use Watson Conversation. I guess you are referring to another TJBot recipe (&quot;Build a talking robot with Watson Conversation&quot;). If so, please follow the instructions on step 6 to look up your conversation workspace ID. <a href="https://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/step6/Create-a-conversation-flow/"> https://www.instructables.com/id/Build-a-Talking-R...</a> I just added a screenshot of the config file. Hopefully it makes it easier to locate the part. </p><p>Please let me know if this solves your problem! ::robot-face::</p>
<p>Cool stuff!</p>
<p>Help? I get this:</p><p>TJ is listening, you may speak now.</p><p> ===== An Error has occurred ===== </p><p>You may have exceeded your payload quota.</p><p> [object Object]</p><p> Press &lt;ctrl&gt;+C to exit.</p>
<p>Hi MarkK236,<br><br>Can you confirm you have set up your bluemix speech to text credentials correctly in config.js?<br>Usually if your speech-to-text credentials are incorrect (or missing), you will get this error. Please see step 5 for how to add your Bluemix credentials to config.js</p><p><a href="https://www.instructables.com/id/Use-Your-Voice-to-Control-a-Light-With-Watson/step5/Update-your-Bluemix-credentials/" rel="nofollow">https://www.instructables.com/id/Use-Your-Voice-to-...</a><br><br>Please let me know if this helps!<br><br>V.</p>
<p>Got it! I had erroneously tried to cut and paste credentials from a different Watson service that I had created (from the Tone Analyzer demo). That's what I get for not following instructions. :D</p><p>Cool demo! Thank you for your help!</p>
<p>Thanks, Victor. Hi Mark, I just added a screenshot of the config file for you on step #5. https://www.instructables.com/id/Use-Your-Voice-to-Control-a-Light-With-Watson/step5/Update-your-Bluemix-credentials/ Let me know if this solves your problem! ::robot-smile::</p>
That is really cool. I always wanted to have a voice controlled robot.
<p>We cannot wait to see what you build with TJ! </p>

About This Instructable



Bio: I'm an open source project designed to help you access Watson Services in a fun way. You can laser cut or 3D print me ... More »
More by TJBot:How to 3D Print a TJBot Build TJBot Out of Cardboard TJBot - Make Your Robot Respond to Emotions Using Watson 
Add instructable to: