Vernier Software and Technology
Vernier Software & Technology
Vernier News

Coding with mBot: Self-Driving Vehicles Module

The topic of self-driving vehicles is one that combines diverse issues ranging from engineering to federal regulations. While it may be years before you have a self-driving car in your driveway, you can use mBot in your classroom today! Equipped with ultrasonic distance, line-following, and light-level sensors, mBot is an affordable, easy-to-program robot designed to bring coding and computer science education into the real world. With our new Coding with mBot: Self-Driving Vehicles module, a set of nine guided coding activities that build upon each other, you and your students can successfully learn to program mBot to mimic many self-driving car actions.

In Coding with mBot: Self-Driving Vehicles, students write programs to make mBot perform activities such as following a line, avoiding an obstacle, and parallel parking. Along the way students learn basic coding and troubleshooting skills. The activities are aligned with the Computer Science Teachers Association’s K-12 Computer Science Standards, and require only an mBot, the free mBlock software (based on the popular block-based programming language Scratch), and some patience for the occasional traffic jam.

In the first activity “Driving mBot,” students are introduced to mBlock software and write a program that allows them to control mBot’s movement in four directions, make sound with mBot’s buzzer, and turn on the built-in LEDs. Teaching tips and example programs in the accompanying Instructor Information support you as you facilitate student learning.

Download Activity 1, “Driving mBot,” as a free preview at

Coding with mBot: Self-Driving Vehicles will be available soon as an electronic download and is included free with your purchase of one or more mBots from Vernier. If you already own mBot, you can purchase Coding with mBot: Self-Driving Vehicles separately (order code: MBOT-MSDV-E).

At the heart of mBot is the mCore, a microcontroller based on the Arduino Uno. In addition to the ultrasonic, line-following, and list-level sensors packaged with mBot, mCore has four RJ25 sensor ports, two motor ports, two RGB LEDs, a buzzer, and an IR transmitter/receiver. Students make use of all of those features while programming mBot to act as an autonomous vehicle. For instance, set up the RGB LEDs to work as turn signals. In addition, to help keep mBot on its track, the line-following sensor can serve as a trigger for a car alarm. mCore’s IR transmitter and receiver allow messages to be passed between mBots, making it possible to coordinate their motion and stop them from colliding.

The activities in Coding with mBot: Self-Driving Vehicles can be completed using the free mBlock app (iOS/Android) or with the more advanced mBlock software (Windows/macOS/ChromeOS). More experienced students can work even their way through the activities using the Arduino IDE.

Everyone from Google to GM® is interested in self-driving cars today. Bring that enthusiasm into the classroom with mBot and the activities in Coding with mBot: Self-Driving Vehicles. Learn more at

Go to top