032 - IR Proximity Detection - Directional

Summary - Infrared Proximity sensing from one specified direction


32 <BYTE2> <BYTE3> <BYTE4>  (decimal format)

BYTE1: 32 (the command)

BYTE2: INDEX 0-7 for direction  (i.e. 0=N, 1=NE, 2=E, etc)

BYTE3: 01 = Decimal Output
BYTE3: 02 = Ascii Output
BYTE3: 03 = Ascii Output - Delimited

BYTE4: 0= single shot operation
BYTE4: 2
55 = continuous operation-

Response from IRCF360:

Average proximity readings from each direction:

Decimal format:  <INDEX>   <Reading> 
Ascii Format:       Hits <INDEX> = <Reading> 013 (Carrage return)
Ascii Delimited:   <INDEX> ;  <Reading>  013  (Carrage return)

Circular Display Feedback:

If an object is detect in any direction the corresponding LED will illuminate (see videos)


Similar to command 30, but proximity sensing is from one specified direction. 

Values from 0 to 50 are returned depending on the proximity of objects detected. Close objects have higher values.

This command is used for detecting obstacle in the direction the robot is travelling. For example when travelling forward direction,  only the N, NE, NW directions need to be probed for objects. This reduces the volume of data that need to be processed and reduces the IR noise which becomes specifically important with many robots. 

The command can be used for: 
  • Used in swarms and flocks. Specifically within flocks where a constant distance to a neighbouring flock member needs to be maintained to ensure collective patterns
  • proximity sensing when travelling in a direction and at the same time monitoring objects that may be moving towards it. 
  • executed when in a stationary position to make assessment of the stationary objects or object that are moving.  
  • Determine and avoid possible attacks when in robot gaming mode

Technical Features

Example Code:

The PICAXE 18X does not have a 'time-out' function, so it will 'hang' if the timing of the serial communication is not correct. With the new X2 parts these have a time-out routine so the command can be retransmitted. 

Example Programming Code for PICAXE

' on port b.2 send one-shot 360 degree infrared sensing command, at 9600 baud,  for zone 10 with decimal output
SEROUT b.2,T9600_8, (30,10,01,0) 
SERIN   2,T9600_8, N, NE, E, SE, S, SW, W, NW

Example Programming code for Basic Stamp

'On port 2 send one-shot 360 degree infrared sensing command, at 9600 baud,  for zone 10 with decimal output
SEROUT 2, 84, [30,10,1,0]  

' On pin 3 receive 8 bytes of data at 9600 baud. go to label timeout after 1 second if no data arrives. 
SERIN   3, 84, 1000, TIMEOUT, [N, NE, E, SE, S, SW, W, NW] 

SEROUT 2, 84, ["Timeout"]  Exmaple

Non (under construction)