Today’s guest post is from Joel Evans from Mobiquity, a professional services firm trusted by hundreds of leading brands to create compelling digital engagements for customers across all channels. Joel writes about how Mobiquity built a portable voice controlled drone for under $500 using Amazon Alexa.
As Mobiquity’s innovation evangelist, I regularly give presentations and tech sessions for clients and at tradeshows on emerging technology and how to integrate it into a company’s offerings. I usually show off live demos and videos of emerging tech during these presentations, and one video, in particular, features a flying drone controlled via Alexa. Obviously, a flying object commanded by voice is an attention getter, so this led me to thinking that maybe I could do a live demo of the drone actually flying.
While there have been a number of articles that detail how to build your own voice-controlled drone, the challenge remains the same: how do you make it mobile since most solutions require you to be tethered to a home network.
I posed the challenge of building a portable voice-controlled drone to our resident drone expert and head of architecture, Dom Profico. Dom has been playing with drones since they were called Unmanned Arial Vehicles (UAVs) and has a knack for making things talk to each other, even when they aren’t designed to do so.
Dom accepted my challenge and even upped the ante. He was convinced he could build the portable drone and accomplish the task for under $500. To make the magic happen, he chose to use a Raspberry Pi 2 as the main device, a Bebop Drone, and an Amazon Echo Dot.
Here’s his breakdown of equipment required:
Overall, these supplies can total around $400, with the drone costing between $250 and $280, the Pi kit and extra Wi-Fi adapter coming in around $70, and an Echo Dot for $50. For Dom, this meant mission accomplished, assuming he could actually fly the drone using voice.
As Dom got started, the seemingly simple challenge, was actually a few combined challenges, including:
Thankfully, Dom met and exceeded these challenges, as you’ll see below, using AWS services to really streamline the project.
On the Raspberry Pi, Dom used the open source node.JS library, node-bebop to control the Bebop drone. He initially built the library to include a limited set of commands: take off and land. He also used two network cards to create two separate networks:
On the Raspberry Pi itself, he ran two applications:
He then used the Echo Dot for voice input by creating a skill and a Lambda Function. And he rounded out the solution by using AWS SQS to create a queue of messages that the Pi could poll and the drone could react to.
As for the challenge of making a computer without a screen that is easily configured, Dom drew inspiration from the Amazon Echo itself. Knowing that you have very little visual confirmation, other than the status ring on the device, Dom chose to show the user that the drone and all assorted connections are “ready to fly” by spinning the drone’s rotators on startup as visual confirmation. This cue indicated that the solution was connecting end-to-end.
The network challenge proved a bit more difficult since the connection to the internet could vary, based on location. For that, Dom created two different network states, with variations on the hotspot state. Depending on the network state, at certain times you want the Pi to be a hotspot so that you can connect to it and configure the known networks. In normal operations, you want the Pi to connect to two different networks. Dom achieved this by using SystemD to manage what processes were started to connect to different networks.
Altogether, there ended up being four different Pi boot scenarios to account for:
If the Pi finds itself in any of the first three states, it will launch a hotspot, “DroneConfigNet,” to which you can connect via a laptop or phone. From there, you can configure the public network and your drone’s private network.
If the Pi finds itself in state four, it will start the Drone Pilot Control software, which listens for a command from Alexa (via Lambda and SQS). As previously stated, to confirm it has successfully connected to both the internet AND the drone, all four propellers on the drone will quickly spin and stop.
Once the app is properly configured, you power up the drone, power up the Pi, and then configure the networks. Once connected to both networks (drone and internet), the drone does a propeller spin, and the Pi waits and polls the SQS queue - the Pi is running a node.js app that is broken into both a queue monitor and the drone command software.
To get the drone to fly, you invoke the skill, which connects to a Lambda function. The function takes the intents and maps them to a predefined command set. Version one supports takeoff, land, rotate left, and rotate right. Then the command is queued into the SQS queue. The Pi does a long poll (makes a connection to SQS and waits 15 seconds, then reconnects and waits again). When it receives a command, it issues that command to the Drone Pilot Control software, which then gets the drone to respond by either taking off, landing, rotating left, or rotating right.
It sounds complicated but an example of the end result is:
“Alexa, tell drone to take off” - and the drone takes off!
So, in the end, Dom met the challenge and built a voice-enabled drone. But just as he wanted to make the original challenge more difficult by limiting his budget, he thinks he can make the drone even better and has several enhancements queued up for the future, including:
If you are interested in learning how to build your own skills for Alexa, attend the next Virtual Skill Building Workshop hosted by the Amazon Alexa Team on October 26 at 9 a.m. PT.
Are you ready to build your first (or next) Alexa skill? Build a custom skill or use one of our easy tutorials to get started quickly.
Share other innovative ways you’re using Alexa in your life. Tweet us @alexadevs with hashtag #AlexaDevStory.