EDIT MODE

The Art of LEGO Mindstorms EV3 Programming is a new book from No Starch Press written by Terry Griffin, the author of the NXT book by a similar name.

This book is designed to take readers at any skill level through the basics of programming the EV3 and then into designing and building complicated robots, such as line followers and maze solving robots. It does this with a single versatile robot you build at the start and gradually enhance as you work your way through the book.

Physical Book

The book measures about 20.3cm x 25.3cm x 1.6cm and is 250 pages long. It is soft-cover, but at first had a strange feel to it. I'm not sure how to describe it but it felt kind of sticky/tacky. However, that might just be because of the high humidity and heat where I live. Over time it seemed to get better, but perhaps I just got used to it :)

Introductions

The first two chapters are very introductory, and cover the bare basics of using the EV3 software and downloading programs. For anyone that has actually built their EV3 set and programmed any of the standard robots, these chapters are probably too simplistic. Still, they set the mood for the rest of the book with early recommendations on saving programs, commenting code, using context help etc.

Building the TriBot

In chapter 3 you build the TriBot which is used for testing out all programs in the rest of the book. The TriBot is a simple frame, used to mount the sensors. Each sensor can be removed and placed elsewhere based on the requirements of the program being written. For example the IR receiver can be moved to the side to measure distance to the wall, or the color sensor mounted on the front for the line follower.

There are instructions for the TriBot for either the Home or Education editions. The IR/Ultrasonic sensors are interchangeable and take slightly different values depending where they are used.

Content

The author understands that programming is learnt by writing and debugging real programs, not just by reading reference manuals. This book contains lots of practical examples to help readers learn as they go along. In fact, some programs are made to deliberately fail in order to teach the true behaviour of some of the EV3 blocks.

Can you see why this might not work?

This book is great at teaching you why there can be inaccuracies in robotic movements and how to avoid them. As you progress through the book you will learn methods to use the sensors to actively adjust the robot's behaviour based on its surroundings.

Motors

Chapters 4 and 5 provide information about how the motors and sensors work. It goes through each feature in detail and explains how each of the relevant blocks work. Even if this is all you read, it will provide you with a great understanding of how to build your own EV3 robots.

An example lesson in how motor coasting works

The book tells you what to code at each stage, but also gives you plenty of challenges and suggestions for improving things on your own.

Maze Solver

Chapter 7 introduces you to what I think is the most interesting program/robot in the book. The Wall Follower program is a very simple program that uses the right-hand turn rule for solving a basic maze.

For novice programmers, this chapter also introduces you to the concept of pseudo code and initial conditions to help write algorithms for solving more complicated problems.

It progresses through a few variations and methods of improving how well the robot works. Unfortunately I haven't had time to build a proper maze yet. It needs to be quite large to fit the robot, and I don't have quite enough LEGO to build it. This will make an excellent project during school holidays :)

Data Driven Robots

Chapters 8, 9 and 10 cover using the data wires to connect the inputs and outputs of blocks together, and the intricacies of using data wires with switch/loop blocks. This starts to make possible the truly immersive robots that can react to their environment in smarter and more efficient ways.

The first program uses the two TriBot wheels to control a musical tone. One wheel modifies the volume while the other modifies the frequency played. It is a very simple demonstration of how the data wires work.

A Tone Generator

Chapter 11 covers simple variables and constant blocks, which are pretty essential to most programs. It's pretty straightforward and takes you through examples that increment variable counters, and then a more interesting usage - a robot that spins to find the strongest source of light and then points in that direction. To handle this it needs to remember the maximum sensor reading, and position it was in at the time.

The Light Pointer Robot

Advanced Topics

Up until now, I would consider the content fairly simple and most people would pick it up from playing around with the bundled Mindstorms robots. The remaining chapters cover more advanced topics that need further experimentation to figure out.

