|
Sensors
Sensors are the interface to the outside world. The most important
sensors on a
hobby robots are proximity sensors, such as Infrared proximity
detectors (IRPD), Bumpers, Whiskers and Sonar. The other type of sensors
are for localization i.e. identifying where the robot is in relation to the environment it
is in. These sensors would be a compass, Light sensor, sound. temperature,
etc. Some sensors are used to identify location of a beacon; similar to
the method that aircraft use in plotting a course and way-finding.
Infrared Proximity Detection (IRPD) sensors
The IRPD sensors implemented on Robocube was very
successful at identifying location and distance of objects. I have
developed this design much further using 3 sensors and developed a
stand-alone module that is now available as a kit. This is
called IR-Control Freak !
See
details
Interfacing the BS2 to the IRPD
The
IRPD sensor controller used in Robocube was built as a separate 'slave'
PCB embedded with its own co-processor. . The
BS2 master controller is interfaced to the IRPD board using a simple
serial 3 wire communication (RX,TX ,GND). A serial interface for the prototype
was used for two main reasons:
 | Simple
to program the Stamp and PIC |
 | Serial
communications is available on all Stamps |
Serial Control Protocol
The
serial
protocol is very easy to configure.
The
Basic stamp sends a device code to the IRPD which is just '010' in this
case.
SEND_CODE:
code=10
SEROUT 14, 16780, [CODE]
GOSUB GET_ACK 'reset if the wrong ack was returned
RETURN
The
Stamp then checks for an acknowledgement from the IRPD module
GET_ACK:
debug "Waiting for ACK ", CR
' Get Code back as an ACK. Loop until ack received
SERIN 15, 16780,200,time_out, [ACK_code]
debug "Receive ACK= ", dec ACK_code,"
", cr
RETURN
If no 'ack' is received the routine 'times out' .
Otherwise this is the instruction for the IRPD to go off and do it's thing
(takes about 20ms). the IRPD then returns a 4 byte data stream to the
stamp:
RX_BYTE:
For DATA_ARRAY = 1 to 4
SERIN 15, 16780,1000,TIME_OUT,
[RX (DATA_ARRAY)]
Next
'Display the received data
For DATA_ARRAY = 1 to 4
Debug
dec RX(DATA_ARRAY)," ",cr
Next
RETURN
|
IR-Control FreaK !
Now available
PIC Programming
Most of the sensors and motor controller have been built
on a separate PCB with embedded co-processor. I have used the PIC16F84
& PIC16F628 which is very cheap and is freely available. I program these
chips using assembler and Basic. I use the Crownhill Proton+ for
programming in Basic. This is very similar to the Basic Stamp programming
language. Here is an example of programming a PIC16F84 for Infrared remote
control code below: Download
Sony Remote Control Code
|