loading

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.

Step 1: Parts

Step 2: Prepare Your Pi

If you have used Raspberry Pi before, install Node.js and go to the next step. Otherwise, follow the instructions below to set up your Pi:


Getting Started with Your Pi

Raspberry Pi is similar to a full computer, which means you need a monitor, mouse, and keyboard for it. If you have a TV around, you can connect your Pi to your TV via a HDMI cable. In most of the Pi kits, the SD card is already preloaded with an image of the Raspberry Pi Operating System. You need to put the SD card in the Pi, turn the Pi ON and follow the instructions on screen to complete the installation of the operating system. If you have problems setting up your Pi, you can troubleshoot here.

Here is an easy way to get your Pi connected to wifi.


Install Packages

Open a terminal application on the Pi and execute the following commands to install the latest version of Node.js and npm (Node Package Manager). You need these packages later to run your code.

sudo apt-get update

sudo apt-get dist-upgrade

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

sudo apt-get install -y nodejs

sudo apt-get install alsa-base alsa-utils libasound2-dev

Step 3: Assemble TJBot

Here is a quick video of how to fold the kit. The detailed instructions are available on another instructable: Build TJBot out of Cardboard

Once your TJBot is ready, plug in your USB microphone and the speaker.

Depending on which audio output source you are using with your Pi (HDMI, 3.5mm audio jack, Bluetooth, USB speaker), you may need to set the audio config.

HDMI/ 3.5mm Audio Jack

If you use HDMI or 3.5mm audio jack, you may need to set the audio config. To do this, go to the terminal and open up raspi-config.

 sudo raspi-config  

This will open up the Raspberry Pi configuration screen:

Select "Advanced Options" and press Enter, then select "Audio" and press Enter. Choose the correct channel for the output audio. If you have connected an external speaker to the audio jack, you should select 3.5mm jack.

USB Speaker

If you have a USB audio, you need to update your /usr/share/alsa/alsa.config to set the USB audio as the default device. Begin with running the following command to make sure your USB is connected and listed there.

 lsusb 

Next is to detect the card number of your USB audio.

aplay -l 

Take a note of the card number associated with your USB Audio. Then go to the also.config file to set it as default.

sudo nano /usr/share/alsa/alsa.conf

Look for

defaults.ctl.card 0
defaults.pcm.card 0

and update the card number (0 here) to the card number of your USB audio.

Different versions of Raspberry Pi OS may need a different setup. If you have problem with your USB setup, check out this guide to troubleshoot.

Bluetooth Speaker

If you plan to use a Bluetooth speaker, you may need to install the Raspberry Pi Bluetooth software. Here is a good tutorial to set it up: Play audio on a bluetooth speaker with Raspberry Pi 3

Step 4: Download the Sample Code

The source code is available at github. Download or clone the code and execute the following commands from a terminal to install its dependencies..

Here are the instructions for how to clone a repository from github if you have not done that before.


git clone https://github.com/ibmtjbot/tjbot.git
cd tjbot/recipes/conversation
npm install

Step 5: Update Your Credentials

In this step, we help you get API access to three Watson conversation services.

You will use three types of Watson services in this recipe: (1) Watson Speech to Text, (2) Watson Conversation, (3) Watson Text to Speech. You need to copy your credentials for all these services.
Let's start with creating a Watson Conversation instance (If you don't have a Bluemix account, you need to create one).

You can leave the default values and select 'Create'.

Now we need to copy your credentials from Bluemix. Click on 'Sevice Credentials' on the left menu and copy your credentials into clipboard.


Now make a copy of the default config file.

cp config.default.js config.js

Open config.js file using your favorite text editor and update it with your username and password.

The Conversation service needs one more ID to configure. It's called the Workspace ID (exports.conversationWorkspaceId). Don't worry about it for now. In the next step, we will walk you through creating a conversation workspace.

You are done with the Conversation credentials! Next stop is Watson Speech to Text. Follow the same process to create a service and copy your credentials.

You may leave the default values for the service & credential names and select 'Create'.

Now go to 'Sevice Credentials' on the left menu and copy your credentials into clipboard.

You need to update config.js with your Speech to Text credentials.

The last stop is Watson Text to Speech. You need to do the exact same steps you did with the other two services. You may leave the default values for service and credential name and select 'create'.

Copy your credentials and add them to config.js.

Here is the section of config.js that you need to update:

Congradulations! You survived the credentials section! ::robot-smile::

Step 6: Create a Conversation Flow

