Voice-controlled Drone

Introduction: Voice-controlled Drone

This Instructable will guide you through how to make a voice-controlled drone. If you are experienced in coding and would like to try coding the app interface from scratch, there will be several steps to help lead you on the right track. Don't worry if you do not know how to code! You will still be able to work on this project.

What you need:

- Crazyflie 2.0 Drone

- Mac computer with Xcode (free from the App Store)

- iPhone or iPad with iOS 9.0 or higher

- Apple ID (preferably a developer ID, but not required)

- Optional: 3D printer and OnShape (or other CAD software) account

Step 1: Create a Nuance Developer Profile

Whether you are looking to build the app from scratch, or if you simply would like to use our app, you will still need your own profile from Nuance. Do not select "Want Nuance Mix Beta?". Once you have confirmed your account, log in and view your sandbox credentials. Copy and paste the URL, SSL Host, SSL Port, Add ID, and App Key under "SpeechKit 2.x" into an easily accessible document. You will need this information later.

Step 2: Download the App

We customized the Crazyflie Example Project by adding in an additional button for speech that works with the SKSASRViewController Class in the SpeechKit Example App, and a slider to adjust the power as the battery drains. If you have a foundation in Objective-C or related coding language, you can try building the app from the ground up. Steps 3-6 will outline the basics of creating an app like we did. If you don't like the idea of building the app yourself, you can just download our finished app from Github here. Follow steps 7-8 to get it running on your phone.

Step 3: Getting Started With the SDK's and Cocoapods

Skip to Step 7 if you would not like to build your own app.

Once you have downloaded the Crazyflie project and the SpeechKit project, you first have to install cocoapods to Crazyflie. The process is outlined as follows:

1. Open Terminal and type "sudo gem install cocoapods"

2. Enter your password

3. Type "pod setup --verbose". If you get no response from terminal, don't worry - the set up will likely take a few minutes to complete.

4. If you have Xcode open, quit it.

5. Type "cd ~" followed by the path to the folder containing your Xcode file with the Crazyflie project. You should omit the /Users/Name/ part of the directory, so your path should be something like "/Downloads/crazyflie2-ios-client-master" unless you have moved it elsewhere.

6. Type "pod install"

That's it! Cocoapods is set up for Crazyflie, and you are ready to start looking at the projects in Xcode. Make sure that you are viewing "Crazyflie client.xcworkspace" instead of "Crazyflie client.xcodeproj" or the pods will not show up correctly.

Step 4: Adding Nuance Developer Credentials

1. Open the "SpeechKitSample" project and input your credentials that you copied earlier. Ensure that everything is correct or the app will not be able to communicate with the server.

2. For language, put: @"eng-USA";

3. Run the app and play around with the various documents. Try looking at "SKSASRViewController.m" under the "Controllers" group. This code contains the speech recognition methods necessary for this project.

4. Copy the SpeechKit.framework file onto your desktop.

***Alternatively, if you would not like to use Nuance, you can try OpenEars, an open source speech recognition process that only recognizes commands you tell it to. Although OpenEars is far less accurate than Nuance, its limited set of recognizable commands is actually helpful for this app, as you only need a couple of commands to fly the drone. Also, OpenEars does not require internet or any sandboxing credentials like Nuance does.

Step 5: Exploring the Crazyflie Client

Now that you have cocoapods installed, you can open the Crazyflie client. Focus mainly on the ViewController.m file and the method sendCommander: in particular. If you are not well acquainted with NSTimers, I recommend you read the Apple documentation or find some other source of information about them. You should not have to edit the other documents, and be careful what you change in the ViewController class, as deleting even a single line can cause many errors to pop up and be fatal to the app. Just remember to hit ⌘Z if anything goes wrong.

Also, make sure that you select the general Crazyflie Client project information and change the bundle identifier to your own. Switch the team to your Apple ID, and click "Fix Issue" if applicable.

