College curriculum for using ev3dev in a Python programming course.
This repository is meant to be used as the starting code for students that are learning to use the Lego EV3 Mindstorms robot + ev3dev with Python.
Some background information will be provided here with links to other documentation. The assumption is that before you begin using this repository to learn the python-ev3dev API you first have setup your Lego Mindstorm EV3 with ev3dev as discussed in the Background information section below. Once all the setup is done (typically done by an instructor before the class begins) this repository can be used with students. Here is the content used in this curriculum:
Set up your computer to communicate with the EV3 robot and get an overview of the robot capabilities.
Learn to move the robot around. Movement is a good first step with mobile robotics.
Digital Inputs (and a few other things)
Learn about the EV3 buttons, IR remote, and touch sensor (the digital inputs) plus a few other things.
Now it's time to get serious. Use your computer to control the robot from a graphical user interface.
Learn to use the color sensor, infrared sensor, and Pixy camera.
- Lecture slides
- Starting code (link to a specific folder in this repository)
- Checkoff sheet
- Color squares
Typically the EV3 is programmed with a block based programming language from Lego that is available for Windows and Mac.
There is also a lightweight version of that program available for iPad and Android tablets.
Block based languages are a great way to get started, but at some point in your programming journey, it's time to move away from block based languages (like Scratch) and move into the more traditional text-based programming languages. One of the best, first languages to learn is Python. Using the Lego EV3 with Python can be a lot of fun and it can help motivate learning. There are really only 2 factors limiting more schools from using EV3 + Python.
- Costs (sorry can't help you with that one)
- Technical challenges (that one we can help with)
Indeed it takes someone with a bit of tech savvy to get started, but there are a lot of great tools to help. This repository uses some of those great tools and tries to provide examples and links to use them.
First we start with the operating system on the EV3 programming brick. Instead of using the default operating system that ships with the EV3 from Lego we'll dual boot using an SD card. The new os is called ev3dev and it's based on Linux. http://www.ev3dev.org/
ev3dev can use many different programming languages, not just Python. However, we only care about Python. In
order to use Python we need to leverage the ev3dev Python library, which is called python-ev3dev, so that we have commands to communicate with the motors and
sensors on the board. ev3dev ships with python-ev3dev already installed, so all we have to do is learn to use it. You can learn the API from the official documentation:
but sometimes it's easier to learn from a series of examples. That is the focus of this repository. It is a series of exercises that you will work to learn the python-ev3dev API. After you work these exercises you should be able to come up with your own ideas that you can implement.
Background information specific to Rose-Hulman
Starting in 2016 we built a fleet of 10 EV3 robots to use in our CSSE120 Introduction to Programming course at Rose-Hulman. The pilot program went well so in the Fall of 2017 we purchased 10 more robots. Here is a Google doc which
shows the setup steps that the instructors did before the course began:
Once you have your robots setup and rockin you need material to teach students how to use the robot. That is where this repository begins.
What is in this repository
The purpose of this repository is to share the work we’ve done at Rose-Hulman to use ev3dev in the classroom. We’ve setup a series of exercises for students to learn the python-ev3dev API. Instructors at other schools can use any amount of our content in their own course or simply review our work as inspiration.
This repository is broken into different folders that each have a different purpose:
assets- Sound and image files. These assets are used in various modules throughout the curriculum.
examples- Finished examples that can be run to demo different robot features. Reference the code in this folder when doing your own work.
libs- A special folder that will contain modules that are available to all other modules. Students will be given an mqtt module and will be expected to build their own robot controller module.
projects- This folder is currently blank. Each team member needs to make a folder in the projects area for their final project code.
sandbox- This folder has 5 subfolders that all start out identical. Each identical subfolder is for 1 team member to work individually while learning ev3dev. This folder contains 24 individual programming challenges that you will work as you complete this curriculum.
At the end of this curriculum a student should be able to…
- Transfer programs to the EV3 that were made on their computer
- Run programs on the EV3 using python3 via SSH
- Create programs that effectively use the python-ev3dev API, including motors, LEDs, sound, the screen, buttons, IR remote, MQTT, touch sensor, color sensor, Pixy camera, and infrared sensor.
- Create their own project that uniquely uses the skills learned from the guided units