Skip to Content
Programming with MicroPython
book

Programming with MicroPython

by Nicholas H. Tollervey
September 2017
Intermediate to advanced
214 pages
5h 27m
English
O'Reilly Media, Inc.
Content preview from Programming with MicroPython

Chapter 12. Robots

Robots are cute in an “all humans must die” sort of a way; and, thanks to the educational uses of devices like the micro:bit, many makers have created robots that demonstrate how robotics can be a relatively simple and fun endeavour. This chapter explores two robotics projects that show how to use MicroPython to make your very own robotic invasion. Both use the micro:bit, although the techniques discussed are easy to transfer to other boards running MicroPython.

Trundle Bot

This bot trundles around on wheels. It has an analog distance sensor on the front to detect objects in its way. If something blocks its way, it rotates left or right until no blockage is detected, then it continues on its way. It’s a very simple bot that can be made in about an hour with only a few parts. The code to drive the bot is also beautifully simple and demonstrates how to drive servo motors to give the bot movement.1

The bot was successfully used in a bot-building workshop at EuroPython 2016 and, because of its simplicity, was easy to modify and change to suit the available building materials and aims of the builders (who included experienced Python programmers, their nontechnical partners, and children).

The minimum parts required are inexpensive:

  • A micro:bit
  • 2 9g continuous rotation servos
  • A Pololu Carrier with Sharp GP2Y0A60SZLF Analog Distance Sensor, 3 V
  • 2 wheels
  • A Pololu caster ball
  • A portable power source to provide between 3.3 V and 4.2 V

There also needs to be some means ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

IoT Development for ESP32 and ESP8266 with JavaScript: A Practical Guide to XS and the Moddable SDK

IoT Development for ESP32 and ESP8266 with JavaScript: A Practical Guide to XS and the Moddable SDK

Peter Hoddie, Lizzie Prader

Publisher Resources

ISBN: 9781491972724Errata Page