What is this Project About?
- Connect the Intel Edison to WiFi, and connect Bluetooth speakers.
- Type English into a web server to input text.
- That text file is then sent to Google translate to convert the English into whichever language you have selected. Returns a text file.
- That text is received by Edison and then converted from text to speech using Espeak.
- The audio file is then return to Edison to be played out of the Bluetooth Speakers.
This is a great project to start off with, if you are new to the Intel Edison. You will learn the following basics from this tutorial:
- How to name your Edison, put a password on it, and set up WiFi.
- How to make your Bluetooth Speaker the default sink device.
- Uploading npm modules
- Managing and modifying the opkg packages
- Building the hardware
- Uploading code using Intel XDK
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Edison Setup
In order to setup your Edison (which will allow you to name your Edison, put a password on it, and connect to the WiFi), type in the following commands in PuTTY:
It is pretty straightforward to set your name, password, and connect to the WiFi.
You need to have a password in order to SSH to your Edison from the Intel XDK later on. You also need to be connected to WiFi so you can access the web server, and so your Edison can access the Google Translate APIs.
If you wish to do each step separately, you can do so using the following commands:
You will need to note down the IP address of your Edison. If you ever forget it, you can simply type in:
Congratulations! You are now ready to SSH to your Edison.
Step 2: Making Sure Your Edison Has the Latest Image
Make sure your Edison is flashed with the latest Yokto image. If you have not already done this, please use the information in this link. This link will also teach you how to run PUTTY, which is needed to set up your Edison. Here are some useful commands for checking whether your Edison has the latest image:
**Note: These commands will only work if you have already flashed your Edison. You will also need to be connected to WiFi in order for your edison to know what the latest version is.
You can then compare the two outputs. If they match, you have the latest image. If they do not match and you are connected to WiFi, you can easily update your image using the following command:
**Note: You still must be connected to WiFi in order to upgrade your firmware using this command
Once you are sure you have the latest image, proceed to the next step.
Step 3: Connecting Via Bluetooth
Connecting to your speaker
To connect to your Bluetooth speakers, turn them on and make sure they're discoverable. Then type the following commands in PuTTY:
rfkill unblock bluetooth
Look for your Bluetooth device. It should be a string of numbers and letters with colon signs. The example we will use is 11:75:58:F9:79:93. Once you have found it, turn scan off with this command:
You can then connect to your device. If this is your first time connecting to this device, you should pair and trust it. This will make it easier and faster to connect to your device in the future.
Your Edison is now connected to your Bluetooth speaker.
To exit bluetooth, just type quit.
Making your speaker the default device
To make your speaker the default audio sink device, you will first need to list all the possible devices.
pactl list | grep Name
You will see a bunch of different names come up. Look till you find one that is similar to this, but with your distinct Bluetooth ID (same as what was used above). I will use the example of bluez_sink.11_75_58_F9_79_93. To make this device the default sink, type the following command:
pactl set-default-sink bluez_sink.11_75_58_F9_79_93
To test whether you have succeeded in making your Bluetooth device the default sink, you can test it by trying to play a file. Use WinSCP to send a file over to your Edison. If you don't know what WinSCP is, refer to this instructable. Keep in mind which folder you put it in, because in order to play it, you must cd to that specific folder.
We will use a similar command in our main Babel Fish code to play the translated text file.
Typing in this command should play your sound file for testing purpose (example "punk.wav"):
gst-launch-1.0 filesrc location=punk.wav ! wavparse ! pulsesink
Step 4: Installing Npm Modules
Install the following npm modules onto your edison by entering the command npm install followed by the module name. For example:
npm install cylon
**Note: Make sure you're connected to WiFi!
Install the following modules in a similar manner:
Step 5: Espeak
To make Espeak work, you don't just need the npm module.
We also need to add additional repos by editing the base-feeds.conf file using vi.
Hit 'i' to edit the file and paste the following lines. Once you have pasted the lines, hit , then ':wq' to save and exit.
src/gz all <a href="http://repo.opkg.net/edison/repo/all" rel="nofollow"> http://repo.opkg.net/edison/repo/all</a><br>src/gz edison <a href="http://repo.opkg.net/edison/repo/all" rel="nofollow"> http://repo.opkg.net/edison/repo/all</a> src/gz core2-32 <a href="http://repo.opkg.net/edison/repo/all" rel="nofollow"> http://repo.opkg.net/edison/repo/all </a>
Install espeak using the following commands:
sudo opkg install http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base/libportaudio2_v19+svnr1387-r0.6_armv7a.ipk
sudo opkg install http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base/espeak_1.37-r0.5_armv7a.ipk
Step 6: Wiring Up the Hardware and Building the Case
Things you'll need:
From the Grove Starter Kit, you'll need:
- Base Shield
- LCD display
- Carefully place the base shield onto the Arduino Breakout Board (with Intel Edison already correctly installed)
- Connect the sensors to the shield
- LCD to I2C
- Servo to D3
- Red button (changes the language) to D2
- Yellow button (changes colour of LCD screen) to D6
- Green button (translates text) to D5
- Connect power adapter to the power port (Make sure switch is pushed towards the big USB port
- Note: you do not need the serial micro-USB connected because you are connected to WiFi
You can pretty much build any case you want. I used a laser cutter to cut acrylic pieces and put them on a wooden base. However, this was made for display purposes. If you want something more functional, you can size it down. You don't technically need the buttons, servo, or the screen. You can also change the code to receive speech instead of text from the web server. This can be done using the google speech to text API. I'm sure there are other APIs you can use, but I haven't figured them out. This would allow you to plug in either a USB headset or use a Bluetooth headset to input speech.
Step 7: Intel XDK
Download Intel XDK
Using this link, download the Intel XDK.
You will need to create an account.
There are various guides online about getting started with the Intel XDK, if you want any further information.
Start a new project
Start a new Intel XDK project. Use a template from "Internet of Things Embedded Application". Not from the "HTML5 Companion Hybrid Mobile or Web APP" section. I recommend just using the template for "OnBoard LED blink".
After you have created your new project, follow this link to GitHub to get the code.
In your Intel XDK project, replace everything from the main.js file with the code in GitHub for main.js. Do the same for package.json.
Next, create a new file called lcd_text_helper.js and copy the code from lcd_text_helper.js in GitHub.
Do the same for index.html.
Sending code to Intel Edison via WiFi
On your Intel XDK, at the bottom there will be an option to select an IoT device. Your device should be visible on the drop down menu. Click your device, input your username (root) and password to connect your device. If your device is not visible, manually connect using your Edison's IP address (if you don't know it, type "configure_edison --showWiFiIP" in PuTTY).
You can then upload your code.
Accessing the web server to input text and change language
Input the IP address of your Edison and type ":3000" for the port in an internet browser on your phone or laptop. You can then input any text you want on that page, and select the language.