The Robot Maker

(www. robotmaker.co.uk)

 

 

 

USER MANUAL  V1.0

INFRARED CONTROL FREAK

The Robot Maker

ăCOROBA Technologies

Langgasse 71 • 50189 Elsdorf

Germany

Phone +49 (0) 2274 706287 • Fax +44 (0) 8701 345931

www.robotmaker.co.uk
TABLE OF CONTENTS:

 

1      Introduction. 1

1.1     Tools you may need. 7

2      Overview Of FUNCTIONALITY.. 13

3      SERIAL INTERFACE CABLE connection. 71

3.1     Serial cable connection TO PC.. 90

3.2     Serial connection TO MAIN ROBOT CONTROLLER.. 112

3.3     Using a 5v regulated power supply from the Robot Controller. 119

4      Testing the connection to the PC using communication software. 128

5      POWER UP TESTS. 167

6      PrOGRAMMABLE Command Codes. 172

6.1     Sending commands to Infrared Control freak. 186

6.2     CoMMAND Code 030 – Sony IR – DECIMAL format 188

6.3     COMMAND Code 031 – Sony IR – ASCII format 237

6.4     COMMAND Code 032 – Infrared proximity dETECTION MODE (IRPD) (ASCII Format) 272

6.5     COMMAND Code 033 – TAG/ZAP MODE. 324

6.6     COMMAND Code 034 – FREEWHEELER MODE (DECIMAL FORMAT) 360

6.7     COMMAND Code 035 – AUTOPILOT.. 371

6.8     COMMAND Code 036 – BEACON MODE. 389

6.9     COMMAND Code 044 – FREEWHEELER (ASCII MOde) 442

APPENDIX A – SAFETY.. 458

APPENDIX B – CIRCUIT DIAGRAM... 482

APPENDIX C – PCB LAYOUT. 486

APPENDIX C – FAULT DIAGNOSTICS. 495

APPENDIX D - Connector Overview.. 520

APPENDIX E - ASCII TABLES. 535

 



1                   Introduction

You don’t stop playing because you get old; you get old because you stop playing!

t

hank you for purchasing the IR Control Freak (IR-CF) module for your robot or control project. If you bought the kit version, please follow the assembly instructions first.

 

The IR-CF has been specially designed for autonomous robotic control and for robotic gaming. However, it can also be used for any other infrared control application.  

 

IR-CF can be easily interfaced to the BASIC Stamp (from Parallax) or to any other Microcontroller using just two I/O pins and a common ground connection.

 

Please check our website www.robotmaker.co.uk for the latest versions of this user manual and for latest upgrades.  Please add your comments to the forum www.robotmaker.co.uk/phpbb/

 

1.1             Tools you may need

-         Voltammeter or simple circuit tester

-         Small Soldering Iron and Solder, wires and connectors (for making a cable)

-         Wire Cutters

 

 

2                   Overview Of FUNCTIONALITY

Non-contact distance measurements

