TweetFollow Us on Twitter

May 01 Cover Story

Volume Number: 17 (2001)
Issue Number: 05
Column Tag: Robotics

Introduction to Lego Midstorms Robotics for the Mac

by Matthew N. Nathan


Using the Lego Mindstorms Programmable Brick on your Macintosh can be tricky but definitely worth the effort. The purpose of this article is to introduce the Lego Mindstorms RCX Brick and the sensors, motors, lights and software associated with it as well as to guide you through the procurement, setup and installation of your own personal Lego robotics lab.

What is Lego Robotics?

Lego Robotics is a system of plastic Lego pieces including gears and pulleys, coupled with a small, battery powered Lego computer: the RCX Programmable Brick. The RCX Brick is about the size of two packs of cigarettes laid side by side, is powered by six AA batteries and can store up to five programs in separate memory locations. The RCX Brick is connected via its input ports to small, Lego sensors including touch, light, and temperature sensors. Output devices can also be connected to the RCX Brick including little Lego lights and motors used to power and move robots. The Lego robot is programmed using an icon-based programming environment called Robolab, designed to resemble LabView by National Instruments. Programs are then compiled and downloaded from the computer to the RCX Brick via an infrared tower connected to the computer's serial port.

Figure 1. The Lego RCX Brick with size comparison

Once the program is downloaded to the RCX Brick the Lego robot is free from the computer. Programs downloaded into the RCX Brick will stay in memory even if the RCX Brick is turned off. Using the Robolab programming environment, the RCX Brick and the Lego Dacta pieces, including sensors and motors, you can create fully autonomous, wireless robots that respond in real time to environmental stimuli.

The RCX Brick also has data logging capabilities and can record and store sensor data. Data can be uploaded back to your Mac later, or, if you maintain line of sight between your RCX Brick and your IR tower you can record data points in real time on your Mac. The Robolab software has graphing and data manipulation tools and also can output sensor date to Excel for further manipulation.

A Breif History of Lego Robotics

The Lego Mindstorms RCX brick that we enjoy today is the product of years of research, tinkering and play by faculty and researchers at the MIT Media Laboratory including Seymour Papert, Mitchel Resnick, Fred Martin, Rick Borovoy, Robbie Berg and Randy Sargent. As a sponsor of the Media Lab, Lego has first access to technologies researched and developed by the Media Lab. Lego's RCX Mindstorms Programmable Brick is a direct result of the research at the Media Lab. That said, the RCX Brick is completely different from the MIT Programmable Brick's internal construction. Research into smaller bricks, alternative programming environments and new sensors continues at the Media Lab today. For more information visit the Epistemology and Learning Group's Programmable Brick home page at

Lego Mindstorms was first released to consumers in 1998. The original consumer release, called Mindstorms, came with software of the same name that is Windows only. At the same time, Lego also released the Robolab product, essentially a Mindstorms kit bundled for schools and equipped with the Robolab programming environment, a Mac and Windows compatible programming tool.

Getting Started

Before you can really get started building and programming your Lego robots you need to buy your materials, which is easy, if you know where to look. In order to program your RCX on the Macintosh you need to buy the Robolab software, at the very least. If you go to any large toy store and buy the consumer packaged Lego Mindstorms set you get a RCX Brick, and IR tower, plastic Lego pieces and the PC-only Mindstorms programming environment. Do not do this. Follow the instructions below to set up and run Lego robotics on the Macintosh.

To buy Lego Robotics kits for the Macintosh buy from Pitsco-Lego Dacta. Pitsco-Lego Dacta is a subsidiary of the Lego Corporation and the only educational distributor for Lego in the United States. Pitsco-Lego Dacta has no stores, and their products are generally not carried in retail outlets. The only way to order from them is via the web at or via telephone at (800) 362-4308. Robolab, as an educational product is only available from Pitsco-Lego Dacta.

This author recommends that you buy all your Lego robotics materials from Pitsco-Lego Dacta including Lego pieces, motors, sensors, RCX Bricks and software. Many educational bundles of Lego are a better value than their consumer counterparts. Educational sets often include more pieces and better documentation for the same price.