You need to train your robot with what to say and when to say it. For that, we use Watson Conversation. Open a browser and go to IBM Watson Conversation.

Log in, and in the the top left menu, select the name of your conversation service. Click 'Import' to import the sample conversation.

In the dialog that opens, click 'Choose a file' and select 'workspace-sample.json' from the 'tjbot/recipes/conversation' folder. Make sure 'Everything (Intents, Entities, and Dialog)' is selected.

After the workspace has been imported, click the dotted menu and select 'View details'. Copy your Workspace ID as shown.

Next, update your config.js file with the workspace ID.

Congratulations, your conversation is ready!

Step 7: Run the Code

Now, you are ready to talk to your TJBot!

Open a terminal and execute the following command:

sudo node conversation.js

Watson conversation uses intents to label the purpose of a sentence. For example when you ask TJBot "Please introduce yourself", the intent is to make an introduction. You can add your own new intents in the Conversation editor, but for now, we have started you off with two intents:

  • Introduction. You can say phrases such as "Watson, please introduce yourself", "Watson, who are you", and "Watson, can you introduce yourself"
  • Joke. You can ask "Watson, please tell me a joke" or "Watson, I would like to hear a joke".

If you would like to create your own intents, we recommend following this guide.

An attention word is used so TJBot knows you are talking to him. The default attention word is 'Watson', but you can change it in conversation.js as follows. Update conversation.js and change tjConfig to add the 'robot' section:

// turn on debug logging to the console
var tjConfig = {
    verboseLogging: true,
    robot: {
        name: 'Watson',
        gender: 'male'
    }
};

You can change the 'name' to whatever you would like to call your TJBot. In addition, if you change the gender to 'female', TJBot will use a female voice to speak to you!

Enjoy! Don't forget to share a picture/video of your setup #TJBot! :-)

Troubleshoot

If you see TJBot's response on the terminal but don't hear TJBot talking, there is a good chance that one of these two things has happened: (1) The audio output is directed to a wrong channel (you can fix it from raspi-config), (2) your sound modules are blocked. In that case, go to /etc/modprobe.d/ and remove blacklist-rgb-led.conf

Then run the following command:

sudo update-initramfs -u

Reboot and confirm the "snd" modules are running by executing the command "lsmod". This should solve the problem.

