|Everything HP200LX: Knowledge, Products, Service|
Controlling the LEGO MindStorms Robot from an HP Palmtop
If you're looking for a way to use the Infrared port on the HP Palmtop this article may give you an idea or two.
It used to be that kids went through a progressive set of "construction toys" beginning with building blocks then Lincoln Logs and finally settling in with an Erector set.
Nowadays the construction toy of choice seems to be Lego Blocks. These colored pieces of plastic can be hooked together to let a budding engineer build everything from model dinosaurs to skyscrapers. Some of the more elaborate versions of the Lego blocks even have motors and, of all things, a robot-control computer.
The MindStorms Robot
The Mindstorms Robot is a programmable 8 bit computer housed within what looks like a large LEGO brick. It has 3 input ports for touch and light sensors and three output ports for driving motors.
Screen 1: The Lego Robot
The robot kit comes with software that runs only under Windows 95. The language used on the desktop could best be described as Visual Logo, a graphical version of the Logo computer language from the Massachusetts Institute of Technology.
You can develop a complete sequence of tasks for the robot simply by dragging, dropping and connecting various "action-pictures" on the screen. There's very little, if any, coding needed. Programs designed on the desktop are downloaded to the robot though an infrared transmitter attached to the desktop's serial port.
Screen 2: A Sensor
Screen 3: Setup for Programming the Robot
Screen 4: Additional Parts For LEGO Kits
The Palmtop Connection
I've been using The Hewlett- Packard 100LX for many years. It is still unsurpassed as the most versatile palmtop computer available. I've made good use of the PIM software, Lotus 123 and HP Calc, but I'd never had a reason to use the built-in infrared port.
The instant I bought a MindStorms robot, I began searching for a way to control it from my HP 100LX. The HP Palmtop has a large and loyal following and a lot of third-party software is already available; most of it coded by individual Palmtop enthusiasts. I was aware of a couple of programs that, using the built-in IR port, allowed the Palmtop to imitate a universal remote control. I reasoned that it was likely that one of these could be used to accomplish my goal.
Let the User Beware
It is important to note that the IR port on the HP 100LX and the MindStorms unit are I/O ports just like any hardwired port. It is, therefore, possible to cause permanent damage to your computer or robot by sending incorrect signals through this port. Use caution and common sense when experimenting with the IR port. The experiments I have conducted so far seem to have caused no harm but I cannot be held responsible if you damage your own equipment by experimenting with infrared signals or even by following my own experiments to the letter.
The Remote Control 100 Program
Remote Control 100, written for the HP 100LX by Diomidis Spinellis is a very versatile program which proved to work as a control program for the MindStorms robot. RC100 has two modes of operation: learning mode and execution mode. You type "rc -r filename.rcf" on the dos command line to start RC100 in learning mode. In this mode, infrared signals will be accepted into the IR port and assigned to the keys of your choice. When you press the ESC key, the program creates a script file (named on the command line) and exits. Analysis of the script file shows the structure of RC100's own simple programming language. The keys bound in learning mode are followed by their respective IR signals: to human eyes, an incomprehensible string of gibberish. Once you have bound your keys, you can edit the script file using the HP 100LX's Memo editor. The README file included with the Remote Control 100 describes how this can be done.
To control the MindStorms robot, I made use of a feature of the robot which allows it to send and receive IR signals to a second robot. These are the "Send to RCX" and "RCX Sensor Watcher" commands on the Windows 95 programming interface.
The MindStorms robot can send a number, 0 to 255, to another robot. This number can then act as a trigger to activate another set of commands on the receiving robot. Using the RC100 program on my HP 100LX I was able to train the palmtop to imitate another MindStorms robot. I could then program the robot from Windows 95 to monitor for IR signals from the Palmtop and to perform certain tasks, e.g., start, stop, turn left or right when these signals were received.
Putting the Palmtop in Control
These are the steps I took to make my HP 100LX speak the language of the MindStorms robot:
1. Program the robot to send a number through it's IR port. This is done by programming a touch sensor watcher to send the desired number when it is pressed. There are two touch sensors included with the MindStorms kit, so the robot can be programmed to send two numbers. This is your "training " program.
2. Make a test program which monitors the IR port for those two numbers. I wrote one which made the robot beep when the signal was received. Download this "test" program to a different program slot on your robot than the "training" program.
3. On the HP Palmtop, start up the Remote Control 100 program in learning mode ("rc -r file.rcf"). The program will ask you to press a key that you want to bind to an IR signal. Place the IR window on the robot facing the IR window on the Palmtop and turn the robot on. Start your "training" program. On the Palmtop, press the key you want to bind. The RC program now waits for an IR signal. On the robot, press touch sensor #1. The IR signal should be sent to the Palmtop. Now the Palmtop will ask you to bind another key. Bind this second key to the number sent by touch sensor #2. Press ESC on the Palmtop to exit.
4. The file you named on the RC command line should now exist. You can now start the RC program in execution mode by typing "rc file.rcf". This will cause the keys you bound to become active. By pressing them the Palmtop will send out the same signals it received from the robot. The screen on the Palmtop will be blank but the keys will work nonetheless. Start the "test" program on the MindStorms robot. When you press the keys that you bound in the training step, your robot should respond like you programmed it to.
That's it! Now, repeat the above steps so that your Palmtop can learn more MindStorms numbers then edit the script files together and dress them up nice.
The RC 100 program only seems to work when it is in 64 column (medium) text mode.
I could not get the .EXM version of RC 100 to work properly. However you may have better luck than I did. The .EXE version of the program works fine.
You might need to edit your final script file a couple times before it works right. If you do not observe the correct protocol when cutting and pasting within Memo it does not seem to work.
Obviously, you should not use an editor that imposes its own formatting or reinterprets characters in any way. The characters in the RC script file translate into electrical impulses and should NOT be messed with (see my cautionary note, above).
All images in this article are copyright 1998 by The LEGO Group. LEGO and MindStorms are trademarks of The LEGO Group. The LEGO Group does not endorse the procedure outlined here. Remote Control 100 is copyright 1993, 1994 by Diomidis Spinellis. I have no affiliation with Mr. Spinellis. Please direct specific questions about RC 100 to its author. The HP 100LX was manufactured by Hewlett-Packard. HP no longer makes the 100LX but the procedure outlined here should work on the HP 200LX.
Copyright © 2010 Thaddeus Computing Inc