This client does not run well in simulator, and cannot communicate with the drone in simulator. To run the app, plug in a device first, wait for it to recognize it, then select it from the upper left menu and hit run.

Once you have flown the drone a little bit, begin altering the code to see what happens. Just remember to undo any fatal errors and re-download the project if you completely destroy it (that happened to me about 6 times).

Step 6: Combining Crazyflie and SpeechKit

Now that you are well acquainted with these two apps, combine them by moving things from the SpeeckKitSample App to the Crazyflie Client App.

1. Copy the SpeechKit.framework file INTO THE PROJECT FOLDER. Then navigate to Crazyflie Client > Build Phases > Link Binary With Libraries > + > Navigate to SpeechKit.framework

2. Copy the SKSConfiguration.h and SKSConfiguration.mm files that you added your credentials to into the project.

3. Navigate to the ViewController.m file and add the following:

#import "SKSConfiguration.h"

4. Copy the void methods found in SKSASRViewController.m into Crazyflie and implement them accordingly. A statement in the -(void) recognizeSpeech:(NSString *)message{} method will allow you to run code specific to each command, by comparing the received string (variable named "message") against predefined strings:

if ([message isEqualToString:@"Your command here"]) {
//Run code for your command


Also, remember that string comparison is case-sensitive, so make sure that any strings you fill in for "Your command here" have their first letter and ONLY their first letter capitalized, or the if statement will be false.

Alright! It's up to you to finish up the project. There is lots of trial and error that goes into this, so just be patient, and reference our app if you need. You can skip steps 7 and 8.

Step 7: Getting the Project Working in Xcode

Steps 7 and 8 are only necessary if you are NOT coding your own drone control app

1. Download this project as a zip. Once downloaded, unzip the file before proceeding.

2. Open Terminal and type "sudo gem install cocoapods"

3. Enter your password

4. Type "pod setup --verbose". Note that this will likely take a few minutes to complete.

5. If you have Xcode open, quit it.

6. Type "cd ~" followed by the path to the folder containing your Xcode file with the project. You should omit the /Users/Name/ part of the directory, so your path should be something like "/Downloads/Drone-Voice-Control" unless you have moved it elsewhere.

7. Type "pod install"

8. Open the Xcode .xcworkspace file and navigate to the top item on the left-hand list, "Crazyflie Client"

9. Click "General," type your own bundle identifier in the top field under "Identity," select your own Apple ID under "Team," and click "Fix Issue" if it asks you to.

10. Navigate to the SKSConfiguration.mm file, and paste the Nuance developer credentials you saved earlier. These must be in string format (@""), so if, for example, your App Key was 12345, the line of code would look like this:

NSString* SKSAppKey = @"12345";

11. The line involving SKSLanguage should look like this:

NSString* SKSLanguage = @"eng-USA";

12. Ignore the SKSNLUContextTag

13. Plug in your iPhone or iPad, select it from the list, and click Run.

Step 8: Tweaking the Code

Although it may seem scary, you will likely need to tweak the code to suit your particular drone.

Navigate to the ViewController.m file and find the "-(void) recognizeSpeech:" method. Under each speech request in an if(){ } statement, you will see something like "self.commanderTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(flyDrone:) userInfo:@[@0.75,@0,@0,@0] repeats:YES];"

- The userInfo: parameter defines (in order) thrust, pitch, roll, and yaw (see picture).

- Thrust (the amount of power passed to the motors) can be any value from 0 to 1

- Pitch, roll, and yaw can be any value from -1 to 1, with 0 being off and 1/-1 being maximum in either direction.

- If you are having trouble understanding how to modify the code, I recommend using StackOverflow.

Step 9: CADing a Plastic Drone Shell

The plastic motor mounts that the Crazyflie 2.0 comes with are very susceptible to breaking, so it can be helpful to 3D print a more sturdy shell. Along with this benefit, 3D printed shells can be designed to better protect the drone than the motor mounts do, and they add more weight, allowing for significant improvement in the stability of hovering. Although this step is not required (and impractical if you don't have access to a 3D printer), it is helpful to design a drone and stick to that particular weight, as you will have to tweak your values in Xcode for every change in weight that you make.

- Check out our example shell here (.stl). Simply import this file into the app that accompanies your 3D printer (e.g. Cura, Autodesk Print Studio) and the software will take care of it from there.

- Want to try by yourself? Try Onshape or Fusion 360. Onshape is completely free and Fusion has a 30 day free trial. Fusion also allows students 3 years of free access.

- If you would like to edit our project, you will need Fusion 360 and this file (.f3d).

- New to CAD? Learn here.

Step 10: Assembling the Drone

If you printed our drone shell, follow the directions below to get the drone assembled. If you want to use the standard company assembly, follow these directions. Otherwise, skip to the next step.

1. Bind the battery to the underside of the drone chip. Having the back side up makes attaching the motors much easier, so instead of using the included battery case, I simple taped it to the chip.

2. Insert the motors into their positions

3. Attach the motor wires to the board. The dimensions of the drone shell are just enough for the cables to reach. If you are having trouble, try unwinding the motor wires.

4. This set up allows for the drone to sit flat, which allows for easier calibration and take off.

Step 11: Understanding the App

Refer to the image to find out about the UI elements in out example app.

That's it!

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Make It Fly Contest 2016

Participated in the
Make It Fly Contest 2016

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    3 Discussions

    hey,im currently building a voice control drone(by imetomi instructable)im a very new guy in 3d printing.If i want to print it how can i do it?can i just copy your files to usb and print in in a print shop?


    Reply 4 years ago


    If you want to print my drone shell as-is, you can download the stl file in Step 9. Once you have this, you can load it onto a USB flash drive and take it to a 3D printer. I will warn you, however, that not all 3D printers use USB flash drives (some require standard-size SD cards, for example the Ultimaker 2), so I would recommend bringing an SD card with the file loaded on it too. If you go to a place that does 3D prints (which I have never heard of, but they may exist), they will take your USB/SD and put your file into some software that accompanies whichever 3D printers they have, and this will convert the file into gcode, which is readable by the 3D printer. If you don’t have access to a local 3D printer, http://makingsociety.com/2013/07/37-3d-printing-marketplaces-to-share-buy-and-sell-3d-designs/ has a list of companies that will take your file, print it, and ship it to you. Just so you know, I have never used any of these places because I use the 3D printers at my school.

    Looking at imetomi’s project, it seems like there are only 3 motors on the drone. Having experienced flying a drone for this project, I can tell you that 3 motors are likely very unstable for flying, but I can’t say that with certainty. That being said, if you have the technical capabilities to modify the project to have 4 motors, you will have a much more stable end-result. My stl of course has 4 motor mounts, so this modification would allow you to use my drone shell without modification. However, I doubt that the app for the project would communicate with the 4th motor, so you should probably play around with that first. If you would like to stay with 3 motors, you will need a new CAD design with only 3 motor mounts that are separated by 120º each. If you would like to try making this yourself, I highly recommend using Fusion 360 CADing program (OnShape is an excellent program, but it has random issues that are annoying) and following the OnShape tutorials (the programs are similar enough, and I find OnShape tutorials to be much clearer for beginners). Links to these things are in Step 9. If you do end up using Fusion 360, you can also use my drone shell .f3d file for reference, as it is in fully editable format for Fusion. If you would not like to CAD the shell yourself (although it is a very valuable skill to learn, and it has taken me only about 4 months to become very good at), I would be happy to make the file for you and post it here. Just reply back to this comment requesting that I do it.

    If you have any more questions, I would be happy to help, and I will certainly try to guide you through this process as much as possible.


    4 years ago

    What a fun idea! Thanks for sharing!