Chapter 12 covers the My Blocks feature to create custom blocks of programs that can be reused in multiple places to simplify the logic. It does a good job at explaining and taking you through creating your own blocks and how to define its inputs and outputs, by modifying programs written earlier in the book.

Chapter 13 covers the Math Block's advanced mode, which isn't really that advanced but it does a good job at explaining the errors that might occur. Where it does start to get interesting is in modifying the earlier Line Follower robot to use more advanced maths in the form of a Proportional Controller to get smoother movements. It then covers the more-or-less related blocks: Timer, Round, Random, Logic and Range.

Chapter 15 covers arrays, so finishes what was started in chapter 11 by completing all variable types. It includes a few different robots to illustrate some ways of using arrays such as storing a list of commands to be executed after some condition; counting the occurrences of each color as it comes across them; and a fun memory-type game where the player has to repeat a sequence of lights shown on the brick buttons.

Chapter 16 is about reading/write to files on the brick. These files are persistent across restarts and can be quite useful for a number of things. The book takes you through an example of using files to save the high scores for the memory game created in the previous chapter. Since files use up space on your brick, this needs to be managed somehow. How to do this is explained in the book by taking you through the EV3 software's Memory Browser tool.

Chapter 17 is a whole chapter about one specific use for files - data logging. It takes you through some experiments in measuring and logging sensor values such as motor power readings, and the light sensor readings from the Light Pointer robot above.

Chapter 18 is about multitasking - or running multiple sequences of jobs in parallel. The EV3 brick only has a single CPU but runs the Linux operating system so can run many processes at the same time via time-slicing. The EV3 software makes all this transparent. The book does explain how you can run into problems with busy loops such as status displays consuming all the CPU because the loops run so fast.

Chapter 19 concludes the book with a far superior PID-controller based Line Follower.

I spent many years studying Engineering to understand these control concepts which were built up gradually with lots of maths and theory, but this book makes it very simple to understand by demonstrating it with a real robot. If only we had EV3 in our lectures :)

It explains what each of the three PID control terms achieve and how to tune them for varying conditions. As a challenge you are encouraged to continue increasing the power levels of the motors and tweaking the control terms until you get the fastest and smoothest line follower robot you can.

Summary

You can probably already tell that I loved this book. It covers the perfect blend of material to suit beginners and experienced EV3 programmers alike; and by using example programs to illustrate the concepts, it makes a fantastic learning tool. The use of a single versatile robot to demonstrate the programs is brilliant and makes it easier to build upon earlier lessons. I learnt plenty of things myself and will definitely be using it to coach my kids when it comes time to enter the First LEGO League competitions.

I took my time writing this review, but didn't get time to actually try out all the programs. During the school holidays I will definitely be undertaking a project with my kids to build at least the Line Follower robot. I hope to post a video of the results here when I'm done.

The Art of LEGO Mindstorms EV3 Programming is now available at No Starch Press ($34.95 with free e-book), there is 50% of all e-books at No Starch Press until 26th November using the code GRAVYBOAT, or get it currently on sale at Amazon ($25.34).

5 COMMENTS

to your account to add or reply to comments.
  • Avatar image for Rebrickable user jantjeuh
    10 years, 3 months ago jantjeuh Level 28 PRO
    Dang Nathan, you've really become a Mindstorms fan haven't you :)
    • Avatar image for Rebrickable user Nathan
      10 years, 3 months ago Nathan Level 36 Site Admin ADMIN
      What's not to love about LEGO Robots :)
      • Avatar image for Rebrickable user jantjeuh
        10 years, 3 months ago jantjeuh Level 28 PRO
        Dude, think of Skynet!
        • Avatar image for Rebrickable user TusLego
          10 years, 3 months ago TusLego Level 3
          Remember Shelnutt's Laws:
          1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.

          2. A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law.

          3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
  • Avatar image for Rebrickable user DLuders
    10 years, 3 months ago DLuders Level 20 MOC Designer
    Nice review! I have this book too, and think it is one of the best EV3 references.