Voice Command Controlled Drone

130
 

efy tested sani theoWith path-breaking progress in UAV technology, drones are now being readily adopted and deployed for several uses. But despite the advancement, many physically challenged people are unable to operate them due to certain limitations in maintaining drone stability in the air. Now they too can fly a drone with the help of voice commands. And the best part is that the voice commands can be given in English or any other language.

For this fascinating project, the author used Raspberry Pi with AIY Voice Bonnet as a ground control station (GCS). You can build the GCS with any Linux PC as well. This GCS (or PC) uses voice commands to control the Tello drone. Once the drone system recognises the voice command, a connection is established with which the drone can be controlled.

Tello drone used by the author is shown in Fig. 1. The AIY Voice Bonnet mounted on top of the Raspberry Pi board is shown in Fig. 2.

Tello drone
Fig. 1: Tello drone
AIY Voice Bonnet attached to Raspberry Pi
Fig. 2: AIY Voice Bonnet attached to Raspberry Pi

Prerequisite

Use of Raspbian based Raspberry Pi is recommended as it is portable, small, and can be easily used for controlling the drone. Install the following modules:

  • Speech_recoginition
  • PyAudio
  • TelloPython

The Speech_recognition and PyAudio modules help capture the voice and recognise the voice commands. TelloPython is used for establishing connection with the Tello drone. It also allows drone control and video capture.

TelloPython facilitates the following functions:

  • Drone takeoff using drone.takeoff( )
  • Drone navigation in the forward direction using drone.forward(cm)
  • Rotating the drone to 90 degrees in clockwise or anti-clockwise direction using drone.cw(90)
  • Forward, backward, left or right mid-air flips using drone.flip(‘l’)
  • Live stream a video from the drone camera to the PC using drone.streamon( )
  • Land the drone using drone.land( )

Coding

The AIY Voice Bonnet with speech recognition module allows capture and recognition of voice commands. To enable it, you need to import two associated libraries in the Python code (dronevoicecontrol.py). To control the drone, import the TelloPython library in the code shown in Fig. 3.

Python code
Fig. 3: Python code

After doing all of the above, create a while loop, which will run continuously until stopped. This while loop assists in checking that when the bonnet button is pressed, the voice command gets processed.

To execute an action according to the command given by the user, create several if conditions. So, suppose the user wishes the drone to start flying. By giving voice command, say “take off,” the request is matched with the if condition. If it matches the action set in the code, a signal is sent to the Tello drone to start flying.

Similarly, you can set all other functions in the code given here to command the drone to do the corresponding actions, such as move up, down, right, left, forward, etc.

Testing

Connect the AIY Voice Bonnet to Raspberry Pi board. Then connect Raspberry Pi to an HDMI display and the Internet through an Ethernet cable or USB tethering. (The author’s Raspberry Pi board connected to laptop through Ethernet cable is shown in Fig. 4.) Switch on the drone control device (Raspberry Pi) and then connect it to the Tello Wi-Fi. Now you can control the Tello drone through Wi-Fi network.

Raspberry Pi connected to laptop through Ethernet cable
Fig. 4: Raspberry Pi connected to laptop through Ethernet cable

When all the connections have been made, run the Python code. A video of the drone surroundings is displayed on the Raspberry Pi’s monitor screen. Now you may press the Bonnet button on AIY Voice Bonnet board and give voice commands to the drone and make it fly without any remote.

Download Source Code

Congratulations! You have successfully made a drone that can be controlled by voice commands.


Ashwini Kumar Sinha is an electronics hobbyist and tech journalist at EFYi

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here