
As technology advances there is an increasing demand for computer literacy amongst young school leavers. It is important that computing skills be encouraged, particularly at a secondary school level, in an environment that maintains interest levels above that of the average classroom setting.
It is with this aim in mind that a handful of Engineers and Technicians at the University of Southern Queensland have devised a robotics based competition - nick named 'Bilby'. This same group of technologists has put together kits of parts to supply participating schools with a standard Bilby. The Bilby Starter Kit provides all of the components required to get a robot moving, including sensors and information as programs and documentation.
The Bilby is a small remote control robot that finds it own way along a path composed of simple wooden squares. The kit robot supplied is made from simple components available in most hardware and electronics stores. This robot is designed in the classic wheel chair configuration, that is - two driving wheels one either side of the chassis. The motors are 12Volt stepper motors identical to those found in 51/4" disk drives taken from old computers. The wheels are from the hardware store, requiring slight modifications for mounting to the motors. The circuit boards use only standard parts for easy replacement and were designed at USQ.
The provision of the Bilby kit is to start the competition off by setting up each school with a robot they can use immediately. As the competition develops teams will create their own improved robots to maintain a competitive edge over other teams.
The objective of the concept is to involve the students in the development of -
The objective of the competition is to race the Bilby's to the end of a path. The Bilby reaching the end of the path in the shortest time is the winner. This year the path will be a simple straight track with a few turns in it, but as the competition matures the paths may become more involved. This provides the competition with sufficient scope for future development to sustain the challenge, and to grow as it fulfils the needs of the participants. It is quite possible that in years to come the Bilby may be solving maze like paths, and bristle with sensors and gadgetry.
Control cables to the Bilby must be supported by the handlers in such a manner that they neither impede nor aid the operation of the robot.
The following list of instructions is a guideline only.

Figure 1. Stepper Motor Driver Circuit Board

Figure 2. Infra Red Sensor Circuit Board

Figure 3. Suggested Infra Red Mounting Arrangement
How this Robot works
The Motor and Drive Circuit
This robot is driven by two stepper motors similar to those found in old floppy disk drives. These motors work on the principle of aligning the rotor of the motor and with electromagnets (poles) in the outside of the motor. By having many poles (or Phases) in the motor the rotor can be made to align to any one of the poles by energising the corresponding coil.
There are actually many of these poles (200 in this motor) around the outside of the motor, with every forth pole being energised by the same coil. The result is a motor with 200 steps per revolution which can be held stopped at any position. To make the motor turn - move from one step to the next -the 4 coils (phases) are energised in a sequence that attracts the rotor of the motor away from the last pole and onto the next. This is achieved by switching coils on in certain patterns which look just like a series of numbers to us. To reverse the direction of the motor we simply reverse the sequence.
The stepper motors provided in the Bilby Kit are controlled through the 8 data lines of the IBM PC's parallel printer port, which are normally used to send characters to the printer. As each motor has 4 coils to drive, each half (4 bits) of the port is used to drive one stepper motor. As the coils require 12 Volts to drive them each bit is used to switch on a transistor which switches on the coil. The integrated circuit (IC) on the circuit board has 8 of these transistors in it. The coils in the motor are connected to the transistors via the wires.
The best thing about using stepper motors is that once the sequence of bit patterns (numbers) is defined, the only thing the operator or programmer needs to know is how to step the motors forward or backward. In the robot Bilby Kit the software supplied in the documentation has the sequence of phases defined. (See the arrays left1() and right1() in the listing)
A sample program BILBY.BAS is provided including a subroutine that sends the appropriate patterns to the motors via the parallel printer port. You are encouraged to look into the subroutine to see how it works.
Subroutine Stepper(right, left, size)
The Stepper subroutine should be called from your Bilby control program once per step required. The parameters passed to the subroutine identify the right step, left step and step size -
right = 1 to step forward, 0 for no step or -1 to step backward on the right wheel
left = 1 to step forward, 0 for no step or -1 to step backward on the left wheel
size = the size of the step to be taken, 1 for a small (half) step, 2 for a large (full) step
Combinations of steps forward or backward on both wheels at the same time can be used to turn the Bilby around its centre point, or just to give it a nudge to the left or right to keep it going straight.
For examples on how to use the Stepper subroutine see the BILBY program provided.
The Sensor Interface
The ability for the Bilby to 'see' is provided in the form of up to 4 Infra Red sensors. These sensors are composed of an Infra Red LED (light emmiting diode) and an Infra Red Sensitive Transistor. These are arranged at an angle to reflect IR light off a surface about 5mm away from the sensor. Each of the sensors connects back into the computer through spare inputs on the parallel printer port. From your program the activation of the sensor is detected by reading the printer port input bits.
To add a sensor to the robot -
choose a sensor provided and position it where you wish to sense the path
plug the sensor into the connector on the sensor circuit board as shown in Figure 2.
locate the Sensor Adjustment Card attached to this documentation
adjust the sensor sensitivity by following the procedure on the adjustment card
incorporate the sensor function into your program
The Sensor function is provided that reads the parallel printer port to determine the state of the sensors and returns a number. You are encouraged to look into the function to see how it works.
Function Sensor(number)
The Sensor function should be called from your Bilby control program each time you wish to read the individual sensor states. The parameter passed to the function identifies the sensor number -
number = 1 for sensor1, 2 for sensor2, 3 for sensor3, or 4 for sensor4.
The value returned from this function is a 0 for the sensor OFF (no path), or a 1 for the sensor ON.
For an example of how to use the Sensor function see the BILBY program provided.
Function Bank
You may find the Bank function useful. This function is designed to read all sensors at once and return a suitable number. When you use the program line x = bank the bank routine will return a number between 0 and 15 inclusive which is a combination of all four inputs as follows.
x = sensor4 x 8 + sensor3 x 4 + sensor2 x 2 + sensor1 x 1 where each sensor value is 0 or 1
This may look familiar to you, as it is based on the binary number system.
For an example of how to use the Bank function see the BILBY program provided.
The BILBY sample program
To show you how easy it is to get the Bilby mobile we have provided a simple keyboard control program to use the Stepper subroutine and the Sensor Function to test the Bilby using -
f or F - for forward b or B - for backward
r or R - for right l or L - for left q or Q - to quit
The sensor states are displayed after each command. Lowercase letters cause steps of 1, and uppercase letters cause steps of 2. You are encouraged to start with this simple program to get going on the competition. Why not try a loop from 1 to 10 to step the Bilby 10 steps at a time.
Important Note :
Be aware that the stepper motors will step at a maximum rate of about 200 steps per second. You may need to include a delay loop inside your stepping loop just to slow down the rate at which you step the motors. You will be able to see when you are trying to step too quickly as the Bilby will probably just sit still and shake.
The Sensor Adjust Program
To simplify the Sensor adjustment procedure we have provided a simple program to read and display the sensor states continuously, which is used in conjunction with the Sensor Adjustment Card.
q or Q - to quit
Software Listings (files provided on disk)
Bilby Sample Program
DECLARE FUNCTION bank% ()
DECLARE FUNCTION sensor% (n%)
DECLARE SUB stepper (r%, l%, s%)
DECLARE SUB delay ()
CONST steptime = 500
CONST pdata = &H378
CONST pinp = &H379
CONST pout = &H37A
CONST pin13 = &H10
CONST pin12 = &H20
CONST pin10 = &H40
CONST pin11 = &H80
CONST pin1 = 1
CONST pin14 = 2
CONST pin16 = 4
CONST pin17 = 8
DIM SHARED lstep, rstep, olds AS INTEGER
lstep = 0
rstep = 0
olds = 1
DIM SHARED Mask(3) AS INTEGER
FOR i = 0 TO 3
READ Mask(i)
NEXT i
DATA &H80, &H40, &H20, &H10
DIM SHARED left1(7) AS INTEGER
FOR i = 0 TO 7
READ left1(i)
NEXT
DATA &H01, &H03, &H02, &H06, &H04, &H0C, &H08, &H09
DIM SHARED right1(7) AS INTEGER
FOR i = 0 TO 7
READ right1(i)
NEXT
DATA &H10, &H30, &H20, &H60, &H40, &HC0, &H80, &H90
SCREEN 9
CLS
LOCATE 2, 1
PRINT "Bibly Sample Program."
LOCATE 5, 1
PRINT "Move Forward Backward Right Left"
LOCATE 8, 1
PRINT "Full step F B R L"
LOCATE 11, 1
PRINT "Half step f b r l"
LOCATE 15, 1
PRINT "Sensor Number 4 3 2 1 Sensor Bank"
LOCATE 22, 1
PRINT "Q to quit"
DO
a$ = INKEY$
IF a$ = "f" THEN CALL stepper(1, 1, 1)
IF a$ = "b" THEN CALL stepper(-1, -1, 1)
IF a$ = "r" THEN CALL stepper(-1, 1, 1)
IF a$ = "l" THEN CALL stepper(1, -1, 1)
IF a$ = "F" THEN CALL stepper(1, 1, 2)
IF a$ = "B" THEN CALL stepper(-1, -1, 2)
IF a$ = "R" THEN CALL stepper(-1, 1, 2)
IF a$ = "L" THEN CALL stepper(1, -1, 2)
LOCATE 18, 1
PRINT "Sensor State "; sensor(4); " "; sensor(3); " "; sensor(2); " "; sensor(1); " "; bank;
LOOP UNTIL a$ = "q" OR a$ = "Q"
Sensor Function
FUNCTION sensor% (n%)
REM This version is for the new sensors and circuitry
IF n% >= 1 AND n% <= 5 THEN
IF (Mask(n% - 1) AND INP(pinp)) = 0 THEN
s% = 0
ELSE
s% = 1
END IF
IF n% = 1 THEN
sensor% = 1 - s%
ELSE
sensor% = s%
END IF
ELSE
PRINT "Use sensor numbers between 1 and 4"
END IF
END FUNCTION
Stepper Subroutine
SUB stepper (r%, l%, s%)
rs% = SGN(r%)
ls% = SGN(l%)
IF s% < 1 THEN
s% = 1
ELSE
IF s% > 2 THEN s% = 2
END IF
IF (s% - olds) = 1 THEN
IF (rstep MOD 2) = 0 THEN rstep = rstep + rs%
IF (lstep MOD 2) = 0 THEN lstep = lstep + ls%
END IF
olds = s%
rstep = (rstep + rs% * s%) MOD 8
IF rstep < 0 THEN rstep = rstep + 8
lstep = (lstep + ls% * s%) MOD 8
IF lstep < 0 THEN lstep = lstep + 8
stepdata% = left1(lstep) + right1(rstep)
OUT pdata, stepdata%
END SUB
Delay Subroutine
SUB delay
FOR i = 0 TO steptime
NEXT i
END SUB
Bank Function
FUNCTION bank%
b% = 0
FOR i% = 1 TO 4
b% = b% + sensor(i%) * (2 ^ (i% - 1))
NEXT i%
bank = b%
END FUNCTION