Mastering LEGO® MINDSTORMS Cover


Build Better Robots with Python and Word Blocks
by Barbara Bratzel and Rob Torok
October 2022, 136 pp.

Download Chapter 1: introduction to Python programming

Look Inside!

Mastering LEGO® MINDSTORMS pagesMastering LEGO® MINDSTORMS pagesMastering LEGO® MINDSTORMS pagesMastering LEGO® MINDSTORMS pagesMastering LEGO® MINDSTORMS pages

You’ve learned the basics of LEGO® robotics, and now you’re ready for more. Mastering LEGO® MINDSTORMS teaches you everything you need to know to level up your robotics engineering skills, using examples compatible with the LEGO® MINDSTORMS Robot Inventor and SPIKE Prime sets. In no time, you’ll be programming autonomous robot vehicles, interactive games, LEGO® musical instruments, and more.

Rather than feature step-by-step instructions for building a handful of models, you’ll find essential information and expert tips and tricks for designing, building, and programming your own robotic creations. The book teaches the fundamentals of writing text-based code for your robots using the popular Python programming language; shows how to harness gears, linkages, and other mechanisms to create all kinds of motion; and explores sophisticated programming techniques for popular applications such as line following and obstacle avoidance, using both Python and Scratch-based Word Blocks. As you learn, loads of challenges and open-ended projects will inspire you to try out ideas.

Author Bio 

Barbara Bratzel is a K-8 STEM teacher who consults at the Center for Engineering and Education Outreach at Tufts University. She has been a keynote speaker and workshop leader at LEGO® robotics educational conferences around the world, and she’s the author of several robotics books for teachers, including Makerspace LEGO® (College House Books).

Rob Torok teaches Computer Science, Mathematics, and Engineering Design at a senior secondary school in Tasmania. He has run robotics workshops for teachers and students, and consulted for LEGO® Education Australia and the Center for Engineering and Education Outreach at Tufts University. He contributed a chapter to The LEGO® MINDSTORMS NXT Idea Book (No Starch Press).

Table of contents 

Chapter 1: Introduction to Python Programming
Chapter 2: Organizing Python Programs
Chapter 3: Efficient Python Programming with Variables, Lists, and Functions
Chapter 4: Controlling Motors and Sensors with Python
Chapter 5: Gears and Mechanisms
Chapter 6: Moving with the Gyro Sensor
Chapter 7: Avoiding Obstacles and Following Lines
Chapter 8: Playing Games
Chapter 9: Useful Inventions
Chapter 10: Ultimate Challenges

View the Copyright page
View the detailed Table of Contents
View the Index


"Mastering LEGO® MINDSTORMS is a great resource for robot builders or FLL teams to advance their skills!"
—Joe Meno, BrickJournal

"The informative text is as supportive as it is educational. . . . explain[s] robotics in a way that respects the reader while challenging them."
—Rosemary Kiladitis, Mom Read It

"Give[s] you great ideas to start coding [and] offers a lot of essential information for robot building and programming."
—Mariana Ruiz, GeekDad

"Very inspirational stuff in there . . . This does get me very excited about using MINDSTORMS!"

"I would recommend it for anyone who wants to take the LEGO MINDSTORMS creations or even the LEGO motorized machs to the next level."

Extra Stuff 

Check out an interview with the authors on

Download the building instructions for the front cover's model.