Control an LED With Your Voice using Watson and Raspberry Pi Created by Maryam Ashoori Last updated on 2018-08-22 03:59:32 PM UTC
Guide Contents Guide Contents Overview Parts 2 3 4 What's in the Kit 4 Prepare Your Pi 6 I haven't used Raspberry Pi before, where should I start? How can I connect my Pi to the Internet? Update and Download Assemble TJBot Download the Source Code and Install Dependencies I haven't used Github before.
Overview In this lesson, you will learn how to connect a Raspberry Pi to Watson Speech to Text (https://adafru.it/v7f) 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. © Adafruit Industries https://learn.adafruit.
Parts What's in the Kit 1 x Raspberry Pi 3 Raspberry Pi 3 ADD TO CART 1 x Mini USB Microphone So TJ Bot can hear you ADD TO CART 1 x NeoPixel RGB LED TJ's indicator light ADD TO CART 1 x Female/female jumper wires To connect LED to the Pi ADD TO CART 1 x Female/male jumper wires To connect micro servo to the Pi ADD TO CART 1 x Micro servo motor TJ's arm motor ADD TO CART 1 x 16GB SD card Pre-loaded with NOOBS 2.
© Adafruit Industries https://learn.adafruit.
Prepare Your Pi Start with a working Raspberry Pi with Raspbian or NooBs. You may need to burn the SD card, (https://adafru.it/dDL) then log in (ssh is recommended (https://adafru.it/vbC)) or use an HDMI monitor + keyboard. Then set up WiFi (https://adafru.it/veE)or connect an Ethernet cable for networking so you can connect to the internet I haven't used Raspberry Pi before, where should I start? Raspberry Pi is a small linux computer that we use to connect to Watson and control TJBot's hardware.
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 © Adafruit Industries https://learn.adafruit.
Assemble TJBot Here are two quick videos of how to fold the bot. The detailed folding instructions are available on instructable: Build TJBot out of Cardboard (https://adafru.it/v7E) Once your TJBot is ready, get ready to connect your LED to the Pi Pins. It's very important to make sure you connect the LED to the right pins, otherwise you may damage your LED or the Pi. ALWAYS start with the GND pin. GND is the longest leg of your LED. The LED has a flat side. The GND is the second leg from the flat side.
© Adafruit Industries https://learn.adafruit.
Download the Source Code and Install Dependencies The source code is available at github (https://adafru.it/vZB). Download or clone the code and execute the following commands from a terminal to install its dependencies.. sudo apt-get install git git clone https://github.com/ibmtjbot/tjbot.git (https://adafru.it/veF) cd tjbot/recipes/speech_to_text npm install I haven't used Github before.
Update Your Bluemix Credentials In this step, we help you get API access to the Watson Speech to Text. Let's start with creating a Speech to Text instance on Bluemix (https://adafru.it/v8b)(If you don't have a Bluemix account, follow the instructions (https://adafru.it/v8c) to create a free trial). You may leave the default values and select 'Create'. Almost done! You just need to copy your credentials to the clipboard.
cd tjbot/recipes/speech_to_text cp config.default.js config.js Open config.js file using your favorite text editor and update it with your username and password. What is an API? No worries, it's super easy!! All you need to do it to watch this video. It's one of my favorite videos to explain what an API is! I got my credentials right, but it gives me a weird error! So you've updated the config file and it still doesn't work! No worries.
Run the Code and Speak to TJBot Congradulations! You are almost done! Now it's the time to have some serious fun! Run this command from the terminal: sudo node stt.js You should be able to speak to TJBot and ask him to change the color of the LED. Say "Turn the light blue" to change the light to blue. You can try other colors: yellow, green, orange, purple, magenta, red, blue, aqua, white).
Reboot and confirm no "snd" modules are running by executing the command "lsmod". lsmod I say 'Turn the light yellow' but it hears random words! When you speak with TJBot, it records your voice command (audio) through the microphone and sends it to "Watson Speech to Text" to convert the audio to text. Sometimes, when the environment is noisy, TJBot has a hard time differentiating your voice from the background noise. If you have a better quality microphone, please feel free to use it.