RoboSapien Whips Nae Nae

Hardware components:
R8326274 01
Raspberry Pi 2 Model B
× 1
RoboSapien X
× 1
Echo
Amazon Alexa Amazon Echo
× 1
Software apps and online services:
Ha 2up iot
Amazon Web Services AWS IoT
Screen%20shot%202015 07 20%20at%206.10.26%20pm
Amazon Web Services AWS Lambda
Dp image kit 02
Amazon Alexa Alexa Skills Kit
Logo cylon 2x
CylonJS Cylon.js

RoboSapien Whips Nae Nae

STORY

I wanted to add voice control to RoboSapien. At first, I was thinking, just create an app on the phone, but that’s been done before! Then I saw the Amazon IOT Challenge. How about make an IOT Robosapien. The next generation – Internet of Toys! Connect RoboSapien to the Internet. That would be Awesome, don’t you think?

That’s what I did; I started looking into the Amazon IOT service, try their sample apps. Very interesting indeed. I like the way they presented the diagram. Here’s what I want to do…. Replace RGB controller with Amazon Echo, Replace the LightBulb with RoboSapien… Amazon Echo sends the command, RoboSapien follows. That’s it.

Amazon Echo … echo … echo ..

Last year, I started looking at Amazon Echo. I got one because I attended a hackathon and worked on an Amazon Echo. It was my first introduction to the AWS Lambda, and I was hooked. I like the idea where I can focus on my code and not the infrastructure.

AWS iot of RoboSapien Whips Nae Nae

WowWee RoboSapien

I’ve always liked the RoboSapien, I’m amazed on it’s engineering and it’s capabilities. Last year also, I started to research how to expand it’s capabilities. I have RoboSapien X which doesn’t have any bluetooth capabilities. It communicates through it’s IR Remote but they gave you this dongle to connect it to your phone so you can use the app. I found out that there’s a way to control the robot by playing WAV files. I saw it on WowWeeLabs github page. Here’s the link

https://github.com/WowWeeLabs/RoboRemote-IR-Dongle-SDK

So I downloaded the WAV files and started playing it on my phone connected with IR Dongle to audio jack. The RoboSapien is ALIVE!

That brings me to an idea. What if I can connect it to a Raspberry Pi? Raspberry Pi has Audio jack, then I can attach it to the back of the RoboSapien. That’s great news! No more heart bypass operation for the poor Robot. No soldering!

At first, I tried running the example on my laptop. I opened two shell window, one is acting as mobile app (value updater), the other acting as a device (update receiver)

it worked! Send update RGB colors from one window, the other receives the updates.

Now I tried it on the Raspberry Pi with a Wifi connection.

It also worked!

The idea is, instead of RGB colors, how about send COMMANDS like Walk, High Five, Dance, etc… etc…

Then once the Command is received from Amazon IOT thru the “delta” event, play the correct WAV files.

Playing WAV files on Raspberry Pi in NodeJS.

I am new to NodeJS, I was able to update node on my raspberry pi with this link.

https://github.com/rwaldron/johnny-five/wiki/Getting-started-with-Raspberry-Pi-node-red-and-IoT

I looked at some npm packages to play WAV files on raspberry pi, I am familiar with CylonJS. So I followed instructions on how to install CylonJS audio module.

http://cylonjs.com/documentation/platforms/audio/

 sudo apt-get install mpg123

you have to install mpg123. CylonJS-Audio only plays mp3, so I had to convert all the WAV files to MP3. I used Lame

sudo apt-get install lame

to convert all mp3, I used this command.

for f in *.wav; do lame -V 1 "$f" "${f%.wav}.mp3"; done

Here’s the sample code on how I played MP3 in NodeJS


var Cylon = require('cylon');

Cylon.robot({
  connections: {
    audio: { adaptor: 'audio' }
  },

  devices: {
    audio: { driver: 'audio' }
  },

  work: function(my) {
    my.audio.on('playing', function(song){
      console.log('Playing this nice tune: "' + song + '"');
    });

    // You can pass a string with a full or relative path here,
    my.audio.play('./RoboSapien/43_highfive.mp3');
  }
}).start();

Read More :RoboSapien Whips Nae Nae

Scroll to Top