lsmod
<p>Hi,</p><p>Hope you can advise on the following error I see when issuing the 'sudo node conversation.js' ? I've checked that all the credentials are listed correctly in the config.js</p><p>pi@raspberrypi:~/tjbot/recipes/conversation $ sudo node conversation.js</p><p>verbose: TJBot initializing microphone</p><p>verbose: TJBot initializing conversation service</p><p>verbose: TJBot initializing speech_to_text service</p><p>verbose: TJBot initializing text_to_speech service</p><p>info: Hello from TJBot! My name is Watson.</p><p>verbose: TJBot library version v1.2.1</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>verbose: TJBot initializing microphone</p><p>error: the speech_to_text service returned an error. type=error, isTrusted=false, _yaeti=true, , addEventListener=function _addEventListener(type, newListener) {</p><p>var</p><p>listenersType,</p><p>i, listener;</p><p>if (!type || !newListener) {</p><p>return;</p><p>}</p><p>listenersType = this._listeners[type];</p><p>if (listenersType === undefined) {</p><p>this._listeners[type] = listenersType = [];</p><p>}</p><p>for (i = 0; !!(listener = listenersType[i]); i++) {</p><p>if (listener === newListener) {</p><p>return;</p><p>}</p><p>}</p><p>listenersType.push(newListener);</p><p>}, removeEventListener=function _removeEventListener(type, oldListener) {</p><p>var</p><p>listenersType,</p><p>i, listener;</p><p>if (!type || !oldListener) {</p><p>return;</p><p>}</p><p>listenersType = this._listeners[type];</p><p>if (listenersType === undefined) {</p><p>return;</p><p>}</p><p>for (i = 0; !!(listener = listenersType[i]); i++) {</p><p>if (listener === oldListener) {</p><p>listenersType.splice(i, 1);</p><p>break;</p><p>}</p><p>}</p><p>if (listenersType.length === 0) {</p><p>delete this._listeners[type];</p><p>}</p><p>}, dispatchEvent=function _dispatchEvent(event) {</p><p>var</p><p>type,</p><p>listenersType,</p><p>dummyListener,</p><p>stopImmediatePropagation = false,</p><p>i, listener;</p><p>if (!event || typeof event.type !== 'string') {</p><p>throw new Error('`event` must have a valid `type` property');</p><p>}</p><p>// Do some stuff to emulate DOM Event behavior (just if this is not a</p><p>// DOM Event object)</p><p>if (event._yaeti) {</p><p>event.target = this;</p><p>event.cancelable = true;</p><p>}</p><p>// Attempt to override the stopImmediatePropagation() method</p><p>try {</p><p>event.stopImmediatePropagation = function () {</p><p>stopImmediatePropagation = true;</p><p>};</p><p>} catch (error) {}</p><p>type = event.type;</p><p>listenersType = (this._listeners[type] || []);</p><p>dummyListener = this['on' + type];</p><p>if (typeof dummyListener === 'function') {</p><p>dummyListener.call(this, event);</p><p>}</p><p>for (i = 0; !!(listener = listenersType[i]); i++) {</p><p>if (stopImmediatePropagation) {</p><p>break;</p><p>}</p><p>listener.call(this, event);</p><p>}</p><p>return !event.defaultPrevented;</p><p>}, _url=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, _readyState=3, _protocol=undefined, _extensions=, _bufferedAmount=0, _binaryType=arraybuffer, _connection=undefined, domain=null, , _eventsCount=0, _maxListeners=undefined, maxReceivedFrameSize=1048576, maxReceivedMessageSize=8388608, fragmentOutgoingMessages=true, fragmentationThreshold=16384, webSocketVersion=13, assembleFragments=true, disableNagleAlgorithm=true, closeTimeout=5000, , _req=null, protocols=[], origin=null, protocol=wss:, slashes=true, auth=null, host=stream.watsonplatform.net, port=443, hostname=stream.watsonplatform.net, hash=null, search=?model=en-US_BroadbandModel, query=model=en-US_BroadbandModel, pathname=/speech-to-text/api/v1/recognize, path=/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, href=wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel, secure=true, base64nonce=/bI/W/vDaLupLpWE1CYy5w==, onerror=function (error) {</p><p> self.listening = false;</p><p> self.emit('error', error);</p><p> }, onopen=function () {</p><p> socket.send(JSON.stringify(openingMessage));</p><p> self.emit('connect');</p><p> }, onclose=function (e) {</p><p> self.listening = false;</p><p> self.push(null);</p><p> /**</p><p> * @event RecognizeStream#close</p><p> * @param {Number} reasonCode</p><p> * @param {String} description</p><p> */</p><p> self.emit('close', e.code, e.reason);</p><p> }, onmessage=function (frame) {</p><p> if (typeof frame.data !== 'string') {</p><p> return emitError('Unexpected binary data received from server', frame);</p><p> }</p><p> let data;</p><p> try {</p><p> data = JSON.parse(frame.data);</p><p> } catch (jsonEx) {</p><p> return emitError('Invalid JSON received from service:', frame, jsonEx);</p><p> }</p><p> let recognized = false;</p><p> if (data.error) {</p><p> emitError(data.error, frame);</p><p> recognized = true;</p><p> }</p><p> if (data.state === 'listening') {</p><p> // this is emitted both when the server is ready for audio, and after we send the close message to indicate that it's done processing</p><p> if (!self.listening) {</p><p> self.listening = true;</p><p> self.emit('listening');</p><p> } else {</p><p> self.listening = false;</p><p> socket.close();</p><p> }</p><p> recognized = true;</p><p> }</p><p> if (data.results) {</p><p> /**</p><p> * Object with interim or final results, including possible alternatives. May have no results at all for empty audio files.</p><p> * @event RecognizeStream#results</p><p> * @param {Object} results</p><p> */</p><p> self.emit('results', data);</p><p> // note: currently there is always either no entries or exactly 1 entry in the results array. However, this may change in the future.</p><p> if (data.results[0] &amp;&amp; data.results[0].final &amp;&amp; data.results[0].alternatives) {</p><p> /**</p><p> * Finalized text</p><p> * @event RecognizeStream#data</p><p> * @param {String} transcript</p><p> */</p><p> self.push(data.results[0].alternatives[0].transcript, 'utf8'); // this is the &quot;data&quot; event that can be easily piped to other streams</p><p> }</p><p> recognized = true;</p><p> }</p><p> // note: some messages will have both results and speaker_labels</p><p> // this will cause them to be emitted twice - once for each event</p><p> if (data.speaker_labels) {</p><p> /**</p><p> * Speaker labels</p><p> * @event RecognizeStream#speaker_labels</p><p> * @param {Object} speaker_labels</p><p> */</p><p> self.emit('speaker_labels', data);</p><p> recognized = true;</p><p> }</p><p> if (!recognized) {</p><p> emitError('Unrecognised message from server', frame);</p><p> }</p><p> }, cancelable=true, stopImmediatePropagation=function () {</p><p>stopImmediatePropagation = true;</p><p>}</p><p>verbose: TJBot initializing microphone </p>
<p>Hi all,</p><p>I just knew TJBot yesterday. And would like to try it. Could you please tell me where to buy the materials? And the list of material with brand version #? </p><p>Thanks</p>
<p>Hi there, please check ibm.biz/mytjbot for purchase options. For a list of electronics with an amazon link to purchase them, check out https://github.com/ibmtjbot/tjbot Have fun with TJBot! :-)</p>
Thank you, TJBot. I tried to order at amazon.com, but many of the components won't ship outside of US. I then tried at amazon.ca, can't find exactly the same brand for some components. I s there anyone in Toronto that bought all the required materials?
<p>@Henry Will has a Blog post with links to required parts. ==&gt; </p><p><a href="http://henrywill4.blogspot.com/2017/04/tjbot-part-1.html" rel="nofollow">http://henrywill4.blogspot.com/2017/04/tjbot-part-...</a></p><p>There is also a parts list in GitHub ==&gt; </p><p><a href="https://github.com/bmeunier/TJBot-Parts-List" rel="nofollow">https://github.com/bmeunier/TJBot-Parts-List</a></p>
<p>Hi all,</p><p>Got a problem, the conversation service returns an error. Can't find the problem. I have other recipes working (Speech to Text, Sentiment Analysis) and I have tested all tjbot-devices (ran all tests in jbot/bootstrap/tests). The error that I got is:</p><p>info: TJBot heard: Watson how are you <br>error: the conversation service returned an error. Error: Resource not found<br> at Request._callback (/home/pi/tjbot/recipes/conversation/node_modules/watson-developer-cloud/lib/requestwrapper.js:87:15)<br> at Request.self.callback (/home/pi/tjbot/recipes/conversation/node_modules/request/request.js:188:22)<br> at emitTwo (events.js:106:13)<br> at Request.emit (events.js:191:7)<br> at Request.&lt;anonymous&gt; (/home/pi/tjbot/recipes/conversation/node_modules/request/request.js:1171:10)<br> at emitOne (events.js:96:13)<br> at Request.emit (events.js:188:7)<br> at Gunzip.&lt;anonymous&gt; (/home/pi/tjbot/recipes/conversation/node_modules/request/request.js:1091:12)<br> at Gunzip.g (events.js:292:16)<br> at emitNone (events.js:91:20)<br> at Gunzip.emit (events.js:185:7)<br> at endReadableNT (_stream_readable.js:974:12)<br> at _combinedTickCallback (internal/process/next_tick.js:80:11)<br> at process._tickCallback (internal/process/next_tick.js:104:9)</p><p>Hope anyone can help me.</p><p>Ar.</p>
<p>Oh, and yes, I checked the service credentials etc. I also uploaded the intents to Conversation, all looks fine there too.</p>
<p>Hello:</p><p>I'm stuck on step 6.</p><p>Whenever I tried to upload the workspace-sample.json to IBM Watson Conversation, I get the following error:</p><p>Unable to import workspace from file workspace-sample.json. Error: File upload error</p><p>Any ideas how to solve this?</p><p>Thank you very much for your help.</p><p>Best Regards!</p>
<p>It might be the case that your json file might be corrupted?<br>Perhaps consider downloading a new copy of the file and uploading that?<br><br>-V.</p>
<p>I fixed it by changing the permissions to the file (777)</p><p>thank you for your response!</p>
<p>I also had that error. I still had the config.js editor open, so I saved and closed it and re-uploaded the workspace-sample.json.....problem fixed.</p>
<p>Thanks for your response, also I changed permissions in the file (chmod 777) and that also solved the problem.</p><p>Best Regards!</p>
<p>Hi all, </p><p>get following</p><p>error: unable to retrieve TTS voices Error: Not Authorized</p><p>Any ideas???</p><p>Thanks</p>
<p>OK, seems that just like in previous comments from <strong>Ooduc</strong>, the service does not work if it is based in 'Germany' region. creating services in US-South works just fine. </p>
<p>Hi, This is the error we are receiving:</p><p>pi@raspberrypi:~/tjbot/recipes/conversation $ sudo node conversation.js</p><p>module.js:471</p><p> throw err;</p><p> ^</p><p>Error: Cannot find module './config'</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> at Module.runMain (module.js:604:10)</p><p> at run (bootstrap_node.js:390:7)</p><p> at startup (bootstrap_node.js:150:9)</p><p> at bootstrap_node.js:505:3</p><p>Can you please help? Thanks.</p>
Hi jman24saints, did you rename config,default.js to config.js? This should solve your problem.
<p>Hi,</p><p>I have also this error but not about npm :( &quot;</p><p>Cannot find module 'tjbot'</p><p>---------------------------------------------</p><p><strong>$ node conversation.js<br>module.js:471<br> throw err;<br> ^<br><br>Error: Cannot find module 'tjbot'<br> at Function.Module._resolveFilename (module.js:469:15)<br> at Function.Module._load (module.js:417:25)<br> at Module.require (module.js:497:17)<br> at require (internal/module.js:20:19)<br> at Object.&lt;anonymous&gt; (......\TJBOT\tjbot-master\recipes\conversation\conversation.js:17:13)<br> at Module._compile (module.js:570:32)<br> at Object.Module._extensions..js (module.js:579:10)<br> at Module.load (module.js:487:32)<br> at tryModuleLoad (module.js:446:12)<br> at Function.Module._load (module.js:438:3)</strong></p>
<p>I am out of ideas.</p><p>I checked the credentials twice after following the instructions (twice, or thrice because on the first attempt I didn't notice that password was first in the config)</p><p>Is it my system or something with the connection?</p><p>I followed the instructions word by word because I am not a raspi-jockey (jet?)</p>
<p>We've only seen that error come up when putting in the credentials incorrectly. The username is the very long string with dashes and the password is the shorter string. Make sure you are not copying with extra spaces at the beginning or at the end.</p>
<p>I did everything again, twice didn't work.</p><p>I deleted all Watson services changed the region from 'Germany' to 'United States (South)' created a division (no sure if it is division only have the german interface). After that I created all services anew, also noticed that there are more services available.</p><p>Works almost perfect only one thing: If I just say 'watson' and nothing else it crashes with some 'no text' error.</p>
<p>Hi Ooduc,<br>Glad you were able to resolve the credentials issue!<br>We have fixed the &quot;no text crash&quot;.<br>To get the latest update you can run reinstall the libary by running the code below.<br><br>rm -rf node_modules<br><br>npm install<br><br>-V.</p>
<p>Hi</p><p>on running: sudo node conversation.js in step 7</p><p>I get error:<br>SyntaxError: Unexpected token =<br> at exports.runInThisContext (vm.js:53:16)<br> at Module._compile (module.js:373:25)<br> at Object.Module._extensions..js (module.js:416:10)<br> at Module.load (module.js:343:32)<br> at Function.Module._load (module.js:300:12)<br> at Module.require (module.js:353:17)<br> at require (internal/module.js:12:17)<br> at Object.&lt;anonymous&gt; (/home/pi/tjbot/recipes/conversation/node_modules/tjbot/index.js:1:80)<br> at Module._compile (module.js:409:26)<br> at Object.Module._extensions..js (module.js:416:10)</p><p>When running npm install I had 1 warning:</p><p>npm WARN deprecated node-uuid@1.4.8: Use uuid module instead</p><p>Username and password x 3 double checked as was exports.conversationWorkspaceId and opening and closing quotes.</p><p>Note this is a working Jessie from a Pi 1 B+ imaged to a new Pi 3. I ran steps 1 to 6 OK (well took a day to get the BT speaker working!). A USB microphone is installed but not tested. LEDs and servo not yet connected. </p><p>Help appreciated.</p><p>Alan</p>
<p>Realised I missed a bit of the error message. The above is prefixed:</p><p>sudo node conversation.js<br>/home/pi/tjbot/recipes/conversation/node_modules/tjbot/lib/tjbot.js:854 <br>TJBot.prototype.pulseOnce = function(color, duration = 1.0) {</p><p>Seems to me this code is trying to control the LED but this Instructable does not include the LED in the build whereas another Instructable &quot;Build TJBot Out of Cardboard&quot; does have the LED. I did not fit the LED so why does it appear the conversation.js code is trying to control the LED? </p><p>Thanks</p><p>Alan</p>
<p>Hi Alan,<br>The above error is helpful in troubleshooting. The way the TJBot library is designed, there should be no call to &quot;pulse&quot; or LED since &quot;led&quot; is not specified as a config parameter in the conversation.js recipe.<br>The correct way to disable LED is to not have it in the config parameter.</p><p>var hardware = ['microphone', 'speaker'];<br><br>One thing we can try is to uninstall and reinstall your node_modules.<br>sudo rm -rf node_modules<br>npm install.<br><br>I see you have posted on gitub, lets continue the conversation there<br></p><p><a href="https://github.com/ibmtjbot/tjbot/issues/37" rel="nofollow">https://github.com/ibmtjbot/tjbot/issues/37</a><br><br><br>-V.</p>
<p>I've been following the instructions at </p><p><a href="https://www.instructables.com/id/Use-Your-Voice-to-Control-a-Light-With-Watson/" rel="nofollow">https://www.instructables.com/id/Use-Your-Voice-to-...</a> to try to get the LED to work but unsuccessfully. I read that the Neopixels are not suitable for the Raspberry Pi <a href="https://learn.adafruit.com/adafruit-neopixel-uberguide" rel="nofollow">https://www.instructables.com/id/Use-Your-Voice-to-...</a> and elsewhere I read there are problems with the Rasp Pi 3 and Neopixels. </p><p>I don't really need the LED and the parts list for this instructables doesn't list the LED but the code seems to crash trying to use an LED. Is there any way to disable the LED function so I can continue with the Conversation functions? Help much appreciated as I was hoping to show TJBot at meeting in 10 days time.</p>
<p>Nice Article, but i'm having problems following it, I'm getting following error:</p><p>pi@raspberrypi:~/tjbot/recipes/conversation $ sudo node conversation.js</p><p>info: Hello from TJBot! My name is cat.</p><p>You can ask me to introduce myself or tell you a joke.</p><p>Try saying, &quot;cat, please introduce yourself&quot; or &quot;cat, who are you?&quot;</p><p>You can also say, &quot;cat, tell me a joke!&quot;</p><p>info: TJBot heard: cat </p><p>info: TJBot heard: who are you </p><p>events.js:160</p><p> throw er; // Unhandled 'error' event</p><p> ^</p><p>Error: Missing required parameters: text</p><p> at Object.getMissingParams (/home/pi/tjbot/recipes/conversation/node_modules/watson-developer-cloud/lib/helper.js:47:33)</p><p> at createRequest (/home/pi/tjbot/recipes/conversation/node_modules/watson-developer-cloud/lib/requestwrapper.js:132:26)</p><p> at TextToSpeechV1.synthesize (/home/pi/tjbot/recipes/conversation/node_modules/watson-developer-cloud/text-to-speech/v1.js:71:10)</p><p> at /home/pi/tjbot/recipes/conversation/node_modules/tjbot/lib/tjbot.js:1106:23</p><p> at /home/pi/tjbot/recipes/conversation/node_modules/temp/lib/temp.js:252:7</p><p> at FSReqWrap.oncomplete (fs.js:123:15)</p><p>Any clue what can be the cause?</p>
<p>never mind, understood the problem :)</p>
<p>Im getting an error in the first command execution itself. Node conversation.js </p><p>Image attached. </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>it works now! thanks. Now we need to figure out how to make it do more stuff!</p>
<p>I had the same idea started editing a few things, by using the import syntax I got mine to take a picture and analyse on command!</p><p>https://github.com/Captain-Cheesecake/TJBot-Visual</p>
<p>for others trying this. It works with a raspi 2 just as well, and a 8gb card is also enough </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 TjBot,</p><p>How to check a usb mic working?</p><p>I think my bot's mic doesn't work correctly. I said &quot;Watson, who are you&quot;</p><p>it response</p><p>&quot;info: TJBot heard: after&quot;</p><p>Always, same response from TJBot.</p><p>I would like to check my USB mic working correctly and test again.</p><p>I am using Raspberry Pi 3, default 3.5mm speaker jack and Logitech webcam C270 for mic. </p><p>Thank you.</p>
<p>I did a search and found this: https://www.instructables.com/id/How-to-Record-Voice-With-USB-Microphone-Then-Play-/ It's based on a Pi 2 but I think should work for you. At least you will be able to make sure your mic is working. Also there is an article here https://medium.com/@DamianC_/building-a-chat-bot-with-speech-recognition-naming-logging-monitoring-repetition-ef44a9af173f that talks about some of the microphone tricks. I hope it helps! :-)</p>
<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>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>

About This Instructable

19,912views

96favorites

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 Run a TJBot Workshop How to 3D Print a TJBot Build TJBot Out of Cardboard 
Add instructable to: