Lego Mindstorms for the programmer

Lego Mindstorms

Lego Mindstorms

I just love playing Lego. I like to construct robots and machines. And I really like programming. I like to write programs and frameworks. And not so long ago I found a way to combine these two passions. Lego Mindstorms - a set that includes several motor, sensors and a programmable module that can read information from sensors and control motors.

I will tell more about the Lego Mindstorms and the ways of programming in it.

 

The architecture

  • sensors transmit information to the control module
  • the program running on the module processes information and sends control commands to the motors
  • motors make the construction move

Sensors

The standard Mindstorms 2.0 Invention System kit includes:

Light sensor

This sensor is able to do quite a lot. First, he knows how to read the current color and return its RGB-value. Secondly, he knows how to measure light level. Oh, and finally, he knows how to work as a flashlight.

Two touch sensors

  • button pressed
  • button released
  • button bumped

These sensors are able to register three events:

Ultrasonic sensor

This sensor can measure the distance between obstacles and itself. It is able to measure distances from 0 to 255 centimeters.

Servo motors

There are three motos in the kit. Each can rotate at a given angle (promised accuracy to one degree), as well as read the current rotation angle. The last feature will be really helpfull if the motor is fastened to the wheel controlled by user.

Programmable module

It’s a small computer. CPU at 48 MHz, 64 KB of RAM, 256 KB flash memory, USB 1.1 port and the bluetooth radio.

Programs

From here the fun begins. Along with the standard kit comes the program Mindstorms NXT. This is a graphic shell for writing simple programs. As for me it’s not very comfortable. Here, for example, is the screenshot of a program with a single loop and if:

Lego Mindstorm screenshot

Lego Mindstorm screenshot

Fortunately, there are a number of projects, which allow writing programs on normal programming languages. For example “lejos”. Programs are written in Java, compiled into classes, and then translated into binary format, which is supported by patched control module.

Java is quite true: there are quite a lot of standard libraries, there are strings and even API to work with bluetooth. Moreover, there is a plugin for eclipse. In general, there is everything that a developer can dream of.

A little more about sensors

It’s great that third-party developers also produce sensors for Mindstorms. Search around the internet and you can find the accelerometer, compass, GPS-receiver, a thermometer, infrared sensor, RFID reader, and much more. Unfortunately, one programmable module can support no more than four sensors at a time. So for complex projects you need to use multiple modules working together.

Summary

Overall, Lego Mindstorms is a great way to spend time. I would highly reccoment it to you if you like Lego and want to feel like a mad professor.

Popularity: 10% [?]

Filed Under: fun gadgets

Tags:

RSSComments (0)

Trackback URL

Leave a Reply

You must be logged in to post a comment.

files search