Tedlexa, an IoT stuffed bear.
Enlarge / Alexa, how do I create one thing that mixes AI with a creepy Eighties toy?

Replace, 1/2/21: It is New Yr’s weekend, and Ars workers remains to be having fun with some essential downtime to organize for a brand new yr (and a slew of CES emails, we’re positive). Whereas that occurs, we’re resurfacing some classic Ars tales like this 2017 mission from Ars Editor Emeritus Sean Gallagher, who created generations of nightmare gasoline with solely a nostalgic toy and a few IoT gear. Tedlexa was first born (err, documented in writing) on January 4, 2017, and its story seems unchanged under.

It has been 50 years since Captain Kirk first spoke instructions to an unseen, all-knowing Laptop on Star Trek and never fairly as lengthy since David Bowman was serenaded by HAL 9000’s rendition of “A Bicycle Constructed for Two” in 2001: A House Odyssey. Whereas we have been speaking to our computer systems and different units for years (usually within the type of expletive interjections), we’re solely now starting to scratch the floor of what is doable when voice instructions are linked to synthetic intelligence software program.

In the meantime, we have all the time seemingly fantasized about speaking toys, from Woody and Buzz in Toy Story to that creepy AI teddy bear that tagged together with Haley Joel Osment in Steven Spielberg’s A.I. (Properly, possibly folks aren’t dreaming of that teddy bear.) And ever for the reason that Furby craze, toymakers have been making an attempt to make toys smarter. They’ve even linked them to the cloud—with predictably combined outcomes.

Naturally, I made a decision it was time to push issues ahead. I had an concept to attach a speech-driven AI and the Web of Issues to an animatronic bear—all the higher to stare into the lifeless, sometimes blinking eyes of the Singularity itself with. Women and gents, I offer you Tedlexa: a gutted 1998 mannequin of the Teddy Ruxpin animatronic bear tethered to Amazon’s Alexa Voice Service.

Introducing Tedlexa, the private assistant of your nightmares

I used to be not the primary, by any means, to bridge the hole between animatronic toys and voice interfaces. Brian Kane, an teacher on the Rhode Island College of Design, threw down the gauntlet with a video of Alexa linked to that different servo-animated icon, Billy the Large Mouthed Bass. This Frakenfish was all powered by an Arduino.

I couldn’t let Kane’s hack go unanswered, having beforehand explored the uncanny valley with Bearduino—a {hardware} hacking mission of Portland-based developer/artist Sean Hathaway. With a hardware-hacked bear and Arduino already in hand (plus a Raspberry Pi II and diverse different toys at my disposal), I set off to create the final word speaking teddy bear.

To our future robo-overlords: please, forgive me.

His grasp’s voice

Amazon is one in all a pack of corporations vying to attach voice instructions to the huge computing energy of “the cloud” and the ever-growing Web of (Client) Issues. Microsoft, Apple, Google, and plenty of different contenders have sought to attach voice interfaces of their units to an exponentially increasing variety of cloud companies, which in flip may be tethered to residence automation techniques and different “cyberphysical” techniques.

Whereas Microsoft’s Challenge Oxford companies have remained largely experimental and Apple’s Siri stays sure to Apple {hardware}, Amazon and Google have rushed headlong right into a battle to turn into the voice service incumbent. As advertisements for Amazon’s Echo and Google Dwelling have saturated broadcast and cable tv, the 2 corporations have concurrently began to open the related software program companies as much as others.

I selected Alexa as a place to begin for our descent into IoT hell for plenty of causes. One in every of them is that Amazon lets different builders construct “abilities” for Alexa that customers can select from a market, like cell apps. These abilities decide how Alexa interprets sure voice instructions, and they are often constructed on Amazon’s Lambda utility platform or hosted by the builders themselves on their very own server. (Relaxation assured, I’m going to be performing some future work with abilities.) One other focal point is that Amazon has been pretty aggressive about getting builders to construct Alexa into their very own devices—together with {hardware} hackers. Amazon has additionally launched its personal demonstration model of an Alexa shopper for plenty of platforms, together with the Raspberry Pi.

AVS, or Alexa Voice Providers, requires a reasonably small computing footprint on the person’s finish.  All the voice recognition and synthesis of voice responses occurs in Amazon’s cloud; the shopper merely listens for instructions, data them, and forwards them as an HTTP POST request carrying an JavaScript Object Notation (JSON) object to AVS’ Internet-based interfaces. The voice responses are despatched as audio recordsdata to be performed by the shopper, wrapped in a returned JSON object. Typically, they embrace a hand-off for streamed audio to a neighborhood audio participant, as with AVS’s “Flash Briefing” characteristic (and music streaming—however that is solely out there on business AVS merchandise proper now).

