handyboard.com / cricket
home
about
documentation
program
bus
faq
download
get one
build
tech
links
discuss

BUS

Intro LED Number Display Lamp/Relay Driver Motor/Sensor Expansion

To format for printing, click here.

Motor/Sensor Expansion Board

Motor/Sensor Expansion Board for Handy Cricket

Features

  • Two bi-directional DC motor outputs with 8 levels of power control.

  • Four analog sensor inputs with 8-bit A/D converter.

  • Each analog input can be used as a encoder, counting clicks and reporting velocity (clicks/unit time).

  • Analog inputs may be used in pairs, providing up to two quadrature decoding circuits for shaft encoders. This feature allows the shaft encoder to count upward when rotating in one direction and downward when rotating in the other.

  • Powered from Handy Cricket’s own power supply, or external power may be used.

  • Built-in Bus Jack allows additional bus devices to be daisy-chained from the board.

 

Plugging It In

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.

Using Motors

The Board provides two additional motor outputs, named c and d. The Handy Cricket includes commands for using them; they work just like the Cricket’s 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:

c, on

To turn on motor output d at full power for 2 seconds:

d, setpower 8 onfor 20

Using Sensors

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.

Basic Sensor Inputs

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

 

Using Two Motor/Sensor Boards on One Cricket

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.

 

Technical Specifications

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.


Last modified: Friday, 20-Aug-2004 16:01:26 PDT by fredm