Archive for March, 2013
Back in July 2012, I saw a post on Dangerous Prototypes that highlighted EMIC-2, a new board available from Parallax that was designed by Joe Grand of Grand Idea Studios. EMIC-2 is a speech to text module, that allows you to add speech output to microcontroller projects – well actually, anything that has a serial UART – and it’s as simple as sending it the text that you want it to say, and it speaks !
I was really interested by this – not for any particular project I had in mind, but just in a general sense. It however was going to be yet another project to go on the long long list….. But being the way I am, I checked online and saw that the EMIC-2 module was out of stock – wow, first run batch sold out very quick, so I guess I can ignore that for a while
Anyway I was listening to a podcast in the car one day (Gadget Gangsters – now seemingly gone the way of the dodo) and they mentioned Joe Grand and the light went on again. When I got home I checked the web, and found that the EMIC-2 was in stock – so I went and ordered one. Of course, the next day I get an email saying that they had no stock and my order would be a few weeks before it’d be able to be delivered – so the project really went to the bottom of the list.
Eventually I get a parcel note at the post office, and on collection it turns out it’s my EMIC-2 – so of course, all other projects go on hold and the EMIC-2 takes pride of place on the “most current project board”, i.e. the centre of the desk.
Starting to talk to EMIC-2 was pretty much a snap. As a UART device, I find the simplest way to avoid any mishaps or unknowns is to use a USB to serial module and a terminal program – connect the UART device to the USB–>Serial and start typing. So out comes my cheap-as CP-2102 USB adapter (under $3 each on eBay, buy a few!) and connect it up. Yes, as usual, I suffered UART Dyslexia so a quick switch of the wires and I was able to press Enter on the PC and see a response in the terminal program
Now, onto *really* talking to this device. It has a pretty simple protocol, as the datasheet describes. All commands take a single character as the command, followed by more characters for the command parameters. So for example, to set the volume you simply send a “V” and the number you want to set the volume to, so a real command would be “V10” to set the volume to 10. So in the terminal window I just type V10 and press enter, and the module should return “:” sans quotations to confirm the command. Then, to make it say something I had better get the audio out connected up !
Here’s where I hit my first snag. The module has two speaker connectors; one is two pins on the set of header pins which are for the + and – connections of a speaker, and one that is a barrel connector for a headphone jack. I plugged in a set of earbud headphones into the existing barrel connector, and told the module to play it’s demonstration message (Command: D0) but nothing happens ! I see the LED turn red while it’s speaking, the terminal come back with the : prompt once it’s done, but no sound. I tried a few different pairs of earbud headphones, as well as a hand-made connection to a stereo plug from jaycar and a little 8ohm speaker, but nothing worked. So I asked around on the Parallax forums and eventually figured out that if I connected to the SP+ and SP- pins on the header the sound worked fine, so the barrel connector was crook. I let Parallax know and they’re great, they dispatched a new module, although again there was going to be a bit of a wait because they were out of stock (man, they’re obviously popular!).
What I really wanted for this module was a Gadgeteer module, so my TinyCLR.com friends could plug it into a Gadgeteer mainboard. So out comes Eagle….. a few days later, out pops a design I was happy enough with, and I send it off to be made at OSHPark, the evolution of Laen’s Dorkbot PDX PCB manufacturing runs. The board as originally designed (it has been refined since) was 25mm x 25mm, and for a set of three boards the price was under US$5, plus the usual postage costs to AU.
While the boards are being made and posted back, and the replacement module is coming from backorder and being posted back, I set about making a pseudo driver for the device. Being great with ideas, less so with code, I cobbled something together that worked for most of what I wanted – it doesn’t have any of the character set mapping that the dectalk parser is more in need of, but generally it’s not too bad to just get the module to do the core thing it does – take text input and turn it into speech.
Eventually my OSHPark Gadgeteer adapter boards arrive back – looks pretty in purple !
One good thing about a proper board like this is you can choose what direction you want the EMIC-2 board to sit atop the Gadgeteer adapter – if you swap the side the female 0.1” connector goes on, you can have it either overlapping the whole adapter board, or you can have it extending past the board boundaries where it’s easier to get to the Gadgeteer connector. I chose the latter to solder mine up. Based on my last experience with hand soldering Gadgeteer headers, the footprint I was using was expanded so the pads were much longer, which was so much easier to solder onto – yay !
So then, the last thing to do is to plug the EMIC-2 module in and wire up my speakers to the screw-down terminals, connect up a mainboard and write a demo of it’s features for you all to enjoy.
Well ok, so I did most of that way back when, and actually I was testing it on a Panda – then I did some other things…. But someone recently dug up the old chatter on the forum about this module so I *finished* doing what I was going to do, and now have published it.
<cue drumroll> ta da.
I’ve put a little bit more effort into the “driver”, but not into code comments I’ve also put some effort into the demo app, moving it up to the SDK 4.2 from Panda days. You’ll find the driver code published on the tinyCLR codeshare here (edited for new URL). You’ll find the usage example there too.
Above is the video where you can hear the module at work. Sorry it’s a bit long (and boring) but it shows off a few features like the many voices the board supports.
Code comments and suggestions best left on the tinyCLR forum; see you over there soon !
PS: The replacement EMIC 2 module arrived from Parallax not that long after the OSHPark boards arrived. Plugged it into my test rig (aka USB to serial adapter) and connected up my headphones, and it worked first time. So the headphone socket on the original board was what was dodgy. I hit it with the soldering iron once I had a working one, and lo-and-behold, I made it work. Double bonus! I gave it to a friend, and I hear it’s now used as the evil voice in a robot Too Cool !!