Robots and Systems
home   2 November 2010

Sensor Tests

Ultrasonic Sensors

SRF02    4mA Typ.       serial or IIC           Min Range: 0 cm
SRF05    4mA typical    pulse                   Min Range: 1 cm
SRF04    30mA typical   pulse                   Min Range: 3 cm
MaxSonar 2mA typ        pulse, analog, serial   Min Range: 15 cm
Ping)))  20 mA          pulse



SRF05                                              2 November 2010
-----
range calculation set to cm, [inches are approximate conversion]
conversion cm=(range in 2us units)/29

times out at 15387/15390 in 2us units, => 530cm
ie ~31ms

jitter measured at some arbitrary distances
jitter +3-0 at 1260 in 2us units, ie 1:400 or 1/4%
jitter +1-0 at 1047 in 2us units, ie 1:500 or 1/5%

max range
detects  2.5 cm [1"] dia pole at 104 cm [41"] 
detects  0.775 cm [0.3"] dia plastic rod at 102 cm [40"]

min range
range readings go down to 3cm on absorbent material=cloth 
range readings go down to 2cm on hard surfaces
below that reading can jump to 530 (no echo)

in general domestic environment max range to cupboards and walls is about 140 cm [55"]


Ping)))                                            2 November 2010
-------
range calculation set to cm, [inches are approximate conversion]
conversion cm=(range in 2us units)/29

times out at 9565 in 2us units, => 329cm
ie ~19ms

jitter measured at some arbitrary distances
jitter +1-0 at 1260 in 2us units, ie 1:1200 or 1/12%
jitter +0-0 at 1047 in 2us units, ie 1:1000 or 1/10%

max range
detects  2.5 cm [1"] dia pole at 209 cm [82"] 
detects  0.775 cm [0.3"] dia plastic rod at 130 cm [51"]

min range
range readings go down to 3cm on absorbent material=cloth 
range readings go down to 2cm on hard surfaces
below that reading can jump to 329 (no echo)

in general domestic environment max range to cupboards and walls is about 300 cm [118"]


Summary
=======
There is about 5mm [1/4"] difference between the Ping))) and SRF05 at 150 cm, 
no doubt due to delays in the circuitry of each sensor. 
Since the pulse values are scaled to the desired units (inches, mm, cm) in user software 
then if absolute accuracy is required the scaling and offset can be done easily.
The Ping))) has a longer range.

=========================================================

Test set up
-----------
Sensors driven by a Parallax BS2, 
information sent from the BS2 to PC over the Download cable.

'--------------------------------------------------------
' From the Parallax program Ping.BS2
'-----------------------------------
' At sea level sound travels through air at 1130 feet per second.
' This equates to 1 inch in 73.746 uS, or 1 cm in 29.034 uS.
' Since the Ping sensor measures the time required for the sound wave
' to travel from the sensor and back.  
' The result is divided by two to remove the return portion of the echo
' pulse, then multiplied by 2 to convert BS2 2uS resolution to uS.
' The final raw result is converted to cm.
'   uS2in         CON     889       ' 1 / 73.746 (with **)
'   uS2cm         CON     2257      ' 1 / 29.034 (with **)
'   us2cm  * 1/29.034 =>  * 0.03444 => * 2257/65536  => ** 2257
'   uS2in  * 1/73.746 =>  * 0.01356 => * 889/65536  => **  889
' so approximately - 
' Range = Range/29         ' convert to cm
' Range = Range/74         ' convert to inches
'--------------------------------------------------------
ping        PIN 14   'pin for both trigger and echo
SRF05       PIN 15   'pin for both trigger and echo
USrange     VAR Word

_GetUS:
  SRF05 = 0                'start with pin low
  PULSOUT SRF05, 5         'issue 10uS trigger pulse (5 x 2uS)
  PULSIN SRF05, 1,USrange  'measure echo time
  DEBUG CRSRXY,0,0,"US=",DEC USrange,"        "
  USrange = USrange/29     'convert to cm (divide by 74 for inches)
  'USrange = USrange/74     'convert to in (divide by 29 for inches)
  'USrange = USrange/148 MAX 15   '2" resolution (/74/2) better for a nibble
  DEBUG CRSRXY,0,1," UScm=",DEC USrange,"        "
  'DEBUG CRSRXY,0,1," USin=",DEC USrange,"        "

  Ping = 0                'start with pin low
  PULSOUT Ping, 5         'issue 10uS trigger pulse (5 x 2uS)
  PULSIN ping, 1,USrange  'measure echo time
  DEBUG CRSRXY,0,3,"US=",DEC USrange,"        "
  USrange = USrange/29     'convert to cm (divide by 74 for inches)
  'USrange = USrange/74     'convert to in (divide by 29 for inches)
  'USrange = USrange/148 MAX 15   '2" resolution (/74/2) better for a nibble
  DEBUG CRSRXY,0,4," UScm=",DEC USrange,"        "
  'DEBUG CRSRXY,0,4," USin=",DEC USrange,"        "
GOTO _GetUS
'--------------------------------------------------------