The lego mindstorms robot inventor activity book

Обновлено: 15.05.2024

This article has an in-depth comparison of MINDSTORMS 51515 Robot Inventor vs EV3 (set 31313). Are you considering an upgrade from EV3? Or maybe you want to get into LEGO robotics, and you doubt whether to buy an EV3 set on sale or shell the full price of a shiny new Robot Inventor set. Wonder what to buy? Find out here what the differences are between EV3 and the new 51515 Robot Inventor set.

People will be calling this LEGO set ‘teal MINDSTORMS’ or ‘MINDSTORMS 5’ or ‘MINDSTORMS 515’, which is short for the set code. Maybe the name ‘Robot Inventor’ takes hold. Time will tell. In this article, I’ll refer to the sets by their set numbers. The numbers are short and easy to remember.

Robot Inventor, for its higher price, is not all sunshine and rainbows either. The set has its shortcomings. Is it worth the extra investment? As a member of Robotmak3rs, I received a preview box to evaluate. Read on to find out whether I think the new 51515 Robot Inventor set is worth it.

EV3 vs 51515 Robot Inventor: hub size

EV3 Intelligent Brick next to his smaller Robot Inventor brother

The 31313 and 51515 cardboard boxes compared

Like all LEGO boxes, the set number, set name, and suggested age is here in the top left. The age recommendation is still 10+.

The graphics of the 51515 are very different from LEGO technic and the previous MINDSTORMS. The black and bright colors give the set a bit of an 80’s retro-cool look. The overall feel of the 51515 seems friendlier and more unisex than the more aggressive style of the EV3. Sizewise, the box is the same as the EV3 box.

The new set doesn’t have a playmat wrapped around the box. This does not feel like a significant loss because the EV3 playmat was pretty much useless. The best use I found was cutting it up and using at as a sail for my LEGO MINDSTORMS land yacht.

The practicality of the Robot Inventor box

The Robot Inventor box is practical for storing parts and half-build models

The 51515 box has one great advantage: it opens from the top, making it reusable. You can pour your parts in and store your half-built robot ideas.

The LEGO MINDSTORMS Robot Inventor Activity book by Daniele Benedettelli shows you how to build and program LEGO robots from scratch

An introduction to the LEGO Mindstorms Robot Inventor Kit through seven engaging projects.
With its amazing assortment of bricks, motors, and smart sensors, the LEGO® MINDSTORMS® Robot Inventor set opens the door to a physical-meets-digital world. The LEGO MINDSTORMS Robot Inventor Activity Book expands that world into an entire universe of incredibly fun, uniquely interactive robotic creations! Using the Robot Inventor set and a device that can run the companion app, you’ll learn how to build bots beyond your imagination—from a magical monster that gobbles up paper and answers written questions, to a remote-controlled transformer car that you can drive, steer, and shape-shift into a walking humanoid robot at the press of a button.
Author and MINDSTORMS master Daniele Benedettelli, a robotics expert, takes a project-based approach as he leads you through an increasingly sophisticated collection of his most captivating robot models, chapter by chapter. Each project features illustrated step-by-step building instructions, as well as detailed explanations on programming your robots through the MINDSTORMS App—no coding experience required.
As you build and program an adorable pet turtle, an electric guitar that lets you shred out solos, a fully functional, whiz-bang pinball machine and more, you’ll discover dozens of cool building and programming techniques to apply to your own LEGO creations, from working with gears and motors, to smoothing out sensor measurement errors, storing data in variables and lists, and beyond. By the end of this book, you’ll have all the tools, talent and inspiration you need to invent your own LEGO MINDSTORMS robots.

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

All of the projects use the electronics of the 51515 set and are programmed using (Micro)Python (although some of them might include their Scratch equivalent). I've grouped them in three categories:

  • The LEGO Mindstorms 51515 software already comes with several programs for the different robots. However, these are programmed using Scratch. In this directory you will find their counterparts in Python.


* Pun absolutely intended

My programming setup

Although technically the 51515 hub can be programmed in Python, its support is quite limited. You are restricted to writing code in Python within the LEGO Mindstorms app (either in your laptop, tablet, or mobile), locking you out of using your preferred (and probably more powerful) IDE. Moreover, each project is saved as an .lms file, regardless if it is written in Scratch or Python. .lms files are a bit tricky and cannot be put under version control easily.

What is within an .lms file?

The structure within an .lms file is quite peculiar. When you open the .lms file in a text editor, you can see that the first 2 characters are PK. This is a remnant from the old DOS "pkzip" - the mother of all zip programs. You can rename the .lms file to .zip and double click it. Inside, you will find scratch.sb3 . This is supposedly a scratch file. You can also rename this file to .zip and double click it. Inside, you will find a project.json . This is an ugly formatted json file.