To get started using Lego robotics you need: one RCX Brick, one IR tower/transmitter, the Robolab software, batteries (6 AA for the RCX, one 9V for the IR tower), touch and light sensors, motors, lamps and wires, and enough Lego dacta pieces, including gears and wheels, to build the body of your robot. A ballpark figure: to outfit yourself from scratch with a well-stocked Lego robotics lab may cost around $400.

Also, if you have a newer Macintosh without a serial port you will need to buy a USB to serial adapter. Pitsco-Lego Dacta recommends the Entrega USB to serial adapter and sells it through their catalog and web site. Be sure to use Robolab version 2.0 with your USB Mac, as earlier versions do not support the USB to serial connection.

If you have already purchased Lego Mindstorms from a consumer outlet do not despair. You can buy the Robolab software, a Macintosh serial cable and a USB to serial converter from Pitsco-Lego Dacta. All the other parts in the Mindstorms kit are fully compatible with your Macintosh.

The RCX Programmable Brick

The RCX Brick is a small computer with input and output ports, a small LCD screen to display important information, an infrared transmitter and receiver for communication. It has a small, built-in speaker and can play individual MIDI notes (no chords) or certain pre-programmed sounds. The RCX Brick is powered by six AA batteries but can also connect to an AC adapter.

The three input ports on the RCX Brick are labeled 1, 2, and 3. Each can connect to an external sensor. Currently the following sensors are available through Pitsco-Lego Dacta: touch sensors, light sensors, angle sensors, rotation sensors, and temperature sensors. These sensors are manufactured by Lego are connected to the RCX via wires ending in 2x2 Lego stud plates. The Lego studs (the little bumps on the top of a piece of Lego that lock into other pieces when you build) on the sensors contain metalicized connecters that conduct power and data between the RCX Brick and connected sensors. Third party sensors are also available through Pitsco-Lego Dacta including humidity, ph and voltage.

You can stack multiple sensors to one sensor input port (i.e. by stacking their 2x2 stud plates on the same input port on the RCX Brick). For example, you could stack two touch sensors, touch1 and touch2, onto port 1 on the RCX Brick. However for programming purposes they are indistinguishable. If either touch1 or touch2 is pressed the RCX will read “touch at port 1.”

Figure 2. Lego touch sensor and lamp

The output ports on the RCX Brick are labeled A, B and C. The only output devices currently available are motors and lamps. Motors connect to gears, pulleys and axels and are use to make the Lego robots move. The lamps are small LEDs embedded in 2x1 Lego bricks. Both motors and lamps have metalacized contacts and connect to the RCX Brick via Lego wires like the sensors.

Figure 3. Detail of a Lego wire. Note the metalicized studs.

The Lego sensors are all fairly accurate and are adequate for most robotics projects. Plus, they are inexpensive (from $11 to $27.50) and very easy to use. However, for those of you interested in more professional sensors, DCP, a manufacturer of scientific probes has created, with Pitsco-Lego Dacta, a DCP sensor to Lego RCX adapter. The DCP sensors are very expensive compared to the Lego sensors. They cost between $55 and $195 per sensor and to use any of the DCP sensors the user must also buy the Lego to DCP sensor adapter for $55.

The IR transmitter and receiver on the RCX Brick can communicate with the IR tower, other RCX Bricks or the Lego RCX IR remote control. Unfortunately, the RCX Brick uses a custom IR modulation protocol that makes it very difficult to communicate with other IR devices such as Palms, and IR equipped Macs.

The IR transmitter and receiver on the RCX Brick can operate in low and high power modes. The maximum range for IR communication is approximately 40' but this author has not had reliable success beaming IR commands from tower to RCX beyond a range of 4'.

Also, direct sunlight and fluorescent lighting can interfere with infrared communication. If you are unable to get a reliable signal between your IR tower and your Mac, or if you know your cables and port settings are correct but you continue to get error messages, lighting may be your problem. A simple solution to light problems is to construct a table tent: fold a 8” x 10” piece of paper in half lengthwise and let it rest over the IR tower and the RCX Brick when you are downloading programs or uploading data.

The IR remote can turn the RCX on and off, select and run programs and turn power to individual output ports on and off. The remote control is particularly useful in situations where the “run' button on the RCX is hard to reach due to Lego construction around it.

