In this tutorial, I will show you how to control a DJI Tello drone using only your voice. The drone works with Amazon's Alexa voice assistant to respond to voice-prompted commands.
First StepYou need to create a new Voice Skill at https://developer.amazon.com/alexa/console/ask
The Skill Invocation Name is "drone:"
In the JSON Editor Section, drag and drop the file “alexa.json” you find in my GitHub repository:
In the Endpoint Section, put the post call to your Node-RED (ex. https://mysite.com/drone):
I put my Node-RED in a EC2 AWS instance but you can have Node-RED wherever you want. You need also to install a SSL Certificate to enable HTTPS and a MQTT message broker: I use https://www.cloudmqtt.com/
In Node-RED search "Import – Clipboard" and cut & paste the contents of “node-red.txt” you find in my GitHub:
Now all that's needed is to configure the MQTT broker with your credentials.
The start of Node-RED flow is the Endpoint of the Alexa Skill:
On RPi install Node.js:
sudo apt-get update
sudo apt-get dist-upgrade
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
then type:
mkdir drone
cd drone
npm install mqtt --save
npm install request --save
then copy in this directory “drone.js” you find in GitHub.
In the file “drone.js” you must insert your MQTT credentials:
var MQTT_username = "<YOUR USERNAME>";
var MQTT_password = "<YOUR PASSWORD>";
var MQTT_host ="wss://m10.cloudmqtt.com:XXXXX";
The RPi is connected simultaneously with two networks: Internet and Tello WiFi:
The protocol to send commands to the drone uses UDP packets in a specific binary format.
Start to Fly- The Tello drone is powered up
- Alexa is powered up and is connected to your WiFi Network
- RPi is powered up and is connected to Tello WiFi Network & your Ethernet Network
- RPi is running “node drone.js” program. You can set this to auto start or you can just ssh into the RPi and run it
- Say “Alexa, ask drone to take off." You should see your Tello to take off
You can find all the code at my GitHub.
Comments