In this tutorial I will show how to combine the abilities Amazon Alexa with the amazing Ohbot,robot head (http://www.ohbot.co.uk/?lang=en)
In a conversation with Alexa, the Ohbot's lips appear to move in sync with the replies from Alexa.
Alexa-Pi is a client for Amazon's Alexa service. It is intended and tested to run on a wide range of platforms, such as Raspberry Pi. The installation instructions can be found here: https://github.com/alexa-pi/AlexaPi/wiki/Installation
You might like to view this video, which helped me, on setting up Alexa on a Raspberry Pi: https://www.youtube.com/watch?v=frH9HaQTFL8
What you will need:
1. An Ohbot, robot head.
2. A power supply for the Ohbot Arduino. I used a 9v battery with a 2.1mm plug for the Arduino breakout board at base of head.
3. An Arduino Uno, nano or pro-mini - most types should work.
4. A power supply for the Arduino Uno. I used a spare USB port from Raspberry Pi.
5. A Raspberry Pi (all models with an audio output jack should work), with an SD card loaded with the latest linux release. (I used Raspbian Jessie Pixel: https://www.raspberrypi.org/blog/introducing-pixel/)
6. A USB microphone, I found one here: http://www.ebay.co.uk/itm/Super-Mini-USB-2-0-Microphone-MIC-Audio-Adapter-for-PC-Notebook-Laptop-UK-/192039338258
7. A mini breadboard or vero board.
8. 1 x 100 nanofarad capacitor
9. 2 x 100k Ohm resistors
10. A 3.5mm headphone plug (I re-used one from some broken earbuds)
11. A 3.5mm headphone jack
12. Some wires and headers to connect it all up
Step 1: Build Instructions
1. Install Alexa-Pi on Raspberry Pi. (https://github.com/alexa-pi/AlexaPi/wiki/Installation). Once installed and running, check that Alexa says 'Hello', then shutdown the Pi until step 10 below.
2. Construct a Analog to Digital listener circuit - see attached circuit diagram. This, rather crudely, converts the analog signal from the headphone jack to a digital one the Arduino Uno can process. The audio signal is also passed straight through to an output jack so that you can plug in your headphones or an amplifier and loudspeaker.
3. Download and unzip the Ohbot_Alexa.zip file and upload Ohbot_Alexa.ino to the Arduino Uno. This code contains some references to ug8lib, because I was using an OLED display for debugging - this part of the code is not required and can be commented-out.
4. Add all the connections as per the Fritzing diagram. The Arduino Uno to Ohbot Arduino connection is serial at 19200 baud, using just 3 wires, GND, TX and RX. The RX on one end goes to the TX of the other and vice-versa. The junction of the capacitor and the two resistors goes to the Arduino Uno's A0 pin. The breadboard or vero board is supplied with +5v and GND from the Arduinio Uno. The other side of the capacitor is fed from either the left or right channel from the audio output from the Raspberry Pi. All GNDs are connected together.
5. Plug in the 3.5mm plug into the Pi audio jack
6. Plug in your headphones into the 3.5mm jack from the breadboard or vero board. Better still use a amplifier and loudspeakers, and mount them behind the Ohbot.
7. Plug in the power to the Ohbot.
8. Connect the Raspberry Pi to the internet via a WiFi dongle or the Ethernet socket
9. Plug in the USB cable from the Arduino Uno to a spare USB socket on the Pi.
10. Power-up the Raspberry Pi.
11. Press the reset button on the Arduino break-out board at the base of the Ohbot. This will initialise the Ohbot software and trigger the Arduino Uno's script to be ready.
12. Start Alexa Pi on the Raspberry Pi and when Alexa says 'Hello', the Ohbot's lips should move.
13. If the Ohbot's lips do not move, check your wiring and press the reset button on the Arduino Uno, then the reset button the Arduino break-out board at the base of the Ohbot.
A video of this setup working can be found on YouTube here: https://www.youtube.com/watch?v=nr1kEribFGU