Besides the RCX Brick, IR tower and software, you will need plastic Lego pieces before you can get started building robots. The Lego RCX Brick is compatible with all Lego sets and pieces. The one exception to this rule is Lego Duplo pieces. Lego Duplo is the extra-large Lego pieces designed for very young children. Duplo is not compatible with other Lego because of its size; it's just too big.

Figure 4. Traditional Lego bricks and plates

Though older Lego is compatible with the RCX Brick, you will need specialized Lego dacta pieces in order to construct most robots. The specialty pieces include a variety of gears, cam shafts, pulleys, axles, beams, bushings, connector pegs, and other pieces specially designed for more sophisticated Lego robotic construction. Your old bricks, plates and other pieces are perfectly usable in your new Lego robots but you will most likely need to buy more Lego to have success building new robots.

Figure 5. Lego gears and pulleys

Figure 6. Lego axles, bushings, connector pegs and other specialty pieces

Lego Sensors

A variety of sensors can connect to the RCX Brick. Standard Lego sensors include touch sensors, temperature sensors, light sensors, angle sensors, and rotation sensors. Touch sensors are simple button switches with two states: in and out. The temperature sensor is quite accurate within a reasonable range. It is made of plastic so be careful not to expose it to extremely high temperatures or the sensor will melt. The light sensor senses reflected light through a small aperture and reads values 1 - 99. The light sensor reading does not correspond to any traditional measure (watts, lumens, candles). Readings are measured in Lego light units (LLUs). Angle sensors and rotation sensors both connect to Lego axles and measure the change in angle from a zero degrees and the number of rotations of the axle, respectively.

Figure 7. Lego temperature sensor and light sensor

Robolab Programming

Pilot Programming

Programs written on your Macintosh using the Robolab programming environment control the RCX Brick. Robolab is an icon-based programming tool and, as such, has no written programming language. Robolab has two separate programming interfaces: Pilot and Inventor. Each interface is divided into four levels. At each level the user has more programming options than the level before until finally, at level four, the user has access to the complete functionality of the Robolab programming environment. You may wish to look at programs written in levels one through three to get a feel for the programming but when you sit down to do your own programming this author recommends using level four.

To create a Pilot program click on an icon on screen to get a pop-up menu of all the programming options for that port, device or conditional. Choose the command you wish from the options and it automatically gets put into your Pilot Robolab program.

Figure 8. Simple Pilot level 1 program. This program turns on a motor connected to port A for four seconds and then ends. Note the pop-up output menu.

The Pilot programming interface is very easy. It is used in schools with students as young as eight years old. The Pilot interface gives the user basic input and output functions using timers, touch sensors, light sensors, lights and motors. If you wish to use other sensors (temperature, for example) you will have to write your program using the Inventor programming interface.

Another key difference between the Pilot and Inventor programming interfaces becomes apparent when we look at the logic structures. All Pilot programs execute sequentially. Using the Pilot interface the user cannot create if-else loops, subroutines, or run tasks in parallel. Also, the looping structures available in the Pilot interface are quite limited: repeat the entire program once or repeat the entire program forever. After becoming familiar with the Pilot interface it is suggested that you continue on to Inventor to continue your programming.

Figure 9. One step of a Pilot level 4 program. This program turns on a motor rotating clockwise connected to port A at a power level of five, a lamp connected to port B at a power level of three and a motor connected to port C, rotating counterclockwise at a power level of three. Then, when the touch sensor connected to port 1 is pushed in, the program continues to step 2. Note the looping structures popup window to repeat once or repeat forever.

Inventor Programming

The Inventor interface looks quite different from the Pilot interface. It uses floating palettes (tools, functions, help, etc.) and much less is done for you in building your programs. Like the Pilot interface, the Inventor interface is divided up into four levels, with each level offering increased functionality and programming capabilities.

Though it is more sophisticated than the Pilot interface, Inventor still uses icons to represent inputs, outputs, conditionals and other logic structures. Programs are written by dragging commands (represented by icons on the Functions palette) into the program construction window. Once the icons are assembled they must be connected to one another using the connecting wire tool from the tools palette.

Inventor allows you to create if-else loops based on sensor data (i.e. if the temperature sensor reads above a certain temperature then do X, else do Y), internal counters, timers and variables. You can create counting loops and go to statements all iconicly. Go to statements are represented as "jumps” and "lands.” Think of it like this: the jump command jumps the program's sequential execution from the jump statement to a land statement somewhere else in the program before or after the jump. Effectively you can use jump commands to jump backwards in your program to repeat a set of instructions until a condition is met. You can also use jumps and lands to jump forward out of a loop when a condition is met and continue with your program's execution.

Figure 10. A simple Inventor level 4 program. Note floating functions and tools palettes.

Inventor also allows you to record sensor data and counters in variables represented as color-coded "containers.” You may perform simple calculations with container data (addition, subtraction, multiplication and division) and use container data in conditionals. For example, if you build a merry-go-round and you want it go around four times before stopping to give your patrons a fair ride, you can connect a rotation sensor to the main axle of the merry-go-round and store the number of rotations from the sensor in a container. You can then use that container as a part of a loop to run the merry-go-round. The program would keep the motor running, and the merry-go-round going until the value of the container is greater than four then it would stop the motor.

Another very cool feature of the Inventor programming interface is the ability to program RCX to RCX communication. RCX Bricks can communicate to one another via the IR port on the RCX. They must have line of sight to communicate and be within range. RCX Bricks can send simple "I see you” commands or they can beam container data back and forth. However, if you have multiple RCX Bricks talking to each other, at this point there is no way to distinguish in your programming "send a message to RCX 1 but not RCX 2.”

Figure 11. Inventor level 4 with all palettes open: Functions, Modifiers, Music, Reset, Wait For, Structures, Container and RCX to RCX Communication.

Robolab Programming - Investigator

The Investigator programming interface is used exclusively for data gathering using the RCX Brick and is new in Robolab 2.0. Essentially, using the Investigator interface the user can program the RCX Brick to record sensor data from input ports that can be logged or immediately uploaded back to the Macintosh.

Figure 12. Investigator Level 1 program. This program will record a data point from the light sensor connected to port 1 every second until it has recorded 10 data points. Note the popup wait for window.

In Investigator the user can control the number of data points the RCX records as well as the frequency that points are recorded. Like the Pilot and Inventor interfaces, Investigator is divided into five levels with new functionality introduced at each. At lower Inventor levels the user can only control the data logging functions of the RCX Brick. However, at higher levels the user has access to some of the most sophisticated commands available in Robolab. Investigator level five allows the user to perform significant data manipulation using one-dimensional arrays and a variety of calculation functions. Investigator level five also allows for more robust RCX to RCX communication. The user can turn other RCX Bricks on and off, run or stop programs on the other RCX and change the program number (1 - 5) that is being run by the other RCX Brick.

Lego Robots and Resources

Perhaps the biggest challenge in creating working Lego robots is having the mechanical engineering knowledge to take a handful of motors, axles and gears and fit them together in a way that accomplishes the robotic construction goal you have in mind. There are several resources to help with Lego building.

Print Resources

One resource that any experienced Lego builder has at his or her disposal is Lego's own construction blueprints and diagrams. These blueprints provide step-by-step building instructions for creating specific machines or robots. The blueprints outline all the pieces needed for a given construction as well as the program needed to make the construction run. Different Lego Robotic kits come with different kits and the user can also buy blueprints on their own. Even older Lego blueprints that do not include the RCX Brick can be redesigned by a creative engineer to incorporate motors, lamps, sensors and the RCX Brick.

Another extremely useful resource available to the novice Lego engineer is the Lego Constructapedia. The Constructapedia contains some step by step building blueprints but the most valuable part of the Construtapedia are the Lego clichés: small pictures of particularly useful mini-constructions. Rather than provide an entire robot's construction, this section of the Constructapedia shows details of larger constructions, parts of the whole that can be replicated for a variety of uses. Useful constructions ranging from rack and pinion steering systems to cantilevered wheels and casters are all depicted in the Constructapedia.

Several books are also currently available from third party publishers about Lego robotics that are worth mentioning. Dave Baum's Definitive Guide to Lego Mindstorms (Technology In Action) and Extreme Mindstorms: an Advanced Guide to Lego Mindstorms, both by Dave Baum are very good books about Lego robotic construction and alternative programming languages. Dave Baum is the creator of NQC (Not Quite C) and his first book is very NQC-centric. Extreme Mindstorms was released in October 2000 and contains more information about NQC, pbForth and LegoS, all alternative programming environments for the RCX Brick. Extreme Mindstorms also includes information about making your own sensors at home to expand the capabilities of the RCX. The Unofficial Guide to Lego Mindstorms Robots, by Jonathan Knudsen provides a good overview of alternative programming environments, home built sensors and how to build sturdy Lego constructions. The Unofficial Guide is published by O'Reilly and is a good technical reference.