As you can see, there are a lot of things going on within an .lms file, making putting them under version control not very easy.

Credit and kudos go to @hacky97 for shedding some light into this matter.

Given these restrictions, this is how I've configured my setup for the development and documentation of my LEGO Mindstorms projects using Python:

  • First, I start coding on the LEGO Mindstorms app. I take advantage of pre-defined imports (which otherwise I would forget), and of the so-called "Knowledge Base" (which is nothing else than the documentation). When the hub is linked, I like how you can see in real-time the status of the motors and sensors connected to it. I always keep the console open (at the bottom of the screen).


The LEGO Mindstorms Python interface

  • Once I have something more or less functional, I bring the big guns. Namely, I open a Jupyter Notebook. Using Jupytext, I configure my notebook (i.e., a .ipynb file) to be paired with a "percent Script". This generates a .py file which is linked to the original notebook.


Configuring a Jupyter Notebook using Jupytext

  • Now, I can use Spyder (my preferred Python IDE) to indirectly work on the Jupyter Notebook. I copy the code from the LEGO Mindstorms app into the .py script. There, I can define text cells with %% [markdown] and code cells with %% .


Working on Spyder

  • This is where the magic happens. Every time that I save the .py file, I can refresh the .ipynb file and see the changes there. This is a very elegant way to work on notebooks in a simple script, which as you can imagine is incredibly handy, since it allows me to create notebooks to explain the different steps of the programs in a nice format. For more details on how Jupytext works, I suggest you take a look at its documentation.


The Jupyter Notebook reflects the changes of the .py file.

  • Lastly, I can just copy and paste the contents of the .py file into the LEGO Mindstorms app and it will work, since all the extra stuff (headers, cell definition) is defined as comments.


The LEGO Mindstorms Python interface with code from the .py file. It works!

After this, I just get into the coding and documentation cycle (with a lot of copy-pasting in between). This setup isn't ideal, but at least it works. I hope that in the future the LEGO Mindstorms app works with .py files. Technically, Python support is still on beta, so it might still happen!

TLDR: For each project, copy the contents of the .py file into the Mindstorms Python project.

If you need some pointers on where to start learning Python to program your first LEGO Mindstorms robots or if you want to go deep into the rabbit hole with your creations, I recommend taking a look at this resources:

Python programming lessons by Sanjay and Arvind Seshan
Amazing resource for LEGO Mindstorms robot programming. A bit focused towards FIRST LEGO League, but useless nevertheless. Content is structured as classroom lessons. It is actively being developed.

LEGO Mindstorms 51515 Micropython programming tutorial by Coder Shah
Handy playlist with some YouTube videos that should get you started quite quickly on the basics of Python for LEGO Mindstorms.

LEGO Mindstorms FAQ by Maarten Pennings
More than a FAQ, I'd say this is a guide well worth reading from start to bottom. Even if you already know the basics, I am sure you will learn something useful

(Unofficial) Documentation for LEGO Mindstorms Python API by Laid Back Koala
Very handy resource if you are sick of the Knowledge Base closing every time you switch windows wrapped. It comes in a cohesive, nice PDF format. It also has a PDF for Scratch!

Undocumented Python for LEGO Mindstorms by Anton's Mindstorms
from mindstorms import MSHub and then hub = MSHub() , right? Well, actually import hub has way many more options. Spoiler alert: it is cool, but it is a tad less user friendly.

Pybricks by the Pybricks team
If you feel that the LEGO Mindstorms vanilla (Micro)Python starts being insufficient for your creations, you might want to take a look at Pybricks. Basically, you download a new firmware to your hub where you run Pybrick's version of (Micro)Python. However, note that support for the 51515 set is still on alpha at the time of writing.

How can I run two motors asynchronously?
The moment you start building more ellaborate robots, you will come across this issue sooner or later. So far, I've found two different ways to tackle this:

    , as proposed by David Lechner (actual code here). I tried this approach in Charlie's drum_solo activity and it works quite well. , as proposed by Anton's Mindstorms. It looks quite ingenious. However, I haven't had the chance to try it myself.

If you have any questions, comments, or feedback, please open a discussion. If there is a problem with the code (e.g., mistake), please open an issue. Moreover, you can always drop me a line on Twitter (@amoncadatorres).

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Smart Robotics with LEGO MINDSTORMS Robot Inventor

This is the code repository for Smart Robotics with LEGO MINDSTORMS Robot Inventor, published by Packt.