Earlier than I may construct something with Alexa on a Raspberry Pi, I wanted to create a mission profile on Amazon’s developer website. Whenever you create an AVS mission on the positioning, it creates a set of credentials and shared encryption keys used to configure no matter software program you employ to entry the service.

As soon as you’ve got acquired the AVS shopper working, it must be configured with a Login With Amazon (LWA) token via its personal setup Internet web page—giving it entry to Amazon’s companies (and probably, to Amazon fee processing). So, in essence, I might be making a Teddy Ruxpin with entry to my bank card. This shall be a subject for some future safety analysis on IoT on my half.

Amazon presents builders a pattern Alexa shopper to get began, together with one implementation that may run on Raspbian, the Raspberry Pi implementation of Debian Linux. Nonetheless, the official demo shopper is written largely in Java. Regardless of, or maybe due to, my previous Java expertise, I used to be leery of making an attempt to do any interconnection between the pattern code and the Arduino-driven bear. So far as I may decide, I had two doable programs of motion:

  • A hardware-focused strategy that used the audio stream from Alexa to drive the animation of the bear.
  • Discovering a extra accessible shopper or writing my very own, ideally in an accessible language like Python, that would drive the Arduino with serial instructions.

Naturally, being a software-focused man and having already finished a big quantity of software program work with Arduino, I selected…the {hardware} route. Hoping to beat my lack of expertise with electronics with a mixture of Web searches and uncooked enthusiasm, I grabbed my soldering iron.

Plan A: Audio in, servo out

My plan was to make use of a splitter cable for the Raspberry Pi’s audio and to run the audio each to a speaker and to the Arduino. The audio sign can be learn as analog enter by the Arduino, and I might one way or the other convert the adjustments in quantity within the sign into values that will in flip be transformed to digital output to the servo within the bear’s head. The magnificence of this resolution was that I might be capable to use the animated robo-bear with any audio supply—resulting in hours of leisure worth.

It seems that is the strategy Kane took together with his Bass-lexa. In a telephone dialog, he revealed for the primary time how he pulled off his speaking fish for instance of fast prototyping for his college students at RISD. “It is all about making it as shortly as doable so folks can expertise it,” he defined. “In any other case, you find yourself with an enormous mission that does not get into folks’s palms till it is nearly finished.”

So, Kane’s rapid-prototyping resolution: connecting an audio sensor bodily duct-taped to an Amazon Echo to an Arduino controlling the motors driving the fish.

Kane texted me this photo of his prototype—audio sensor and breadboard taped atop an Amazon Echo.
Enlarge / Kane texted me this photograph of his prototype—audio sensor and breadboard taped atop an Amazon Echo.

Brian Kane

After all, I knew none of this once I started my mission. I additionally did not have an Echo or a $4 audio sensor. As a substitute, I used to be stumbling across the Web searching for methods to hotwire the audio jack of my Raspberry Pi into the Arduino.

I knew that audio indicators are alternating present, forming a waveform that drives headphones and audio system. The analog pins on the Arduino can solely learn constructive direct present voltages, nevertheless, so in principle the negative-value peaks within the waves can be learn with a worth of zero.

I used to be given false hope by an Instructable I discovered that moved a servo arm in time with music—just by soldering a 1,000 ohm resistor to the bottom of the audio cable. After trying on the Instructable, I began to doubt its sanity a bit whilst I moved boldly ahead.

Whereas I noticed knowledge from the audio cable streaming in by way of check code working on the Arduino, it was largely zeros. So after taking a while to overview another tasks, I spotted that the resistor was damping down the sign a lot it was barely registering in any respect. This turned out to be a very good factor—doing a direct patch based mostly on the strategy the Instructable introduced would have put 5 volts or extra into the Arduino’s analog enter (greater than double its most).

Getting the Arduino-only strategy to work would imply making an additional run to a different electronics provide retailer. Sadly, I found my go-to, Baynesville Electronics, was within the final phases of its Going Out of Enterprise Sale and was working low on inventory. However I pushed ahead, needing to acquire the parts to construct an amplifier with a DC offset to transform the audio sign into one thing I may work with.

It was once I began purchasing for oscilloscopes that I spotted I had ventured into the improper bear den. Thankfully, there was a software program reply ready within the wings for me—a GitHub mission referred to as AlexaPi.

LEAVE A REPLY

Please enter your comment!
Please enter your name here