oSonarPL Object

Main Index
Object List
Back to top of page Description:
 

The oSonarPL is a Hardware Object that controls a Polaroid Ultrasonic Range Finder and measures the distance between the sonar transducer and its target in 64 steps per foot increments.

The division of Polaroid that made ultrasonic sensors is now known as Senscomp.  You may still find the Polaroid name being used to refer to the Senscomp family of ultrasonic rangers.

 The following table lists the size and availability of the oSonarPL Object.
 ObjectSizeDescriptionA1A2B1B2C1
oSonarPL6 BytesReads a Polaroid 6500 sonar ranging module.xxx
Back to top of page Operation:
 

The oSonarPL Object handles all the necessary I/O timing required to communicate with the Polaroid Ultrasonic Range Finder and measure the distance between the sonar transducer and its target. 

When the oSonarPL Object's Operate property transitions from 0 to 1, the sonar unit is instructed to send a ping signal, the Transmitting property is set to 1 and the Received property is cleared to 0.  After which, the oSonarDV Object waits for an echo.  Once the echo is received, the time-of-flight of the echo is stored in the Distanceproperty, the Transmitting property is cleared to 0 and the Received property is set to 1.

If no echo was received after a short period of time, the Transmitting property is cleared to 0 and the TimeOut property is set to 1.

A single sonar ping is sent for each time that the Operate property transitions from 0 to 1 which results in a single sonar reading being updated into the Distance property.  This is different than most of the other ooPIC Objects which continually update the properties.  This difference was designed into the oSonarPL Object so that multiple sonar units could be controlled without Ultrasonic interference between them.

To continually update the Distance property, the Operate property needs to be toggled at the rate that the sonar needs to be monitored.  This can be accomplished by linking the Output property of an oClock to the Operate property of the oSonarDV Object.

The FeedBack property is an instance of the oFeedBack1T Object which is created when the oSonarPL Object is.  The oSonarPL Object uses the oFeedBack1T Object to do the actual ping/echo timing for the sonar.  (see oFeedBack1T Object for more detail on how the sonar is controlled.)

Back to top of page Properties:

The following table lists the properties of the oSonarPL Object:

Property

Description

Distance
A value that indicates the distance to the item in front of the sonar.
Object Class: oDistance2 Value Range: 0 - 32768*
Data Type: Numeric Default Value: 0
*The maximum distance that the Polaroid Ultrasonic Range Finder will detect a target is 35 Feet.  35 Feet * 64 steps per foot = 2240.  Therefore, the maximum value that Distance will return is 2240.
Transmitting
A value that indicates that the sonar has pinged.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
TransmittingDescription
0

A ping has been sent.

1

A ping has not been sent.

Received
A value that indicates that an echo was received.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
TransmittingDescription
0

A ping has not been received.

1

A ping has been received.

TimeOut
A value that indicates that the sonar ping went out of range.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
TimeOutDescription
0

The ping has not timed out.

1

A ping was not received after it was sent.

IOLineE
A value that specifies which I/O Line is connected to the Echo signal.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
IOLineP
A value that specifies which I/O Line is connected to the Ping signal.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
Operate
A value that selects when the sonar is to send a ping.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

A ping is not sent.

1cvOn

A ping is sent.

FeedBack
The I/O function object used to measure the time-of-flight of the sonar ping.
Object Class: oFeedBack1T Value Range: 
Data Type: Numeric Default Value: 0
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Examples:
 In the following example, the oSonarPL Object is used.
Visual Basic SyntaxC and Java Syntax
'This program reads an oSonarPL
'Object and outputs the distance
'on Scott Edwards LCD.

Dim A As New oSonarPL
Dim D As New oLCDSE

Sub Main()
  A.IOLineE = 31
  A.IOLineP = 30
  A.Operate = 1  
  D.IOLine = 16 
  Do  
    A.Operate.Pulse(1,1,250)
    D.Clear
    D.VString = Str$(A/64)+"."+Str$(A Mod 64)
  Loop  
End Sub 
// This program reads an oSonarPL
// Object and outputs the distance
// on Scott Edwards LCD.

oSonarPL A = New oSonarPL;
oLCDSE D = New oLCDSE;

Void Main(Void){
  A.IOLineE = 31;
  A.IOLineP = 30;
  A.Operate = 1;
  D.IOLine = 16;
  Do{
    A.Operate.Pulse(1,1,250);
    D.Clear;
    D.VString = Str$(A/64)+"."+Str$(A Mod 64);
  } While (1);
}
Basic Syntax 
'This program reads an oSonarPL
'Object and outputs the distance
'on Scott Edwards LCD.

A As oSonarPL(31,30,cvOn)
D As oLCDSE(16)

Do  
  A.Operate.Pulse(1,1,250)
  D.Clear
  D.VString = Str$(A/64)+"."+Str$(A Mod 64)
Loop
 
Back to top of page Connections:
The oSonarPL uses 2 I/O lines and 2 power lines.  The 2 I/O lines can be any 2 I/O lines of the ooPIC's 31 I/O lines.  The Polaroid Ultrasonic Range Finder requires a 5 Volt power supply that is capable of handling roughly 150mA of continuous output and 2.5 Amps during the ping.
Polaroid Ultrasonic Range Finder
PinNameDescriptionI/O NameooPIC
I/O Line
15v+5 Volt power  
2EchoEcho OutputIOLineEAny
3TriggerPulse Trigger InputIOLinePAny
50v GroundPower Return G

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oSonarDVReads a Devantech SRF04 Ultrasonic Range Finder.xxx
Back to top of page Version History and Bug List:
 Firmware Ver B1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.