Smart Robotics with LEGO MINDSTORMS Robot Inventor, published by Packt.

What is this book about?

LEGO MINDSTORMS Robot Inventor is the latest addition to the LEGO MINDSTORMS theme. It features unique designs that you can use to build robots, and also enable you to perform activities using the robot inventor application.

This book covers the following exciting features:

  • Discover how the Robot Inventor kit works, and explore its parts and the elements inside them
  • Delve into the block coding language used to build robots
  • Find out how to create interactive robots with the help of sensors
  • Understand the importance of real-world robots in today's landscape
  • Recognize different ways to build new ideas based on existing solutions Design basic to advanced level robots using the Robot Inventor kit

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

Following is what you need for this book: This book is for robot enthusiasts, LEGO lovers, hobbyists, educators, students, and anyone looking to learn about the new LEGO Robot Inventor kit. This book is designed to go beyond the basic build through to intermediate and advanced builds, and enables you to add your personal flair to the builds and codes.

With the following software and hardware list you can run all code files present in the book (Chapter 1-10).

Software and Hardware List

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Click on the following link to see the Code in Action:

Learn Robotics Programming - Second Edition [Packt] [Amazon]

Hands-On ROS for Robotics Programming [Packt] [Amazon]

Get to Know the Author

Aaron Maurer , also known as “Coffeechug” is the STEM lead for 21 school districts in Iowa helping to expand STEM, Computer Science, Makerspace, and Purposeful Play into classrooms K-12. Aaron is also a former FIRST LEGO League coach for 8 years with much success working with phenomenal kids.

Here is a visual reference to the official part list and count in the LEGO MINDSTORMS 51515 Robot Inventor set. The set comes with a paper booklet containing the part list, but the jpg files in this article provide a nice digital reference for your laptop or iPad screen. I made two overviews, one with every part listed and the number of them in the set. Another with every part rendered, showing as many parts as there are in the set.

Part count in the 51515 Robot Inventor set

This image has an exact part count of every included piece in the new MINDSTORMS set. I added beam and axle lengths for your convenience.

New and notable are the large frames. There are two 11 by 15 frames and two 7 by 11 frames. The LEGO Duplo ball is an eye-catcher too. The set includes two Ninjago arrow shooters for making your robots more menacing. Apart from the Ninjago parts there are many other studded parts in the set. Much more than in the MINDSTORMS EV3 set. Examples of these studded parts are the antennas, the two dishes and all the smooth tiles.

The set includes many wheels. There are even six 56mm solid rubber wheels! Those wheels were first seen in the SPIKE Prime set and make great robot wheels. The smaller 18mm wheels with 23mm rubber tires are also the same as the SPIKE Prime set.

The number of gears is rather limited. There is only one 36 tooth gear. On the other hand, the set includes no less than three turntables, two small ones and a large one.

Volume display of parts in the 51515 set

This overview gives you a feel of all parts included. The parts are sorted by function.

XML File of the 51515 part list

You can also download this XML file with a part list. It is in the zip file below. The XML file is usable on Bricklink. You can also use the XML file to create a custom palette with quantities and inside Bricklink Studio.

To add a custom palette with quantities in Studio, choose ‘config…’ in the palette menu en then choose ‘import a wanted list xml w/ quantity’. There is a bug that doesn’t show the number of rubber 2L parts with axle holes correctly. Another thing that adds complexity is that not all 51515 parts are in the official Bricklink Studio library yet. See below how you can install them.


51515 parts for Bricklink Studio

If you want to model with the new hub and motors in Studio, you need to install some custom parts. I have compiled a zip file with the Studio parts for the SPIKE Prime motor, medium and large. The file also contains the SPIKE Prime color sensor Studio part, the SPIKE Prime ultrasonic sensor studio part, the 51515 hub and many more new parts. Not that these parts may be added to the Studio library in the future and that downloading the file below may conflict with your studio installation.

To install this, unzip the folder in the right location.

  • On windows go to %localappdata%/Stud.io/ by typing it in the Windows Explorer address bar.
  • On mac press cmd-shift-G in the Finder and go to ~/.local/share/Stud.io/ ATTENTION! Some people claim that on Mac, you should rename the folder to “Custom Parts” (with a space) and put it in the Studio folder inside the Applications folder. THIS IS WRONG and messes up your custom parts and part editor configuration.

Interesting fact: this is also the location where Studio saves your building instruction presets. Should you want to back them up or share them, they are in a subfolder called Instruction/CustomStyle/

Unboxing video of the Robot Inventor set

Be sure to check my full unboxing video of the new MINDSTORMS 51515 set on YouTube.

Читайте также: