|Motor/Sensor Expansion Board for Handy Cricket|
The Motor/Sensor Expansion Board is easy to use. Start off by plugging it into your Handy Cricket. You can use either bus port they're both the same.
The Board provides two additional motor outputs, named c and d. The Handy Cricket includes commands for using them; they work just like the Crickets built-in motors.
The motor outputs respond to the standard motor commands on, off, thisway, thatway, rd, onfor, and setpower.
For example, to turn on motor output c:
To turn on motor output d at full power for 2 seconds:
d, setpower 8 onfor 20
There are four sensor inputs on the Expansion Board, numbered from 1 to 4. These inputs use the same connector as the analog sensor connector on the Handy Cricket itself. Any sensor for the Handy Cricket may be used with the Expansion Board; plus, the Expansion Board gives new sensor capabilies (encoders) that the Handy Cricket does not have.
All of the sensor command require the driver file shown below. The contents are also available here. These driver procedures should be copied and pasted into the Cricket Programs window, along with your own procedures for running the Cricket.
There are four new commands for reading the sensor inputs 1 through 4: sensor1, sensor2, sensor3, and sensor4.
For example, to beep if the value of sensor 1 is less than 50, try this test program:
to beeptest loop [ if sensor1 < 50 [beep] ] end
The four inputs can also be used with switch/pushbutton sensors. The commands then used are switch1, switch2, switch3, and switch4.
For example, to beep if a switch plugged into sensor port 1 is pressed, try:
to beeptest loop [ if switch1 [beep] ] end
The sensor ports have 8-bit A/D converters; converted readings are in the range 0 to 255.
; motor commands c, cd, and d, are already built in to the Cricket! global [x] to sensor1 output sens 1 end to sensor2 output sens 2 end to sensor3 output sens 3 end to sensor4 output sens 4 end to switch1 output (sens 1) < 128 end to switch2 output (sens 2) < 128 end to switch3 output (sens 3) < 128 end to switch4 output (sens 4) < 128 end to sens :n bsend $112 setx bsr :n - 1 output x * 256 + bsr 0 end to counts :n bsend $112 setx bsr :n + 7 output x * 256 + bsr 0 end to resetc :n bsend $112 bsend $f + :n ; counter 1 is at $10 bsend 0 end to velo :n bsend $112 setx bsr :n + 3 output x * 256 + bsr 0 end to quad12 bsend $112 setx bsr 12 output x * 256 + bsr 0 end to resetq12 bsend $112 bsend $14 bsend 0 end to quad34 bsend $112 setx bsr 13 output x * 256 + bsr 0 end to resetq34 bsend $112 bsend $15 bsend 0 end
Up to two Motor/Sensor boards may be used on one Cricket. The second board should be modified by soldering a jumper wire across the ID holes located along the top edge of the board.
After a board is jumpered, its sensors are renumbered from 5 to 8, and its motors are relettered to e and f.
One jumpered board and one non-jumpered board can then be controlled from a single Cricket.
Here is the driver file with additional commands for the second board.
The Motor/Sensor Expansion Board measures 2.00 x 1.425. There are four mounting holes at the corners of a 1.70 x 1.15 rectangle.
The Expansion Board can be used with an external power supply by cutting the marked trace on the underside of the board and applying the supply voltage to the pads labeled EXT + . The external power will run the motors only; logic circuits will still draw power from the Handy Cricket.
A voltage supply of up to 12v may be used. Please note that the trace on the underside of the board MUST be cut if external power is attached. Otherwise, the voltage will flow back into the main Cricket's supply and potentially burn out the circuits that require no more than 5v.