Online Resources

In addition to the print materials available about Lego robotics, there is an extensive collection of Lego robotics resources online., the official Lego Mindstorms site, has an extensive image bank documenting robots created by users around the globe. The web site also has robots built by Lego's own expert builders. Blueprints are not provided for the robots, but they can be studied to learn new design concepts or to get new building ideas. (Lego Users Group) is the largest online community of Lego enthusiasts with active bulletin boards, Lego auctions and pages and pages of content. Only a portion of the site is devoted to Lego robotics, per se, but their Lego robotics pages are excellent. is an excellent place to comb for answers to technical questions, share innovation or just talk with other like-minded Lego robotics. also has extensive links to other Lego sites on the web. It is an excellent jumping off point for Lego robotics web browsing, in general.


Lego robotics on the Macintosh is extremely exciting. The capabilities of the RCX will only increase with time. Future developments in the RCX will include increased miniaturization of the RCX technology, introduction of new sensors and output devices and increased communication capabilities via IR and the Internet.

Matthew N. Nathan is an educator and explorer of the intersection of digital technologies and education. He is co-founder and chief executive officer of Vision Education, an educational technology company enabling schools and after school programs to integrate technology effectively into education for youth. Matthew is an instructor at The Stonington Retreat, a Lego Robotics and Logo retreat for teachers in costal Maine. He is an experienced Lego robotics user and educator. Matthew can be reached at


Community Search:
MacTech Search:

Software Updates via MacUpdate

World of Tanks Generals guide - Tips and...
World of Tanks Generals is a brand new card game by the developer behind the World of Tanks shooter franchise. It plays like a cross between chess and your typical card game. You have to keep in consideration where you place your tanks on the board... | Read more »
TruckSimulation 16 guide: How to succeed...
Remember those strangely enjoyable truck missions in Grand Theft Auto V whereit was a disturbing amount of fun to deliver cargo? TruckSimulation 16 is reminiscent of that, and has you play the role of a truck driver who has to deliver various... | Read more »
The best GIF making apps
Animated GIFs have exploded in popularity recently which is likely thanks to a combination of Tumblr, our shorter attention spans, and the simple fact they’re a lot of fun. [Read more] | Read more »
The best remote desktop apps for iOS
We've been sifting through the App Store to find the best ways to do computer tasks on a tablet. That gave us a thought - what if we could just do computer tasks from our tablets? Here's a list of the best remote desktop apps to help you use your... | Read more »
Warhammer 40,000: Freeblade guide - How...
Warhammer 40,000: Freebladejust launched in the App Store and it lets you live your childhood dream of blowing up and slashing a bunch of enemies as a massive, hulking Space Marine. It's not easy being a Space Marine though - and particularly if... | Read more »
Gopogo guide - How to bounce like the be...
Nitrome just launched a new game and, as to be expected, it's a lot of addictive fun. It's called Gopogo, and it challenges you to hoparound a bunch of platforms, avoiding enemies and picking up shiny stuff. It's not easy though - just like the... | Read more »
Sago Mini Superhero (Education)
Sago Mini Superhero 1.0 Device: iOS Universal Category: Education Price: $2.99, Version: 1.0 (iTunes) Description: KAPOW! Jack the rabbit bursts into the sky as the Sago Mini Superhero! Fly with Jack as he lifts impossible weights,... | Read more »
Star Wars: Galaxy of Heroes guide - How...
Star Wars: Galaxy of Heroes is all about collecting heroes, powering them up, and using them together to defeat your foes. It's pretty straightforward stuff for the most part, but increasing your characters' stats can be a bit confusing because it... | Read more »
The best cooking apps (just in time for...
It’s that time of year again, where you’ll be gathering around the dinner table with your family and a huge feast in front of you. [Read more] | Read more »
Square Rave guide - How to grab those te...
Square Rave is an awesome little music-oriented puzzle game that smacks of games like Lumines, but with its own unique sense of gameplay. To help wrap your head around the game, keep the following tips and tricks in mind. [Read more] | Read more »

Price Scanner via

Cyber Monday: Apple MacBooks on sale for up t...
Apple resellers have MacBook Pros, MacBook Airs, and MacBooks on sale for up to $250 off MSRP for Cyber Monday 2015. The following is a roundup of the lowest prices available for new models from any... Read more
Cyber Monday: 15% off Apple products, and sto...
Use code CYBER15 on Cyber Monday only to take 15% on Apple products at Target, and store-wide. Choose free shipping or free local store pickup (if available). Sale prices for online orders only, in-... Read more
iPad Air 2 And iPad mini Among Top Five Black...
Adobe has released its 2015 online shopping data for Black Friday and Thanksgiving Day. The five best selling electronic products on Black Friday were Samsung 4K TVs, Apple iPad Air 2, Microsoft Xbox... Read more
All-in-one PC Shipments Projected To Drop Ove...
Digitimes’ Aaron Lee and Joseph Tsai report that all-in-one (AIO) PC shipments may drop a double-digit percentage on-year in 2015 due to weaker-than-expected demand, although second-largest AIO make... Read more
Sprint Offers iPad Pro
Sprint now offers Apple’s new iPad Pro with Wi-Fi + Cellular, featuring a 12.9-inch Retina display with 5.6 million pixels. Customers can pick up iPad Pro at select Sprint retail locations. It can... Read more
Cyber Monday: Target offers 15% discount on A...
Target has discounted Apple Watches by 15% for Cyber Monday. Choose free shipping or free local store pickup (if available). Sale prices for online orders only, in-store prices may vary: - Apple... Read more
Sunday roundup of Holiday weekend Mac sales:...
Take up to $500 off MSRP on the price of a new Mac at B&H Photo today as part of their Black Friday/Holiday weekend sale. Shipping is free, and B&H charges NY tax only. These prices are... Read more
Holiday weekend: Apple Watch on sale for $50-...
B&H Photo has the Apple Watch on sale today for $50-$100 off MSRP. Shipping is free, and B&H charges NY sales tax only: - Apple Watch Sport: $50 off - Apple Watch: $50-$100 off Read more
Holiday weekend: iPad Air 2s on sale for up t...
B&H Photo has iPad Air 2s on sale for up to $80 off MSRP including free shipping plus NY sales tax only: - 16GB iPad Air 2 WiFi: $459 $40 off - 64GB iPad Air 2 WiFi: $569 $30 off - 128GB iPad Air... Read more
Holiday weekend Mac sales roundup: B&H Ph...
B&H Photo continues to have all new Macs on sale for up to $500 off MSRP as part of their Black Friday/Holiday weekend sale. Shipping is free, and B&H charges NY tax only: - 15″ 2.2GHz Retina... Read more

Jobs Board

Technical Program Manager, Strategic Merchant...
# Technical Program Manager, Strategic Merchants - Apple Pay Job Number: 44001177 Santa Clara Valley, Califo ia, United States Posted: Oct. 30, 2015 Weekly Hours: 40.00 Read more
Frameworks Engineer, *Apple* Watch - Apple...
# Frameworks Engineer, Apple Watch Job Number: 41403122 Santa Clara Valley, Califo ia, United States Posted: Jul. 1, 2015 Weekly Hours: 40.00 **Job Summary** Join the Read more
Software Engineer - *Apple* Pay - Apple (Un...
# Software Engineer - Apple Pay Job Number: 44003246 Santa Clara Valley, Califo ia, United States Posted: Nov. 16, 2015 Weekly Hours: 40.00 **Job Summary** Apple Pay Read more
Merchant Operations Manager: *Apple* Pay -...
# Merchant Operations Manager: Apple Pay Job Number: 43593822 Santa Clara Valley, Califo ia, United States Posted: Nov. 10, 2015 Weekly Hours: 40.00 **Job Summary** The Read more
Product Design Engineer - *Apple* Watch - A...
# Product Design Engineer - Apple Watch Job Number: 41727161 Santa Clara Valley, Califo ia, United States Posted: Jul. 22, 2015 Weekly Hours: 40.00 **Job Summary** Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.