TM                     

Home ] Up ] Products ] About Us ] Disclaimer ] Terms and Conditions ]

 

European based company with global Delivery 

www.robotmaker.co.uk

 

________________

 

 

Home

 

 

 

________________

 

 

    IRCF user group

________________

 

If you need support with our products then click here to register  > Support Centre

 

________________

 

 

http://www.bittybot.com

http:/www.solarbotics.com

 

_________________________

 

 

 

 

 

________________

 

 

News Feeds

Latest Robot - News

Latest Robot - Blogs

Latest Robot - Videos

Latest Robot - Groups

Latest Robot - Web

 

You Tube

Morphogenesis: Shaping Swarms of Intelligent Robots

 

 

more News...

______________________

 

What is Biomimetics? It is the abstraction of good design from Nature.

 

 

 

Interfacing the Infrared Control Freak to the PICAXE microcontroller.

A special Infrared Control Freak - Light  sensor module has now been developed for the PICAXE range of microcontrollers. 

 

The version is configured with a compatible 2400 baud serial interface,  offering many new exciting project opportunities for one of the most easiest microcontroller ranges.  

 

 

 

 

 

 

What is a PICAXE microcontroller?

PICAXE range of microcontrollers are low-cost, re-programmable chips that can be used as a low-cost robot 'brain' or in many other kinds of electronic project. 

 

Example Prices from www.rev-ed.co.uk

AXE-015

PICAXE-18 IC (single)

GBP 2.50 (approx €3,60)

AXE-015A

PICAXE-18A IC (single)

GBP 2.70 (approx €3,92)

AXE-015X

PICAXE-18X (single)

GBP 3.70 (approx €5,40)

 

The chips are based on the Microchip's range of PIC microcontrollers, but are configured so you don't need any special programmer to program them.....just a simple serial cable from your PC! 

 

The program language is based on BASIC language, which is a perfect starting point for budding technologist to get into this exiting hobby of robotics and control projects. 

 

All of the PICAXE controllers will interface with the IRCF_L. However. we recommend for robot projects that you purchase the extended version PICAXE - 18X or larger ....as when you get going, you'll need quite a bit more memory space for your program.

 

Flier on PICAXE website

User Manual on PICAXE website

 

Easy interface to PICAXE (2400 baud version)

Some examples of how to connect the PICAXE are included below. In this example a PICAXE-18 IC was used. 

 

Place the PICAXE chip on a simple prototyping PCB. The 5v power supply on the IRCF can be used to also power the PICAXE and additional servos. A cable needs to be made to Interface the ICRF-L to the PICAXE.. Ensure to place the PICAXE microcontrollers into IC-holders so it can be replaced or upgraded easily.

 

As the serial input command (SERIN) in the PICAXE does not 'timeout', it is difficult to see whether your program is working properly. The best way to check your PICAXE serial communications is to look at the communications on your PC using the Docklight demo software (see user manual for some more details). You can use the Docklight application as a 'slave' device to simulate the response of the Infrared control freak or as a Master device to drive the Infrared control freak.

 

Setting up Docklight as a 'slave' device 

For simulating the IRCF command 032,  configure the Docklight application as follows:

 

1. Setup the send sequences

 

This is the response Docklight will send to the PICAXE microcontroller.

 

Close the dialogue box and you'll see the command 032 created as follows: This can be used later to send to the IRCF on Master mode.

 

 

2. Setup the automated receive sequence:

Now you'll need to setup a filter that will check the serial port for charters being sent from the PICAXE microcontroller. In the example below it is searching for command 032. As soon as the command is sent from PICAXE it will response with the string setup in the send sequences above.

 

Close the dialogue box and you'll see the command receive sequence as follows.

3. Programming the PICAXE microcontroller

For this next step you'll need some PICAXE chips. You can buy these directly from PICAXE or a local distributor. 

 

I recommend that you purchase one of the starter packs that  come complete with demo PCB, power supply, serial cable, software and a PICAXE chip. I suggest that you also by some spare chips at the same time, as you'll probably want to make a few different robots, one you've got started.

 

All of the PICAXE controllers will interface with the IRCF_L. We however  recommend for robot projects that you purchase the extended version PICAXE - 18X or larger.

 

If you haven't already done so, you'll need to download and install the Programming Editor from the REV-ED (PICAXE) website or CD. 

 

Now we can start programming the PICAXE to send the command 032 via the serial port.  Copy and paste the Example 1 program below for testing command 032:

Set the baud rate in the Docklight application to 2400 baud. Then connect the power supply to the PICAXE.

You should see the PC and PICAXE communicating as follows. When the battery to the PICAXE is attached you should see that the PICAXE sends a bytes (032) to Docklight. Docklight then responds with the string of 6 bytes. PICAXE then sends another byte ....and so on.

 

If no bytes are sent back to the PICAXE,  the PICAXE will just wait ....  forever. 

 

You may therefore need to reset the PICAXE until the communications are synchronized correctly.

 

Once this works OK then now try communication with the Infrared Control freak. Just connect a 3 wire cable from the PICAXE to the IRCF and the device will start communicating with each other. The circular LED display will let you know that the two devices are communicating. 

 If the communication stops then just reset the PICAXE. 

 

Step 4. Building a simple autonomous robot

The example 2 program below is some code for a very basic robot. It uses two modified Radio Control type servos as the drive and just send command 035 to the IRCF. The IRCF uses the internal algorithms to determine the approach location of the nearest obstacle. 

Example 1 - Infrared Proximity Sensing

; Program for  test the IRCF Infrared module from ROBOTmaker
; Program for internal PICAXE-18

Symbol I = b1
Symbol Sbyte=b2
Symbol Getbyte1=b3
Symbol Getbyte2=b4
Symbol Getbyte3=b5
Symbol Getbyte4=b6
Symbol Getbyte5=b7
Symbol Getbyte6=b8


Main: 
'** - Blink the LED to show that there is a connection - **
Gosub blink

'** - Setup the command to test - **
sbyte=032  'This command for testing  Proximity detection functionality 

'** - Send the command to the ICRFL - **
Serout 6,N2400,(sbyte)

'** - Receive 6 bytes of the raw data from the ICRFL - **
Serin 0, N2400,getbyte1,getbyte2,getbyte3,getbyte4,getbyte5,getbyte6

'** - See the Results on the Computer Screen - **
Debug

'** - Blink the LED to show that the command completed - **
Gosub blink

Goto main'**- keep looping forever


'** - Subroutines - **

Blink:
For I=1 to 1
High 2
Pause 20
Low 2
Pause 20 
Next

 

Example 2: -Simple  autonomous Robot program  using two R/C type servos and command 035 on the IRCF

; Example of a simple autonomous robot program using the 
; PICAXE microcontroller + IRCF Infrared module from ROBOTmaker
; Program for PICAXE-18 
; GWS R/C type servos are connected to PICAXE outputs 0 and 7. 
; Serial connection connected to output 6(TX) and input 0(RX)
;
; IRCF-L command 035 is used which sends back to the PICAXE two bytes. 
; First byte is the direction. The second byte is the approx. % distance. 


'*- Declare the variables -*
Symbol I = b1
Symbol Getbyte1=b2
Symbol Getbyte2=b3


MAIN: 
Gosub blink 'blink an LED 

'Send the commmand to IRCF and receive the two byte response
Serout 6,N2400,(35)
Serin 0, N2400,getbyte1,getbyte2

'Interpret the results from the IRCF. If the distance is too close then turn or backup
if Getbyte2 < 89 then Forwards
if Getbyte2 > 98 then Backwards
if Getbyte2 >= 90 then turn
Gosub Forwards
Goto MAIN

'** - Subroutines -**

TURN:
if Getbyte1=2 then SERVO_R_FWD
if Getbyte1=3 then SERVO_R_FWD
if Getbyte1=4 then SERVO_L_FWD
if Getbyte1=5 then SERVO_L_FWD
Goto MAIN

BLINK:
For I=1 to 1
   High 2
   Pause 20
   Low 2
   Pause 20 
Next
Return

SERVO_L_FWD:
For I=1 to 25
   Pulsout 7,250 
   Pause 5
Next
Goto MAIN

SERVO_R_FWD:
For I=1 to 25
   Pulsout 0,30 
   Pause 5
Next
Goto main


FORWARDS:
For I=1 to 5
    Pulsout 0,30 
   Pulsout 7,250 
   Pause 10
Next
Goto main

BACKWARDS:
For I=1 to 10
    Pulsout 7,30 
    Pulsout 0,250 
    Pause 5
Next
Goto MAIN

 

 

 

 Copyright ROBOTmaker © 2003. All rights reserved.
For problems or questions regarding this website please  contact [support at ROBOTmaker.co.uk].
Last updated: June 13, 2008.