Pages Menu
Categories Menu

Posted by on Aug 5, 2016 in News, Uncategorized | 2 comments

How To: Voice Control Lego Mindstorms EV3 with Amazon Echo Dot (Alexa)

How To: Voice Control Lego Mindstorms EV3 with Amazon Echo Dot (Alexa)



Alexa Dot -> IFTTT -> Maker Channel -> Python Webserver -> C# Script -> Bluetooth to EV3 -> Sink

During this summer’s Think Up program, one camper put forth the idea of a voice controlled sink. After much deliberation, our instructors decided to combine Amazon’s Echo (for voice commands) with a Lego Mindstorms EV3 kit (to control faucet). This example project involved taking input from an Echo Dot and using it as a trigger for an EV3 motor, and we believe our work helps bridge a gap between these two platforms that will be of use to many.

CODE: Click here

First, make sure you have an IFTTT account set up so that we can take our output from the Alexa. Keep in mind that you’re going to need administrative privileges on a network and knowledge of how to change the port forwarding. It will be easier to host a server on the network you’re running your robot with, but in our case we hosted it remotely from a web server. All scripts for the project are attached.


To start, set up your Alexa with your network. You’ll need to download the the Amazon Alexa app to configure it.


Next, on IFTTT, create a new recipe.


Select Alexa as your trigger:


Choose the “Say a specific phrase” option and enter what you’d like to say to activate your trigger. (We used turn sink on for our example)


Now, for your action, you’re going to have to pick the “Maker” channel


You’ll have to configure this channel as shown, except replacing X.X.X.X with the public IP address of the network you are hosting your web server on. (You can find this by googling “IP address”)

You can also change the “on” text to some sort of unique identifier for each of your actions. Remember whatever you put, you’ll need it in your next step!

Just accept the confirmations and repeat until you’ve created all the triggers you need from Alexa.


Next, we’re going to setup your webserver. We wrote a script for both Python 2.7 and 3.5 so you can use whichever version you have. Again, all scripts should be attached.

We won’t go into all the details, you just need to know about the class named “S”. Looking at the do_GET method, you can see the important if statements.

You’ll want to replace “on” with whatever you set at the end of your URL in the last step. We ended up creating two triggers, “on” and “off”. Create as many elif’s as needed until all your cases are accounted for.

If you need to save variables, you can use the MyServer class. Just store them like it’s shown in the example with the MyServer.on variable.

Last, at the top of the script, set MYPORT to the port you plan to use for hosting. You’ll need to port forward port 80 to this port on your router.


In order to connect to our EV3 robot via bluetooth, the best option is through a C# library created by Joeri van Belle at MIT called EV3 Messenger.

You can find it here at:

Download the code and edit the main form method as described below.

The C# program makes a get request to the web server and sends a “true” or “false” bluetooth message to the EV3 depending on what the web server sent back, either “on” or “off.”

For this to work, you’ll need to connect your computer to your EV3 using bluetooth. Then, to make sure the program can communicate with your robot, go to devices and printers and open up the properties of your device. Under the “hardware” menu, you should be able to see what serial port your robot is on.

BT (2)

Use that bluetooth port where shown in the comments. Also make sure to replace the IP with your server IP.

Now, all you have to do is run that code!


Lastly, You’ll have to write a new EV3 program to accept the bluetooth message.

All you really need is a very simple switch, just like what we have here:

robot code

Upload the code to your EV3 and you’re done!


Our final robot looked something like this:


You’ll probably want to test this program one step at a time to make sure everything works, but you should be set to go!


  1. Good work guys! I’ve taken your project and made my robot lock my shed next to the house. So glad you put this project out on the web. Many thanks!!!

  2. I have a question

Post a Reply

Your email address will not be published. Required fields are marked *