Welcome to the world of LEGO MINDSTORMS EV3 and voice with Alexa! These instructions are part of a series created to show you how to connect your EV3 Brick to Alexa, and build custom voice-based interactions that incorporate EV3 motors and sensors. With this knowledge, you can build and submit your own creation to the LEGO MINDSTORMS Voice Challenge – Powered by Alexa. Don’t be shy bringing in other LEGO elements — let your imagination run wild!
Here is what is included in this series:
- Setup: Get your EV3 development environment setup.
(you are here)
- Mission 1: Get your EV3 Brick connected to a compatible Echo device, and reacting to the wake word.
- Mission 2: Build EV3RSTORM's legs, and react to music played from your Echo device.
- Mission 3: Add arms and a cannon to EV3RSTORM, and react to voice commands using an Alexa skill you create.
- Mission 4: Give EV3RSTORM eyes (IR Sensor), and make your Alexa skill react anytime an intruder is detected.
Throughout the series, you will navigate between two different environments:
- EV3 Environment: Code run on the EV3 Brick using Python 3
- Skill Environment: Code run in the cloud as an Alexa skill
In the end, you will have built EV3RSTORM, and added the voice-based interactions with Alexa shown in this video:
Helpful resources
Throughout these missions, several resources will be referenced along the way. These references will come in handy as you learn more about the different ways you can create your own LEGO MINDSTORMS EV3 creation that works with Alexa:
- Alexa Gadgets Toolkit Overview
- Alexa Gadgets Toolkit Documentation
- Alexa Skills Kit Documentation
- ev3dev Overview
- ev3dev Python API Documentation
- ev3dev Python Robot Examples
The instructions on this page will walk you through the following:
- Install ev3dev for programming your EV3 Brick
- Instal Visual Studio Code for editing code
- Install Alexa Gadgets Python Software on your EV3 Brick
After completing these instructions, you can move on to Mission 1, and getting your EV3 Brick connected to Alexa.
RequirementsIn order to complete these instructions, you will need the following:
- LEGO MINDSTORMS EV3 set (Amazon link)
- Compatible Echo device (link)
- Micro SD Card – 8gb minimum (Amazon link)
- A method to flash the SD card
- Computer for installing software and programming your EV3 Brick
- WiFi USB adapter (Amazon link) or USB cable for connecting to your EV3 Brick and running programs
- Access to an internet connection
The code you will be writing on the EV3 Brick is Python 3, and for the Alexa skill code, you’ll be working with Node.js. If you haven’t worked with either of these before, or if you have limited technical experience, don’t worry, the missions will guide you through step-by-step in a way that doesn't require you to write any code from scratch.
Set up your EV3 development environmentBefore you can get started with the missions, you’ll need to get your EV3 development environment set up. The following instructions will guide you through installing the following:
- Visual Studio Code: A free programming development environment and extensions that will be used for writing code.
- ev3dev Software: ev3dev is a Debian Linux-based operating system that runs on several LEGO MINDSTORMS compatible platforms including the LEGO MINDSTORMS EV3. ev3dev gives you the power to use Python 3 to control sensors, motors and pretty much everything else. It’s as easy as reading from and writing to a file.
Note: In order to connect to your EV3 Brick over Wifi, your EV3 Brick must be on the same network as your computer, and your network must support SSH. If you’re on a corporate or managed computer or network, this may be blocked.Install EV3Dev
ev3dev is open source software that allows you to program your EV3 Brick using Python 3. This include the ability to control outputs, like motors and LEDs, and react to inputs, like buttons and sensors. The software is installed on an SD Card, which you then insert into your EV3 Brick. Learn more about ev3dev.
Follow the getting started instructions on the ev3dev website, which will walk you through:
- Downloading the ev3dev software to your computer
- Flashing your SD Card with the software
- Inserting the SD Card into your EV3 Brick
- Booting up your EV3 Brick
- Getting your EV3 Brick connected to the network via Wifi, or the USB cable that came with LEGO MINDSTORMS EV3
Once you are able to connect your EV3 Brick to the network, you can move on to the next step, which will also include accessing your EV3 Brick from your computer.
Note: If you want to use a USB connection, the USB connection uses IPv6 local link address by default to connect to VS Code with no configuration required. Follow the tutorial on how to connect the EV3 Brick to the internet via USB by setting up Internet Connection Sharing on your computer.Set up Visual Studio Code
Throughout the following missions, you will be working with Python 3 code to program your EV3 Brick, and Node.js for an Alexa Skill. To make this process as easy as possible, these missions assume the use of Visual Studio Code and recommended extensions that make it easy to connect to and program your EV3 Brick. Learn more about Visual Studio Code.
1. Download and install Visual Studio Code.
2. Download and unzip alexa-gadgets-mindstorms.zip.
3. Open Visual Studio Code, and select File > New Window from the top menu.
4. Select File > Open from the top menu. On a PC, this may be listed as Open Folder.
5. Open the alexa-gadgets-mindstorms
folder you downloaded.
6. At the bottom of the screen, you will see a callout for recommended extensions. Click Show Recommendations. If extensions are not recommended, you will need to search manually in the Extensions panel (shown in Step 7 below).
7. Install the ev3dev-browser extension. If you have Python installed on your computer, you can install that extension too. (Don't install it if you don't have Python already installed.)
8. Once the extensions have installed, click on the Explorer icon on the left of VS Code where you’re able to see your project files.
9. Click the arrow next to the EV3DEV DEVICE BROWSER to expand more options.
10. Ensure that your EV3 Brick is turned on and has a connection to your computer (USB or Wi-Fi will work), and that your EV3 Brick has the ability to connect to the internet. You should see an IP address in the upper-left of the EV3 Brick interface.
11. Click "Click here to connect to a device".
12. A box will pop up that lists discovered devices. Select your device, or if you don't see your device, click "I don't see my device...“.
If you selected I don’t see my device... enter the name you want to give your EV3 Brick, and press the Enter key.
If you selected I don’t see my device... enter the IP address of your EV3 Brick as shown in the upper-left of the interface displayed on your EV3 Brick, and press the Enter key.
14. Once the device has connected, you will see a green dot next to your Brick’s name.
15. If you click the arrow next to the green dot, you will see information about your EV3 Brick, including battery level and files. When you hover over the EV3DEV DEVICE BROWSER title bar, you will see buttons for Refresh and Send workspace to device.
16. Copy the mission folders within the alexa-gadgets-mindstorms
folder over to your EV3 Brick by clicking the Send workspace to device button. In the bottom-right of VS Code, you will see the status of the files being copied.
17. Once complete you should see the alexa-gadgets-mindstorms
show up in the EV3DEV DEVICE BROWSER.
Once your EV3 Brick is connected, and you’ve copied your workspace over to your EV3 Brick, you’re ready to move on!
What to do nextNow that your EV3 development environment is set up, you can move on to Mission 1 where you'll get your EV3 Brick connected to your Echo device, and reacting to you saying the Alexa wake word.
Comments