This instructable guides you through connecting a Raspberry Pi to Watson conversation services and making a talking robot. You will use (1) Watson Speech to Text to convert your voice to text, (2) Watson Conversation to process the text and calculate a response, and (3) Watson Text to Speech to talk the response back.

<p>the code is not working/can not find the sample code. pls help </p>
<p>Did you have a chance to go through step #5 to get the sample code? That step guides you through to access github and download the code to your Pi. Here is the link to the sample code for this instruction: <a href="https://github.com/ibmtjbot/tjbot"> https://github.com/ibmtjbot/tjbot</a></p>
<p>Im getting an error in the first command execution itself. Node conversation.js </p><p>Image attached. </p>
<p>We just updated the library. If you are seeing this error, please do the following:</p><p>$ cd tjbot/recipes/conversation</p><p>$ rm -r node_modules</p><p>$ npm install</p><p>$ sudo node conversation.js</p><p>This should solve the problem! :-)</p>
<p>Hi AryanS64,</p><p>Have you edited the code for conversation.js at all? When I run it, this is what I see:</p><p>$ node conversation.js </p><p>Hello from TJBot! My name is Watson.</p><p>You can ask me to introduce myself or tell you a joke.</p><p>Try saying, &quot;Watson, please introduce yourself&quot; or &quot;Watson, who are you?&quot;</p><p>You can also say, &quot;Watson, tell me a joke!&quot;</p>
<p>Hello</p><p>Just installed following your instructions and encountered this when I execute Node conversation.js</p><p>Please can you help please?</p><p>J</p>
<p>We just updated the library. If you are seeing this error, please do the following:</p><p>$ cd tjbot/recipes/conversation</p><p>$ rm -r node_modules</p><p>$ npm install</p><p>$ sudo node conversation.js</p><p>This should solve the problem! :-)</p>
<p>I am attempting to get the anything_else trigger to work. In the conversation tool when I use the &quot;test console&quot; it works correctly, but when using this program it just defaults to one of my intents.</p>
<p>Hi,</p><p>I can not seem to get TJBot to respond to me when i speak to it. It recognizes what I say then it says &quot;waiting to hear watson&quot; and it just sits idle.</p><p>any information would be great</p>
<p>I cannot seem to get Jumps from one node to the next to work. STT doesn't return the next node, only the one that immediately addressed the previous dialogue. So: </p><p>user: let's go to mars.</p><p>TJ: Okay heading to @planet (mars) sounds great. </p><p>TJ: Are you ready to go? </p><p>// second node doesn't return, though it should automatically (and works in conversation service). </p><p>Do I need to add an additional listener in STT? </p>
<p>Hi RobertR337,<br><br>It appears you have created your dialog to have two consecutive turns ( user, TJ, TJ, user). Does the user say anything between these turns? Usually each party has a SINGLE turn - user, TJ, user, TJ, user, TJ etc. <br>To maintain this pattern ... will the following work?<br><br>user: .. lets to to mars<br>TJ: okay heading to @planet(mars) sounds great. Are you ready to go?<br>user: awesome! Firing up rocket, checking sensors and gadgets. Launching in three. two. one. zero ...<br><br>Does this help? Im unsure I fully understand the issue. Please also see this link for a quick primer on designing a conversation dialog. </p><p>https://www.ibm.com/watson/developercloud/doc/conversation/dialog-build.html</p><p><br>Btw .. we can move this conversation to github.<br><br>Thanks.<br></p>
<p>Hi,</p><p>When I use the bluetooth speaker in the conversation recipe, I end up with the following error on the response from Watson. The text-to-speech does not seem to get rendered through bluetooth.. Here is the error message.</p><p>Waiting to hear watson</p><p> ===== Speech to Text ===== : hello Watson </p><p>msg sent to conversation: hello </p><p>Result from conversation: Hola Amigo</p><p>exec error: Error: Command failed: aplay output.wav</p><p>ALSA lib confmisc.c:768:(parse_card) cannot find card '0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory</p><p>ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory</p><p>ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default</p><p>aplay: main:722: audio open error: No such file or directory</p>
<p>HI tejasking62<br><br>It appears there is an issue playing audio through your speaker. The first thing to confirm is to ensure that your raspberry is able to play audio through bluetooth. If not, I'd recommend you play audio via an audio jack or usb audio.<br><br>Next, please check for your speaker device id ... you can do this by running the following in command line aplay -L (it should list bluetooth speaker as a pulseaudio device) .. node your device id. <br><br>For example if your device id is 2, you use the -D plughw:2,0 parameter in playing audio. If it is 3 -D plughw:2,0<br><br>Finally, you can modify the way you play audio by adding your microphone device id. In conversation.js (line 163) add your device id parameter to the aplay command.</p><p>var create_audio = exec('aplay -D plughw:0,0 output.wav', function (error, stdout, stderr)</p><p><br>Feel free to post a new issue for further followup on github</p><p><a href="https://github.com/ibmtjbot/tjbot/issues/new">https://github.com/ibmtjbot/tjbot/issues/new</a><br><br>-V.</p><p><br><br><br></p>
<p>Hi,</p><p>I am running into an issue trying to execute the speech to text and conversation modules one after the other. I use an analog speaker connected to the headphone jack. This causes the neopixel leds to not change the right colors until you copy the backlist-rgb-led.conf file to /etc/modprobe.d folder. But this prevents the response from Watson being converted into audio when conversation.js is executed and requires that I remove the blacklist file from /etc/modprobe.d folder and reboot the system. I tried usinga bluetooth speaker, but the connection barely lasts 15-30 seconds and gets dropped right after. Any suggestions/workaround?</p>
<p>Yes, this is a known issue for Raspberry Pi. The PWM pin interacts with the audio jack. An alternative is a USB sound card. We've been using USB Audio Adapter from Adafruit https://www.adafruit.com/products/1475 There are multiple similar options that you can use. The quality of the one from Adafruit was slightly better that the other ones we tested.</p>
<p>Hi, I am running into an error when I execute the conversation.js file.</p><p>On executing command &quot;node conversation.js&quot;, I get an error message</p><p>module.js: 471 </p><p>throw err;</p><p>^</p><p>Error: Cannot find module 'watson-developer-cloud'</p><p> at Function.Module._resolveFilename (module.js:469:15)</p><p> at Function.Module._load (module.js:417:25)</p><p> at Module.require (module.js:497:17)</p><p> at require (internal/module.js:20:19)</p><p> at Object.&lt;anonymous&gt; (/home/pi/tjbot/recipes/conversation/conversation.js:18:14)</p><p> at Module._compile (module.js:570:32)</p><p> at Object.Module._extensions..js (module.js:579:10)</p><p> at Module.load (module.js:487:32)</p><p> at tryModuleLoad (module.js:446:12)</p><p> at Function.Module._load (module.js:438:3)</p><p>I am helping my son try this out and am stuck with this issue</p>
<p>It seems like the 'watson-developer-cloud' is not installed. </p><p>My guess is you either forgot to run 'npm install' on step 4 (</p><p><a href="https://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/step4/Download-the-sample-code/">https://www.instructables.com/id/Build-a-Talking-Ro...</a> ) or you ran the command and it failed for some reason. Please do it again, it should solve the problem. </p><p>If it fails, share the screenshot with me to see what went wrong! :-)</p>
<p>Thank you very much. I had indeed missed the step npm install; this fixed the issue.</p>
<p>Need help, I get this error:</p><p>Error: Resource not found</p>
<p>I see that the Speech-To-Text is working fine (as whatever I speak shows up on the screen), however when it states it is waiting to hear from Watson it throws that error &quot;Resource Not Found&quot;. Any immediate help will be appreciated!</p>
<p>Thanks to @victordibia. This issue is resolved. I was able to solve the correct the workspace information in the config file and that resolved the issue.</p>
<p>Hi, my Pi 3 is on HDMI and I can play youtube just fine. when i first run this program, Watson is supposed to respond &quot;Hello what can I do for you?&quot; I can hear the end part of this response (last three words or so), but that's it. After that, I can see all the responses in the terminal but none of them make any sound after that. Any ideas?</p>
<p>HI CallistoB,<br>This tends to occur when the pi needs some time to synchronize a datastream sent over hdmi in some cases. This time is usually fixed so you can add some initial text that plays first e.g (Hello there. Hello what can I do for you?). Another alternative is to use a 3.5mm audio output or usb audio.<br><br>Please see the link below for additional information.</p><p><a href="https://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/">www.instructables.com/id/Build-a-Talking-Robot-Wit...</a></p>
<p>This setup works for Raspberry PI 2 Model B too! Thanks very much for this instructable! <br><br>My RPi2B doesn't have npm pre-installed so I have to install it in order to get step 4 work. Also, when I download repo from github, it sits inside of tjbot folder, so cd recipes/conversation didn't work for me, I have to use cd tjbot/recipes/conversation, it works find this way. </p><p>thanks again! </p>
<p>I'm glad you are enjoying it! :-) Here is a video for one of the simpler recipes. It might help too. </p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/Wvnh7ie3D6o" width="500"></iframe></p>
<p>Hi, <br><br>I did this tutorial step by step. I just did one thing different: changed the attention word to &quot;Google&quot;.<br><br>I see that Watson can recognize when I say &quot;Google&quot;, but I don't know why it can't give me the answer that I made on Watson Conversation Dialog.<br><br>This is the error.... (someone can help me?)<br><br>Tks !!</p>
<p>Hi Pedro,<br><br>Thanks for sharing the error above.<br>From your screenshot, it appears you have only mentioned your keyword and have not said anything else. For example &quot;Watson how are you doing&quot; will send the text &quot;how are you doing&quot; to the conversation api. Saying only &quot;Watson&quot; will send an empty text to the conversation api, hence your error. <br><br>Another good way to get quick help is to open an issue describing your problem on github (https://github.com/ibmtjbot/tjbot/issues/new)<br><br>Best.<br>V.</p>
<p>Hi Victor,<br><br>Thanks for your help. <br><br>I know that my screenshot just have the keyword, but this is because that's all that happens even if I try to talk other things like: &quot;Watson how are you doing&quot;and etc...<br><br>Please, do you know what I need to do to solve this?<br>Best.<br>Pedro</p>
<p>hi,<br></p><p>i tried several points from the page you send me, all of them works</p><p><a href="http://blog.scphillips.com/posts/2013/01/sound-configuration-on-raspberry-pi-with-alsa/" rel="nofollow">http://blog.scphillips.com/posts/2013/01/sound-con...</a></p><p>an i hear sound from the loudspeaker, but still watson do not answer,</p><p>when i call him by saying watson. i saw PedroA60 problems. when i </p><p>start watson with cd recipes, cd conversation, node conversation.js</p><p>then i get only &quot;tjbot is listening, you may speak now&quot;, when i say watson </p><p>i do not see any extra code like, waiting to hear watson....</p><p>can anybody of you help us all to bring tjbot to speak with us, the 30 days test</p><p>will expire soon.<br></p><p>i added a part of the image of from PedroA60</p><p>thx </p><p>alexander</p>
<p>Hi there,I love the project and want to build one for my girlfriend but unfortunately I have troubles to make it work. when I run &quot;node convesation.js&quot; I get the following output:</p><p>node conversation.js </p><p>TJBot is listening, you may speak now.</p><p> === Watson Speech to Text : An Error has occurred =====</p><p>_Event {</p><p> type: 'error',</p><p> isTrusted: false,</p><p> _dispatched: true,</p><p> cancelable: true,</p><p> target: </p><p> W3CWebSocket {</p><p> _listeners: {},</p><p> addEventListener: [Function: _addEventListener],</p><p> removeEventListener: [Function: _removeEventListener],</p><p> dispatchEvent: [Function: _dispatchEvent],</p><p> _url: 'wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel',</p><p> _readyState: 3,</p><p> _protocol: undefined,</p><p> _extensions: '',</p><p> _bufferedAmount: 0,</p><p> _binaryType: 'arraybuffer',</p><p> _connection: undefined,</p><p> _client: </p><p> WebSocketClient {</p><p> domain: null,</p><p> _events: {},</p><p> _eventsCount: 0,</p><p> _maxListeners: undefined,</p><p> config: [Object],</p><p> _req: null,</p><p> protocols: [],</p><p> origin: null,</p><p> url: [Object],</p><p> secure: true,</p><p> base64nonce: 'ayO5M5GIjarF1zrecXelng==' },</p><p> onerror: [Function],</p><p> onopen: [Function],</p><p> onclose: [Function],</p><p> onmessage: [Function] },</p><p> stopImmediatePropagation: [Function] }</p><p>Press &lt;ctrl&gt;+C to exit.C</p><p>Can you please help me? </p><p>P.S. I live in Germany (maybe that is the problem?)</p>
<p>Hi Xmrrobot,<br>Its super cool that you are working on this! Sorry about the error, I'm happy to help you troubleshoot this. A few things<br>1.) Verify you have the correct credentials in config.js (make sure its not empty also)<br>2.) Verify that you have an active internet connection on your pi (pop open a browser window verify you are able to open google.com or any other webpage)<br>3.) If the above doesnt work, send us a copy of your project files at (<a href="mailto:tjbot@us.ibm.com">tjbot [@] us.ibm.com</a>).<br><br>Victor.</p>
<p>hi here the screen</p><p>i started YouTube on the pi and loudspeaker is running the sound but quite low.<br>is their any way to increase the sound volume? its a mono speaker.</p><p>what i also found out:</p><p>a. the tjbot is connect by wirecable with router<br>b. i started him from the putty console on the notebook</p><p>c. when he is starten with node.conversation.js, the rest of the <br> network gets very slow, by browsing the internet</p>
<p><a href="/member/AlexanderT78">Alexander</a>, You can adjust the volume of the speaker <code>amixer cset numid=1 -- &lt;number&gt;</code>where <em>&lt;</em>number<em>&gt;</em> is an integer between -10200 and +400 (centi-dB). If this doesn't solve your volume problem, here is a blog post that may help http://blog.scphillips.com/posts/2013/01/sound-configuration-on-raspberry-pi-with-alsa/</p>
<p>hi</p><p>so i installed the pi again completely, without any errors. what makes me wondering, when i start the command, sudo apt-get dist-upgrade he install for around 10-15 min. a big number of stuff, including libri office, cc..</p><p>i can start the tjbot without any error by</p><p>cd recipes</p><p>cd conversation</p><p>node conversation.js</p><p>im getting the answer</p><p>Tjbot is listening, you may speak</p><p>no error code is shown</p>
<p>Still same error</p>
<p>Hi AlexanderT78,<br>Can you paste your conversation.js code, just to verify you have the recent file?<br>To be completely sure, try downloading the project again from github, adding you credentials and running again.<br><br>Victor.</p>
<p>when i start tjbot, suddenly i get this error</p><p>any idea about this error</p><p>You may have exceeded your payload quota.<br></p><p>Error: Required type for parameter &quot;smart_formatting&quot; is bool. </p><p>Got type unicode instead.</p>
<p>Hi Alexander,<br>Thanks for reporting this. There was a speech to text parameter (smart_formatting) that was incorrectly specified as string. This has now been corrected (conversation.js, line 91). Please pull the repo again to test.<br><br>Victor</p>
<p>hi</p><p>i bought now a raspberry pi 3 and installed the software exactly like is documented.<br>At<br> the end i start the tjbot with &quot;node node conversation.js&quot; and system <br>tells me, that i now can talk to him. But i get no answer. i use a 3,5 <br>head jack (apple) or a </p><p>3,5 loudspeaker, nothing works.</p><p>i googled all and tried several fixes, but nothing works.</p><p>for example<br></p><p>sudo amixer cset<br>numid=3 1</p><p>or </p><p>$ cd /opt/vc/src/hello_pi/<br>$ ./rebuild.sh<br>$ cd hello_audio<br>$ ./hello_audio.bin</p><p>or the troubleshoot</p><p>sudo update-initramfs -u, but i have no file </p><p><strong>blacklist-rgb-led.conf</strong></p><p> the folder /etc/modprobe.d/ i found it in folder <br></p><p>/home/pi/recipes/sentiment_analysis</p><p>------------------------</p><p>i have my raspberry pi connected with an cable on the router</p><p>please help i need to listen to watson<br></p><p>Alexander</p>
<p>Alexander, not sure if the problem is with your code setup or with your Pi. </p><p>Let's try this: Open a Youtube video and see if your speaker plays the sound. If not, the problem is with your Pi setup. </p><p>If it's fine and you can hear the Youtube video, then the problem is with your code. In that case, we need to debug your code setup together. Please attach a screenshot of your terminal when you run node conversation.js. Does it give you an error message? Do you see the text of what TJBot is supposed to say on your screen? </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: