Summary
- The Micro Scout can be program by flashing a light at it.
- Use transparancies
as a low tech means of doing this.
- The Micro Scout stores one program of 15 instructions.
Disclaimer
This work is not sanctioned by LEGO. I am an enthusiast who cannot wait
for correct procedures to be made known. There may be other features
hiding in the Micro Scout that LEGO has not yet even hinted at. In
particular, only 29 of the 127 VLL codes are documented. The undocumented
codes, alone or in a prescribed sequence, may remove any or all observed
limitations. I am assuming they do not do anything.
Background
The Droid Developers Kit is the first and only MindStorms set that many of
us have either because is was cheap or because it offers R2D2. After
playing with the toy programs built into the brick, the mysterious P mode
cries out yearning to be discovered. The manual tells us to check the web
site for more information but the web side declines to comment
stating: check back in Fall 2000.
Fortunatly the Scout SDK has an appendix that shows the codes understood by
the Micro Scout and ties these in to bar codes understood by the Code
Pilot. Analysing the bar codes was the first step.
Understanding VLL
VLL is a binary bar code comprised of: Start bit, Checksum, Data, Stop bit.
A simple example shows encoding VLL message 0 (Motor Forward for both the Code
Pilot and the Micro Scout):
A VLL code is 35 time intervals in length. The start bit is 1 unit wide,
the stop bit is 3 units plus the space before it. The checksum and data
are binary digits with 0 being two spaces and a bar while 1 is a space and
a double width bar. The checksum is 3 digits and the data is 7 digits.
The data is the VLL code from 0 to 127. To determine the checksum for VLL
code n in C or Perl:
7-((n+(n>>2)+(n>>4))&7)
In BASIC: 7-(n+int(n/4)+int(n/16)) mod 8
This formula was derived from analysis of about 30 bar codes for the Code
Pilot.
Talking VLL to the Micro Scout
If you have a Scout, the easist way is to get the SDK and have the Scout
talk to its little brother. Skip on to the next section to take the easy
way out.
The first step is to determine light and dark. This easiest done by running
the built in Seek Light program (3.) I could not get white paper to register
as light so I photocopied the bar codes onto overhead transparencies. Ok, I
could get a code to register if I held the piece of paper 4 inches away from a
60 watt light bulb and then, it would only register once of every dozen scan
attempts. I had the best results when placing the MicroScout on a table
directly under a bright light bulb (point source) and passing the transparency
directly over the sensor.
Note that the Micro Scout uses the light level when it is first powered on
to indicate darkness. Ensure the sensor is getting a view of what you
are trying to call black when powering on the Micro Scout to ensure proper
calibration of the bar codes you wish to scan.
The Code Pilot has a standard bar width of 1/32 of an inch. My Micro Scout
could not decode these. I expanded them up to 1/8 inch. This allows 3 large
codes per transparency. Future eperimentation may prove a smaller bar code
will suffice. I chose to print the codes 2.5 inches high to ensure the sesnor
is registering the bars and not the white above or below the code. For now,
grab a copy of my Postscript program which prints all 29 documented codes the
Micro Scout on 10 pages and try it out for yourself.
Print Your Own Micro Scout VLL Transparancies
Chose either the
original Postscript program
or a distilled
PDF file.
If you have no transparancies handy or no printer for that matter, try cutting
a piece of paper into strips and sealing them inside of plastic wrap or wax
paper.
The next step for me will be to bring an old computer out of retirement and
let it control an LED directly (emulating the scout) so I do not have to
keep all the transparencies around. One thing I assume will be required is
a period of light before the start bit. This will remain theory until I
have time to experiment further or someone else beats me to it.
UPDATE: It is true as can be read in the comments of the RCX 2.0 tools from
LEGO. In RCX2VLL.h we find "VLL output must be ON for at least 400mS
(wait 40) before vll_start" and we further discover the base time unit to be
20ms (wait 2) for a thin bar and 40ms (wait 4) for a thick bar.
My transparencies, including the rate at which I moved them, were apparantly
within tolerance of this.
Writing a Program
First turn the Micro Scout on and place it in P mode. Remember that it
calibrates its light sensor for darkness when first turned on.
Flash one of the 17 scripting codes at it. You just started a new program.
Any previous program was erased. Flash some more scripting codes to create
a longer program.
Execute the Program
The Run button executes the current program. The script is completed. If you
want to add to a script once it has executed, you have to reenter it from
the beginning. This is not too bad since the longest program you may enter
is only 15 instructions. The VLL code Run performs the same function as
the Run button.
General Obervations
-
VLL is disabled while a program or script is running. Reset and Motor Stop
are ignored as far as I can tell. The only way I could interupt a program
is with the buttons and not my bar codes.
-
The motor may be moved in steps of 0.5, 1.0, 2.0 or 5.0. These roughly
correspond to the time the motor is being driven in seconds. They also
roughly correspond to the number of revolutions the motor makes: 1.5, 3, 6,
15 or 3 times the listed number for a sum of 90 RPM. This cannot be
accuratly tested as the Micro Scout plays a tune before turning on the
motor every time. This is anoying.
-
The motor coasts for 3 revolutions after power is cut if there is no load.
Analysis of Built in Programs
Leave the Micro Scout in P mode and have access to the build in programs.
- One Direction
- 23: Motor Reverse 5.0
- 23: Motor Reverse 5.0
- 23: Motor Reverse 5.0
Motor actions always play a beep sequence before moving.
This program is functionally identical to the built in one.
- Two Directions
- 23: Motor Reverse 5.0
- 19: Motor Forward 5.0
- 23: Motor Reverse 5.0
- 19: Motor Forward 5.0
- 23: Motor Reverse 5.0
- 19: Motor Forward 5.0
Motor actions always play a beep sequence before moving.
This program is functionally identical to the built in one.
- Seek Light
- Light Control
- There is no apearant way to check for flashing lights from within a
program.
- Keep Alive
- Alarm
- 29: Wait For Light
- 16: Motor Forward 0.5
- 20: Motor Reverse 0.5
- 16: Motor Forward 0.5
- 20: Motor Reverse 0.5
- 16: Motor Forward 0.5
- 20: Motor Reverse 0.5
- 16: Motor Forward 0.5
This sequence beeps between movements. The built in Alarm program does
not. It would be real nice if we could find a way to turn the motor in a
program without having to wait for or listen to the beep every time.
- Code
Tips
Daniel Reynolds writes:
In case you're interested, I found that if you use a laser pointer for the
light source then you can use regular white paper for the barcodes (the
paper just has to be directly in front of the light sensor), and I can get
it to register the barcode about fifty (or higher) percent of the time.
FAQ
Q1: Can I scan the barcode on my computer screen?
A1: No. A typical computer display scans the entire screen 60 to 85 times per
second with a very bright light, much faster than you would move the Micro Scout
across the screen. The refresh rate of the screen is very close to the bit rate
of the Micro Scout (50 bars per second at the nominal 20ms per bar rate.)
A good introduction to the principles of TV (and why you cannot scan it) may be
found at How Stuff
Works.
Newer flat panel monitors suffer the same refresh issues of the older vacuum
tube sets. The TFT LCD display refreshes the screen at a very fast rate to
prevent blur with fast moving objects. If you have an old 486 laptop (the kind
where moving the mouse causes a tail that takes 4 seconds to fade away) you may
be in luck. These never were popular for home displays as they were expensive
and terrible for FPS gaming. Newer displays (Pentium and up) have fast decay
and fast refresh leaving a screen that looks solid but in reality, it is
blinking so fast your brain cannot dectect it.
WARNING: Scanning your screen with the Micro Scout may scratch it! If
you ignore what I just said and try to scan your screen anyway, please protect
it with a piece of clear plastic first. Remember, some plastic wraps are so
thin scanning could rip them. Take care..
Q2: Can the RCX speak VLL?
A2: The 2.0 firmware upgrade allows this. Get it from
www.lego.com.
Q3: What do the build-in programs do?
A3: If you lost the manual or recieved a second-hand Micro Scout without a
manual, you may get a copy from the authorized site for redistribution of older
LEGO manuals:
Brickshelf.com. The built-in programs are described on pages 7 to 9.
Questions? See the
elecbrick™ FAQ.
Comments? doug@elecbrick.com.
elecbrick™ is a trademark of Doug Eaton.
LEGO© is a trademark of The LEGO Company which does not sponsor, authorize
or endorse this site. Please visit
www.lego.com.
Not responsible for errors or omissions.
These inventories and descriptions are for informational purposes only.