Follow us on @mbedmicro
mbed @ ESC UK
NXP invited us to be on their stand at ESC Boston, so we put together a demo. It was such a hit that it's back for ESC UK!
Big Mouth Billy Bass gets on Twitter (Live!)
Twitter @mbedmicro, and Twittering Billy might read it!
Make sure your sound is turned on! Note: Twitter servers take a while to update, so be patient. It could take over a minute for Billy to see it. If it is out of show hours, check out the videos!
Also note that billy works on a "last come - only served" basis. So only the last tweet in a 30 second window will be spoken.
Check out what billy has twittered in the past here.
Billy gets a Brain Transplant, or, a bit of background
Big Mouth Billy Bass was feeling a little unloved. So Steve, one of our mbed beta testers, decided to teach him some new tricks. He transplanted Billy with an mbed Microcontroller and an SD card, and he got a new lease of life! He played a selection of much more entertaining .wav files, along with some good moves. Mmmm, forbidden doughnuts!
Billy was a hit, but we thought he deserved more. So last week we decided to tweak him a little. We added an ethernet connection and taught him to watch on twitter for mentions of @mbedmicro, and say what he sees!
If Billy is sleeping right now, check out some of his earlier videos:
How it Works
The Twittering Billy hack replaces his existing brain with an mbed Microcontroller, wiring it up to his motors so we have control of his movements, an SD card so he can store lots of audio files, and the mbed's Ethernet interface to the internet. What might be surprising is that Billy is not connected to a PC; everything is being done by the mbed Microcontroller and a connection to the internet!
How it works
Fishing for twitters...
The mbed's first job is to fetch a web page we've set up, which tells him whether there is anything on twitter. He uses the mbed's HTTPClient library so basically does:
// Set up a http client using the ethernet interface HTTPClient http; // fetch a url, and store the result http.get("http://billy-server.com/any-twitters.php", result);Billy just keeps checking this, forever. Until the result tells him there is a new twitter!
Once there is a twitter, he then asks the web server to translate that twitter to a voice, and return it as an audio file. The code is something like:
// Open a file on the SD card to store the audio FILE *fp = fopen("/sd/voice.wav", "w"); // Fetch the voice, and store it in the file http.get("http://billy-server.com/twitter-2-audio.php?id=ID", fp);The web server uses the iSpeech web API to convert the tweet to audio, then just returns a .wav file when Billy requests it. We also generate a movement file to tell bill how to move.
Now Billy has his audio and his movement commands on the SD card, he plays it out the mbed analog output to a speaker. At the same time, he flaps his tail and moves his mouth whenever the movement file tells him he should. And fun is had by all!
The hardware setup required is relatively simple.
- An mbed Microcontroller and Billy Bass!
- Some of the PwmOut pins connected to the motors within Billy.
- The Ethernet interface connected to the internet via a RJ45 cable/socket
- The button on the front of Billy connected to a DigitalIn
- A speaker connected to the mbed AnalogOut
- An SD Card connected to the mbed SPI interface
- HTTPClient - Checks twitter status and downloads sound files
- WavePlayer - Lets Billy play the downloaded sound file via AnalogOut
- Ethernet with IP - puts an mbed on the internet
- Local FileSystem - stores the sound files on Billy
- PwmOut - controls Billy's motors
- DigitalIn - connected to the red button on Billy
- AnalogOut - provides Billy's voice
- Ticker - provides timing signals
- Timer - allows us to schedule Billy's twitter checks
Top of the list has to be Steve Ravet for his original Big Mouth Billy Bass hack. Brilliant! We'd also like to especially thank...