The IR-CF offers non-contact distance measurements from about 2cm (1") to about 30cms (1ft), by sending short bursts of IR pulses on the left and right IR-LEDs. The number of reflected ‘hits’ detected on each of the IR sensors is decoded to determine the direction and distance of an obstacle

 

180 degree Infrared Proximity Sensing

Depending on how the sensors and Infrared LEDs have been calibrated, the three Infrared proximity sensors provide approximately 180 degrees of detection.

 

The combined directional and distance measurement sensing the IR-CF provides excellent autonomous control through narrow passages or mazes. Using command code 32 (see command code overview section below), obstacle directional and distance data is provided as an optional output; transmitted via the serial port.

 

Directional display

The circular ‘compass’ style LED-display points in the direction of the nearest obstacle.

 

The green centre LED will illuminates when an object is fairly close, e.g. 100mm (4"). 

 

 

 

Directional information of obstacles helps instant decision making during maze running and Gaming.

 

Mode of operations

The circular display is also used to provide visual feedback on the state of the command modes selected. Details of the display patterns are provide in the command mode overview section. This feature is excellent for debugging of your program by providing feedback on current routine being executed

 

Fuzzy Logic 

The pre-programmed Fuzzy Logic proximity detection algorithms, enable instant object avoidance decision, this frees-up a lot of processing your main robot controller would normally need to do. If you don't want to use the pre-programmed logic, you can design your own Fuzzy Logic algorithms from the six bytes of 'raw' proximity detection data. By measuring the successful hit on each of the IR sensors over time it is possible to determine whether an object moving towards / way from the sensor.

 

Infrared Remote Control 

IR-CF is also equipped with an onboard Infrared remote controlled receiver and transmitter, for remote control of robots and electronic projects using a standard TV remote control.  The protocol use with IR-CF is the Sony format known as SIRC.

 

A remote control feature enables inter-robot communication and Robot Gaming such as tag, zapping, Robot team communication, etc.

 

Buy using coded IR messages; you can transmit signals to other robots. For example, it is possible to determine whether your robot opponent is a friend or foe. You could also configure a unique ID for each robot and robot team, allowing your robot to communicate between team members and sending a 'tag' or ‘zap’ code to the other opponent team. For example, ten ‘zaps’ to the centre sensor could mean, ‘your dead’!  

 

Infrared is an invisible light to the naked eye, with a wavelength of approximately 950nm. Infrared light however can be detected with one of the modern digital cameras that have night vision functionality. 

 

Digital Infrared signals are create by transmitting short and long pulses or infrared light. The code is similar to the principals of Morse code with long a short pulses. A long pulse of 1.2ms is represented a digital 1 and a short pulse of 0.6ms is represented as a logic 0. There is a 0.6ms pause between each pulse.

 

The SIRC infrared signal is made up of a 12-bit packet that is split in to a 7-byte button code and a 5-byte device code. The button code represents the actual button pressed on the remote control. There is a 2.4ms ‘start bit’ between each packet, which is used to synchronize the sensors.

 

 

Start

BUTTON CODE

DEVICE CODE

S

B1

B2

B3

B4

B5

B6

B6

D1

D2

D3

D4

D5

2.4ms

1.2 mS or 0.6mS

1.2 mS or 0.6mS

To gain some immunity from ambient light sources, the IR sensors trigger only when a 32khz-40khz modulated IR signal is sent. The sensors used in the IR-CF are PNA4620M-ND from Panasonic (or similar component) that has a centre frequency of around 38Khz.

 

 

The device code determines which remote control device is being address; such as video, television, CD, Amplifier, SAT, etc.

 

Interface details and communication protocol

If you need special functionality, protocols or other special control characters for your robot project, we may be able to add this functionality for you too. Just send an email to [support@robotmaker.co.uk], or add a comment to the forum www.robotmaker.co.uk/phpbb/ for discussion.

 

 

 


3                   SERIAL INTERFACE CABLE connection

 

A two-pin I/O connection including a common ground is required to connect the IR control freak to a Microcontroller.

 

 

Pin Header

 

Connector pins 1-2 are for the 9v power supply connection and pins 3-5 are for the serial interface connection.

 

Pin

No.

IC Socket Pin

IC PIN Name

Description

1

NA

Regulated 5v supply to pin 5

 

NA

Regulated 5v supply VDD

9V SUPPLY (or regulated 5v supply from other source).

 

2

5

VSS

GROUND – for power supply

3

5

VSS

GROUND – for serial interface

4

18

RA1

Serial connection RX - Pin A1 on PIC.

This is connected to the data transmit (TX) on the main robot controller

5

17

RA0

Serial connection TX – Pin A0 on PIC

This is connected to the data receive (RX) on the main robot controller

 

 

Pins 6-9 are provided for in-circuit programming and are only required for downloading new versions of the software onto the chip. A special programmer is required for this.  If you don’t have a programmer, you can return it to Robot Maker and we can load it with the latest software version. More details and references regarding ‘in-circuit programming’ are covered in the section in-circuit programming.

3.1             Serial cable connection TO PC

Disclaimer: It is important to ensure the voltages and currents will not destroy the IR Control Freak or your PC! Connect at your own risk!

 

To make this cable, you will need:

-         Female pin header block (5 way)

-         9 way D-Type Plug (Female)

-         Ribbon Cable or wire

-         1Kohm resistors x 2 (voltage limiting)

-         9v PP3 style Battery terminal

-         Hot Glue-Gun

-          

Connect the cable as follows:

 

 

The 2 x 1K resistors are voltage-limiting resistors. These may be required depending on the configuration of your PC’s communication port. Double check that the connector pins are connected correctly (see table above).  Please check this before connecting.  

 

Finishing off

To avoid the cables breaking, use a hot glue-gun to bond cables and connectors together.

 

 


3.2             Serial connection TO MAIN ROBOT CONTROLLER

Using auxiliary power supply (from 9v battery)

 

 

 

 

3.3             Using a 5v regulated power supply from the Robot Controller.

 

Control Freak consumes average 15ma in normal use (depending on how may LEDs are illuminated). Before connecting the IR-CF to your robot controller’s power supply, it is important, that the current consumption is tested and confirmed and that your robot controller can handle this additional power consumptions.  You connect at your own risk!!

 

 

 

 

 

4                   Testing the connection to the PC using communication software.

There are many commercial and shareware software programs to simulate a serial connection to a robot controller.  One program that can be recommended is the software from Docklight. See (http://www.docklight.de/). Evaluation copies of the software (with limited functionality) can be downloaded from the website, which works fine for limited testing of the Control Freak.  If you download this software, create a blank project and start by creating a ‘send’ command code with the value ‘034’ (Freewheeler) as follows.:

 

Create a ‘Send Sequence’ by typing in the name row.

 

A pop-up window will appear to enable the send sequence button to be created.

 

 

Enter 034 as the sequence name and sequence command and press OK. A ‘Send Sequence’ button will be created. Press this button and the value DEC 034 is sent to the IR-CF.

 

A continuous stream of proximity output data will be transmitted to the PC screen.

 

 

The circular LED display will also light up in the direction of the nearest obstacle. To exit from this mode, send a different command code (e.g. 032).

 

Other ‘send sequence’ buttons can be made in the similar way. Try 044 and you get the same in ASCII format (explained more below).

 

HyperTerminal

HyperTerminal is another software application that can be used and most probably is already installed on your PC.  To send ASCII formatted command modes, that are described below the HyperTerminal also works very well.  To learn more about ASCII format see appendix E- ASCII TABLES or htpp://www.asciitables.com.  The main reason some commands have and ASCII output option is that it is a lot easier to interface to an ASCII terminal emulator and debug the results.  These commands are also more likely to be used in non-robot applications. If it is installed, you can find the HyperTerminal program on your PC under Accessories/Communications (or on the installation disks).  Run this program.

 

Press ‘Connect to’ and select COM1 (or what ever COM port you have connected the IR-CF to).  Press OK.

 

In the COM1 property window, select 9600 baud, 8 data bits, no parity, one stop bit, and flow control as ‘None’

 

The command  ‘sent’ to the IR-CF needs to be in DECIMAL format.  There are no normal character keys that can be pressed on the keyboard that represent 031, so this must be sent by holding down the ALT key and typing 031 on the keypad (this must be done on the keypad, with the num-lock on).  Then release the ALT key. 

 

 If nothing happens, you can set the ‘ASCII Sending’ property as defined above and see what is being sent. A graphic symbol should be displayed something like this ▲.

 

Press a button on the remote control and the device code and button code will be displayed on the main HyperTerminal window.

 

 

 

5                                                            POWER UP TESTS

The IR-CF module is programmed with a power-up routine. Connect the module to a 5v regulated supply or a 9v supply as described in section 3.2 & 3.3

 

Within a few seconds of connecting the power supply, the red LEDs should light up; one after the other, in a clockwise direction. After a further 2 seconds, the module will search for a signal on the serial port. If no signal is being transmitted, the module will continue this routine until a signal is detected.

 

6                   PrOGRAMMABLE Command Codes

The IR-CF is designed for many types of robot or electronic projects. This flexibility has been achieved by defining pre-programming routines that are activated by a command code. The following command codes are explained in detail in this section:

 

Command

Code

Mode Name

Description

030

Sony IR -Decimal

Receive Sony (SIRC) IR Commands and output results to serial port as two-bytes in Decimal format

031

Sony IR -ASCII

Receive Sony (SIRC) IR Commands and output results to serial port as two-bytes in ASCII format

032

IRPD Mode

One shot proximity sensing. 6 bytes of serial data are transmitted with proximity information.

033

ZAP/TAG Mode

Transmits a Sony (SIRC) IR message from both IR LED’s

034

Freewheel Mode

Send a continuous stream of proximity serial data in decimal format.

035

Autopilot Mode

Fuzzy logic results are sent as two bytes of data to serial port. These depict the direction of the nearest obstacle and distance.

036

Beacon Mode

This command searches for Sony (SIRC) infrared transmission on all 3 sensors and returns with which sensor received the highest reading. 

 

 

 

044

Freewheel Mode ASCII

Same as command code 034, but is sent as ASCII format rather than decimal format. This can be used with STAMPLOT from Parallax.

Table 1

6.1                                 Sending commands to Infrared Control freak

To send commands to the infrared control freak is very simple. An examples below, shows the Basic programming language used by the Basic Stamp (from Parallax). The principle fro sending commands to the IR-CF is the same for any robot controller.

 

'Send Command code to Infrared Control Freak

 

GET_IR_CF_DATA_PACKET:

        ' Send control code 32 at @9600 baud

        ' From [pin 2] (could have been any pin), [9600baud], [dec 32]

        SEROUT 2, 16468, [32] 

       

        ' Receive data stream form control freak               

        ' Put 6 Bytes of data into an array

        ' Receive on Pin 4, [9600 baud], [wait for 100ms], timeout sub, data

       

        FOR DATA_ARRAY = 1 to 6

            SERIN 4, 16468,100,time_out,[RX(DATA_ARRAY)] ' Get 1 Byte

        NEXT

       

        'Display the 6 bytes of data on the debug screen

        FOR DATA_ARRAY = 1 to 6   ' Display the 6 bytes of data        

 

        Debug DEC RX(DATA_ARRAY),"    ", CR    

        ' it is necessary to have two's loop otherwise data will be lost.

        NEXT

RETURN

TIME_OUT:

        Debug "timed out- Trying again", CR

                     Goto Again

 

 

6.2             CoMMAND Code 030 – Sony IR – DECIMAL format

 

Syntax: [030] (decimal format)

 

Overview: Sony IR -Decimal. Receive Sony (SIRC) IR Commands and output results to serial port as two-bytes in Decimal format. The IR signal is only detected by the central sensor. See Beacons Command mode for alternative mode.

 

Response from IR_CF:  [Button code], [Device Code].

The green LED on the Circular display will illuminate to indicate the Sony IR mode as been triggered and the IR-CF is searching for Sony IR messages If the IR transmission corresponds to one of the served button codes, detailed in the table below, the corresponding red LED will also illuminate.  See table below:

Reserved Button Codes

Purpose of Command

Circular Display

Sony

Button, Device code

Remote control Button name

Exit routine

Turn Left

Turn Right

Forward

Reverse

Stop

ZAP

Exit Command Mode

Left LED (West)

Right LED (East)

North LED

South LED

Centre LED

Arrow North flashes

17,21

17,58

17,59

17,18

17,19

17,56

17,9

(Power On\Off)

(Fast Rewind)

(Fast Forward)

(Volume Up)

(Volume Down)

(Stop)

(Channel 0)

 

 

 

 

 

 

 

 

 

 

Table 2

 

 

Example:

Example code for Basic Stamp (from Parallax)

 

Sending the command to IR-CF:

 

SONY_IR_COMMAND_CODE:

        ' Send control code 32 at @9600 baud

        ' From [pin 2] (could have been any pin), [9600baud], [dec 32]

        SEROUT 2, 16468, [32]

RETURN

The example above is Basic Stamp program code where the format is:

SEROUT[pin number on Basic Stamp], [baud rate], [decimal character to send]

 

Receiving data from IR-CF:

 

CHECK_IR_CODE:

        'Get 2 Bytes of data

        SERIN  4, 16468, 5000, TIME_OUT, [DEVICE_CODE, BUTTON_CODE]            

        'Show results on debug screen

        DEBUG "DEV=", dec DEVICE_CODE, " BUT=",dec BUTTON_CODE

        DEBUG CR

        'get robot to move L, R, F, B depending on what button was pressed

        If BUTTON_CODE = 18 then IR_FORWARD

        If BUTTON_CODE = 19 then IR_BACK

        IF BUTTON_CODE = 59 then IR_RIGHT

        IF BUTTON_CODE = 58 then IR_LEFT

        IF BUTTON_CODE = 5 THEN IR_STOP

GOTO CHECK_IR_CODE

 

 

 

 

2-bytes of data are returned containing the button code and device code respectively, in decimal format.                       

 

Example using Docklight program

In the example below, a DEC 030 was sent to the IR-CF (TX). This activated the Sony IR mode (on decimal format) and the central green LED on the circular display will illuminate to indicate that the command is activated.  When pressing the fast forward button on the remote control, the IR-CF displays the device code (017)* and the button code (059)*. The right (east) LED will also illuminate on the circular display.

 

 

You can customise the reserved commands when ordering the IR-CF.  Please specify at time of ordering.

*The actual device codes and button codes may vary depending on the manufacturer   of the remote control unit.

 

Resetting the IR-CF command: The IR-CF will remain in this mode unless a button code 21 (power on/off) is transmitted or a different command transmitted by the robot controller.  

 

Notes:

This command is for controlling the Robot via infrared remote control or for sending coded messages between robots for robot gaming.  The use of this command is explained below.

 

Infrared Remote Control

As soon as the command code 030 is transmitted to the IR-CF, the 'Infrared Command Mode' is triggered.  This means the module will keep searching for a SIRC Sony infrared remote control signals from a standard TV remote control unit or other robot attached with an IR-CF module.  You can use a standard multi-function type infrared remote controller by setting this up as an AUX-Sony device.

 

The IR-CF will decode any (SIRC) Sony remote control command and transmit the device code and button code to the robot controller.  You can use these codes to control the movement of the robot. Any reserved buttons, as specified  in Table 2

will illuminate on the circular display.  For example, suppose that you would like the button codes [Fast Forward] to turn your robot right, the robot controller will be programmed to accept 17,18 as a command to turn right. Likewise for [Fast Rewind] to turn your robot left.  [Volume down] to travel forward and [Volume Up] to go backwards. 

 

CHECK_IR_CODE:

        'Get 2 Bytes of data

        SERIN  4, 16468, 5000, TIME_OUT, [DEVICE_CODE, BUTTON_CODE]            

        'Show results on debug screen

        DEBUG "DEV=", dec DEVICE_CODE, " BUT=",dec BUTTON_CODE

        DEBUG CR

        'get robot to move L, R, F, B depending on what button was pressed

        If BUTTON_CODE = 18 then IR_FORWARD

        If BUTTON_CODE = 19 then IR_BACK

        IF BUTTON_CODE = 59 then IR_RIGHT

        IF BUTTON_CODE = 58 then IR_LEFT

        IF BUTTON_CODE = 5 THEN IR_STOP

GOTO CHECK_IR_CODE ' keep looping forever

 

You could have any other button doing any other routine you like. 

 

To reset the IR-CF back to the default 'standby' mode, just press the [Power] button on the remote controller (17,21) or send another command (such as DEC 032) from the master controller. You could also just use the button pad for Left. Right, Forward, Reverse.

 

Robot Gaming

The Sony IR command can also be used for receiving gaming commands from other robots.  The command can be activated and deactivated by the robot controller to enable a search for Infrared messages from other robots during roaming or between other tasks. 

 

For IR searching, the Sony IR is best used in conjunction with the  ‘Beacon Command Mode’.  The main benefit of using the Beacon mode first is that this command checks for IR transmission from each of the 3-IR sensors (see Beacon mode below) and resets automatically into scan mode after 5 seconds if no signal is detected.  The Sony IR command only detects IR signals on the centre sensor and does not reset unless the robot controller sends another command. 

 

This Sony IR command is useful if you need the Robot (or controller) wait for a signal from another robot.   

_________________________________________________________________

6.3             COMMAND Code 031 – Sony IR – ASCII format

 

Syntax: 031 (decimal format)

 

Overview: Sony IR -Decimal. Receive Sony (SIRC) IR Commands and output results to serial port as two-bytes in Decimal format

 

Operators: None

 

Response from IR_CF:  Button code <comma> Device Code <Carriage Return>.

The Circular display will also illuminate LEDs depending on the reserved button command pressed as defined below.

 

Reserved Button Codes

Purpose of Command

Circular Display

Sony

Button, Device code

Remote control Button name

Exit routine

Turn Left

Turn Right

Forward

Reverse

Stop

ZAP

Exit Command Mode

Left LED (West)

Right LED (East)

North LED

South LED

Centre LED

Arrow North flashes

17,21

17,58

17,59

17,18

17,19

17,56

17,9

(Power On\Off)

(Fast Rewind)

(Fast Forward)

(Volume Up)

(Volume Down)

(Stop)

(Channel 0)

 

 

 

 

 

 

 

 

 

 

 

 

Example:

Received by IR_CF: SEROUT 2, 16468, [31]  (Basic stamp code)

 

 

Sent from IR-CF to Robot Controller:

25,33

24,33

29,23

 

In the example below, a DEC 031 was sent to the IR-CF (TX).  This activated the Sony IR mode (in ASCII mode) and the central green LED on the circular display illuminated.  When pressing the fast forward button on the remote control, the IR-CF displays the device code (017)* and the button code (059)*.  The right (East) LED also illuminates on the circular display.

 

Note that to see the results in the correct format you will need to press the ASCII tab.

 

Decimal tab

 

ASCII tab

 

Notes:

This command is the same as command mode 030, but the response from IR-CF is in ASCII format rather than decimal format. To learn more about ASCII format see appendix E- ASCII TABLES.  The benefit using ASCII format is that any ASCII terminal emulator, such as HyperTerminal described in section 4 above can be used to display the results.

_________________________________________________________________

6.4             COMMAND Code 032 – Infrared proximity dETECTION MODE (IRPD) (ASCII Format)

 

Syntax: 032 (decimal format)

 

Overview: IRPD Mode.  This command forces the IR-CF to execute a ‘one-shot’ proximity search.

 

Response from IR_CF:  IR-CF responds with 6-bytes of serial data, containing proximity information.

 

Proximity information will be between the range 0-100; where ‘0’ indicates ‘no obstacle’ detected and 100 indicates that the object is <50mm (2”) away from the sensor.

 

The 6-Bytes contain proximity information related to sensors that detected proximity. Similar to the concept of stereovision, by decoding data between the sensors it is possible to estimate the approximate position of the sensor. 

 

RIGHT SENSORS

MIDDLE SENSOR

LEFT SENSOR

RHITS_R

RHITS_L

MHITS_R

MHITS_L

LHITS_R

LHITS_R

 

The Circular display will also illuminate LEDs in the direction of the nearest obstacle.

 

                

 

 

The 6-bytes of proximity data returned to the main robot controller can be divided into three sets of 2-byte pairs; one set for each Infrared sensor. The data sets are related to information reflected back from the RIGHT Infrared LED and the LEFT Infrared LED. This is used to determine the direction and distance of an object as follows: 

----------------------------------------------------------------------------

Byte 1: RHITS_R - Hits on Right sensor from the right IR LED, 

Byte 2: RHITS_L - Hits on Right sensor from the left IR LED,

----------------------------------------------------------------------------

Byte 3: MHITS_R - Hits on middle sensor from right IR LED

Byte 4: MHITS_L - Hits on middle sensor from left IR LED

----------------------------------------------------------------------------

Byte 5: LHITS_L - - Hits on left sensor from left IR LED

Byte 6: LHITS_R - Hits on left sensor from right IR LED

----------------------------------------------------------------------------

 

The IR control freak can send decimal or ASCII data format depending on the command code transmitted.  The full data stream transmitted would look something like:

50,2,25,1,0,0

What does this mean? 

It mean that the right sensor is receiving 50 hits from the right LED and 2 hits from the left IR LED.  In addition, the middle sensor is receiving 25 hits from the right LED and 1 from the left IR LED.  No hits are picked up by the left sensor.  This means that the obstacle is about 100mm away approaching from right at about 60 degrees.

 

Example:

Received by IR_CF:  SEROUT 2, 16468, [32]  (Basic stamp code)

Sent to Robot Controller: 100 90 80 30 0 0

           

Notes:

 

This is the main IR proximity mode, where 6-bytes of proximity data are returned to the robot controller.

 

It is best to calibrate the IR-CF by adjusting the Infrared LEDs in/out to get the best results for your application.

 

The main robot controller needs to decode data received from the IR-CF and decide how to avoid the obstacle(s).  The decision can be a Fuzzy logic algorithm based on which sensor is picking proximity data.

 

Example Basic Stamp code:

 

 

 

GET_IR_CF_DATA_PACKET:

        ' Send control code 32 at @9600 baud

        SEROUT 2, 16468, [32]

       

        'Receive data stream form control freak        

        'Put 6 Bytes of data into an array

       

        FOR DATA_ARRAY = 1 to 6

            SERIN 4, 16468,100,time_out,[RX(DATA_ARRAY)] ' Get 1 Byte

        NEXT

       

        'Display the 6 bytes of data on the debug screen

        FOR DATA_ARRAY = 1 to 6   ' Display the 6 bytes of data        

 

        Debug DEC RX(DATA_ARRAY),"    ", CR    

        ' Note, it is necessary to have two's loop otherwise data will be lost.

        NEXT

RETURN

TIME_OUT:

        Debug "timed_out- Trying again", CR

                     Goto Again

 

' Note, it is necessary to have two's loop otherwise data will be lost.

 

CHECK_IRPD:

        If RX(4) < 10 and RX(3) < 10 then skip2

        IF RX(4) =100 OR  RX(3) =100 THEN BACK          'Turn Back

        IF RX(4) =>99 AND RX(3) => 99 then CONDITION1   'Turn Back

        IF RX(3) > RX(4)  then CONDITION2               'Turn Left

        IF RX(4) > RX(3) then  CONDITION3               'Turn Right

 

RETURN 

_________________________________________________________________

6.5             COMMAND Code 033 – TAG/ZAP MODE

Syntax: 033 (decimal format)

 

Operands: <button Code><device Code>

 

Overview: IR-CF Transmits a Sony (SIRC) IR message from both IR LED’s.

 

Response from IR_CF:  A letter X will flash on the circular display for each IR pulse transmitted.

 

Example:

TAG_MODE:

'Instructions to IR control freak to go into TAG/ZAP mode

 

        SEROUT  2, 16468, [33]

'Wait a bit            

       PAUSE 10

 

'Setup button code and device code by placing values into an array

        RX(1)=026                       'BUTTON CODE

        RX(2)=025                       'DEVICE CODE

 

'Send the Button Code & Device code as string

        FOR DATA_ARRAY=1 TO 2

                SEROUT  2, 16468, [RX(DATA_ARRAY)]

        NEXT

RETURN

     

 

This command instructs IR-Control Freak to transmit SIRC Infrared data from the IR LED's. 

 

For this command to work correctly, your robot controller needs to set up a 3-byte string.  The first byte is the command mode instruction (033).  The other two bytes represent the Sony infrared 'device and button' code (see example above). 

 

As soon as two bytes are received, IR-Control Freak decodes, and transmits these two bytes into SIRC Infrared 'device and button' code data.  It is as though you had pressed a button on an Infrared remote control device. 

 

The objective of this command code is for two or more robots to communicate with each other in a very simple manner.  The two-byte Sony SIRC 'device and button' code can be used in many ways.  For example, the infrared data could be used to identify which robot was sending the message, by assigning each robot a unique device code.  The robot number could then represent the team.  For example:

Device code

11                 Team 1 – Robot 1

12                 Team 1 – Robot 2

13                 Team 1 – Robot 3

21                 Team 2 – Robot 1

22                 Team 2 – Robot 2

Etc.

 

Similarly, in a game of tag the robot with device code number 11 could be classified as the ‘IT’ robot, so all other robots can avoid this robot. 

 

The button code could be used to for sending a unique  'ZAPPING' or 'TAG' command. For example, robots that receive 10x ZAP codes could be out of the game for a defined period.  The game rules will need to be provided by the organisation and applied to both teams.

 

In conjunction with a radio modem the robot controller could send details to a central PC indicating which robot is ‘IT’ and which robots have been ZAPPED.  

 

This command code could also just be used for controlling a Sony SIRC device (e.g. video or television)

_________________________________________________________________

6.6             COMMAND Code 034 – FREEWHEELER MODE (DECIMAL FORMAT)

Syntax: 034 (decimal format)

 

Overview: IRPD Mode.  Sends a continuous stream of proximity serial data in decimal format.

 

Response from IR_CF:  IR-CF responds with 6-bytes of serial data (in decimal format), containing proximity information..  See command 044 for ASCII format.

 

This command works in the same way as command 032, expect that IR-CF sends a continuous data stream of infrared proximity data in decimal format.

 

The only way to exit from this routine is to send another command code (such as 032).

_________________________________________________________________

6.7             COMMAND Code 035 – AUTOPILOT

 

Syntax: 035 (decimal format)

 

Overview: IRPD Mode Fuzzy logic results are sent as two bytes of data to serial port. These depict the direction of the nearest obstacle and distance.

 

Response from IR_CF:  [direction] [proximity] IR-CF responds with 2-bytes of serial data, containing direction & proximity information..

 

This is similar to the command 032 with just two-bytes of information returned. The direction value,  uses the same algorithms used for displaying the direction of the obstacle on the circular LED’s display. The proximity information will be between the range 0-100; where ‘0’ indicates ‘no obstacle’ detected and 100 indicates that the object is <50mm (2”) away from the sensor.

 

BYTE 1

BYTE 2

LED Direction

Proximity Data

0>100

 

The Circular display will also illuminate LEDs in the direction of the nearest obstacle.

 

The main benefits of this command is that the decoding is done within the on board microprocessor so less calculation and processing is required by your robot controller.

_________________________________________________________________

6.8             COMMAND Code 036 – BEACON MODE

 

Syntax: 036 (decimal format)

 

Overview: This command searches for Sony (SIRC) infrared transmission on all 3-sensors and returns with which sensor ID received the highest reading. 

 

 

 

 

 

Response from IR_CF:  IR-CF responds with 4-bytes of serial data.

 

Byte 1

Byte 2

Byte 3

Byte 4

Device Code

Button Code

Sensor Direction

No.  of successful readings

(0-5)

 

The LED closest to the IR sensor, in the circular LED display, will also illuminate.

Examples

In the example below the:

-         device code = 017

-         button code  = 018

-         The front sensor (North) detected highest hits (this is also the default direction of all sensors have the same number of hits)

-         5 hits where received at the front sensor (North)

 

In the example below, no IR transmissions where detected:

 

 

In the example below the right sensor no. 3  (east) detected most IR hits:

 

In the example below the left sensor no. 2 (west) detected most IR hits:

 

Notes:

This command can be used in a number of ways.  The first method is for detecting the presence of other robots that are transmitting IR signals, so example in TAG games, Sumo Competitions, etc.  IR-CF will wait for a few seconds on each sensor ‘listening’ for signals.

 

If a signal is found this is decoded and results transmitted via the serial port.

 

This command will also detect the approximate direction of IR transmissions.  Take care when the robot is in a small environment, as the sensors will also pick up IR reflections; so the actual direction may be 180 degrees from the indicated direction.  The robot controller should run check routines to verify these readings.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


One other method of use is in conjunction with a directional beacon.  For example, the robot can be programmed to move in the direction of the strongest IR signals.  Some trial and error testing will be required to determine the best settings and position of the sensors.

 

In Biomimetics simulation experiments, the IR transmitter is representing food.  The device and button code transmitted could indicate ‘type of smell’ and be associated with the type of food. 

 

 

6.9             COMMAND Code 044 – FREEWHEELER (ASCII MOde)

Syntax: 044 (ASCII format)

 

Overview: IRPD Mode.  Sends a continuous stream of proximity serial data in ASCII format.  Functions in the same way as command code 034.

 

Response from IR_CF:  IR-CF responds with 6-bytes of serial data (in decimal format), containing proximity information..  See command 034 for Decimal format.

 

This command works in the same way as command 032, expect that IR-CF sends a continuous data stream of infrared proximity data in ASCII format.

 

The only way to exit from this routine is to send another command code (such as 032).

 

Notes:

This command is useful for calibration and test purposes, when the IR-CF is interfaced directly to a PC using an ASCII terminal such as Docklight, Stamplot, HyperTerminal, or other program. 

 

The ASCII output makes it also easy to interface to fuzzy logic calculating programs or for making graphical representations of the IRPD data in spreadsheets. 

A visual basic program (and source code) called IR-CF GUI is available on the website under: www.robotmaker.co.uk/IR-CF/gui.  This program will graphically represent the proximity data being transmitted.

 

 

 

 

 


APPENDIX A – SAFETY

We would like that you have many hours of enjoyment building and using this project, so we ask you to take care and follow the safety warnings below.

 

Safety goggles

To reduce the risk of eye accidents we strongly suggest you wear safety goggles when soldering or assembling parts to device.  Pieces of wire can shoot off at great speed when snipping them off.  Solder may also splash during soldering.

 

Soldering Irons

We assume that you have done some soldered before and you have read all safety warnings related to your soldering iron. If you want to read-up about how to solder, look at our website htttp://www.robotmaker.co.uk/ir_cf/soldering.htm. Soldering Irons and components Remember soldering Irons get very hot, so please take care.

 

Antistatic

The IC can be easily damaged if you touch it without being grounded.  To avoid static damage to the IC, you should ensure that you have connected an antistatic cable and have all components placed on an antistatic mat.

 

Risk if Choking

There is a risk of choking if the small parts are swallowed.  Therefore, please keep all small parts away from small children.

 

Young Technicians

Even though this kit is suitable for children from 12 years old; it is recommend that testing and use of this module is carried out under adult supervision.

 

DISCLAIMER

 

If the device is interfaced to another robot module or PC, it is your responsibility to check that voltages and currents will not damage the equipment you are connecting.  The Robot Maker accepts no responsibility for damage or loss in any way.

 

The IR_CF module is intended for hobby and educational use only. Do not use in any critical application. Please ask if in doubt.


APPENDIX B – CIRCUIT DIAGRAM

 


APPENDIX C – PCB LAYOUT

Layout of components

Component-Side of board

Solder Side (Viewed from through the component side)

 


APPENDIX C – FAULT DIAGNOSTICS

 

If you have any questions or improvement suggestions related to the product, please feel free to leave a message in the support forum: http://www.robotmaker.co.uk/phpbb   or send an email to: support@robotmaker.co.uk

 

Fault Description 1: - No power at the test point JMP1.

1.      Check battery /supply voltage is present on Pin 1.

2.      Check ground connections

3.      If these are OK, check for short circuits

4.      Check polarity of battery

5.      Check the voltage regulator is inserted correct way round.

 

Fault Description 2: - Start-up LED routine does not work

1.      Check fault description 1.

2.      Check that the IC is inserted into the socket correctly

3.      Check that power is available at the IC

4.      Check that the LEDs are connected the correct way round (applicable to kit only)

 

 

Fault Description 2: - No sensing or response from IR-CF

If the power-up routine or other command mode routines are displayed on the circular display  but the module does not react to any proximity or IR signal.

1.      Check battery is fully charged. The sensors will not trigger if the voltage is too low

2.      The Microcontroller will start behaving erratically if the voltage is too low

 


 

APPENDIX D - Connector Overview

 

Pin

No.

IC Socket Pin

IC PIN Name

Description

1

NA

Regulated 5v  supply to pin 5

 

NA

Regulated 5v  supply VDD

9V SUPPLY (or regulated 5v  supply from other source).

 

2

5

VSS

GROUND – for power supply

3

5

VSS

GROUND – for serial interface

4

18

RA1

Serial connection RX - Pin A1 on PIC.

This is connected to the data transmit (TX) on the main robot controller

5

17

RA0

Serial connection TX – Pin A0 on PIC

This is connected to the data receive (RX) on the main robot controller

 

 

 

 

6

12

RB6

CLK

7

13

RB7

DATA

8

4

MCLR

MCLR

9

5

VSS

GROUND

 


APPENDIX E - ASCII TABLES

 

(See: asciitable.com for more details.)