oSonarPL Object
An Object that reads a Polaroid Ultrasonic Range Finder.
Description:
 

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.

Operation:
 

The oSonarDV 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.  All that is required to retrieve this distance, is changing the Operate property from a value of 0 to a value of 1.

When the oSonarPL's Operate property transitions from 0 to 1, a ping signal is sent out the I/O line specified by the IOLineP property, the Transmitting property is set to 1 and the Received property is cleared to 0.  After which, the oSonarDV monitors the IOLineE property waiting for an echo.  Once the echo is received, the time-of-flight is stored in the Value property, 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.

Storage size & Availability:
 

The following table lists the size and availability of the oSonarPL Object and its variations:

ObjectSizeFirmware VersionCompiler Version
oSonarPL6 BytesB.1.04.00
Properties:
 

The following table lists the Properties of the oSonarPL Object:

PropertyDescription
Address

Returns a pointer to the address of the oSonarPL Object instance.

Data-Type: Address, Read-Only

Data-Range: 0 - 127

IOLineE

A value that specifies the physical I/O Line to use for the Echo signal.

Data-Type: Byte

Data-Range: 0 - 31

IOLineP

A value that specifies the physical I/O Line to use for the Ping signal.

Data-Type: Byte

Data-Range: 0 - 31

Operate

A value that specifies whether or not the data is updated.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Received

A value that indicates that an echo was received.

Data-Type: Bit, Flag

Data-Range: 0 - 1

TimeOut

A value that indicates that the sonar ping went out of range.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Transmitting

A value that is set to 1 when the sonar Pings.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Value

A value that indicates the last sonar reading.

Data-Type: Word, Default

Data-Range: 0 - 32768

Example:
 In the following example, the oSonarPL Object is used.
'This program reads an oSonarPL
'Object and outputs the distance
'on I/O lines 8 - 15.

Dim A As New oSonarPL
Dim D As New oDio8

Sub Main()
  A.IOLineE = 8
  A.IOLineP = 9
  A.Operate = 1  
  D.IOGroup = 3
  D.Direction = cvOutput
  Do 
    A.Operate = 1
    A.Operate = 0  
    OOPic.Delay = 500
    D = A
  Loop  
End Sub
Connections:
The oSonarPL uses 2 I/O lines and 2 power lines.  The I/O lines can be any 2 of the OOPic's 31 I/O lines.  The Polaroid Sonar requires a 5 to 6 Volt power supply that is capable of handling roughly 2000mA (2 amps) during the transmit period and 100ma after the transmit period.
Polaroid Sonar Ranging Unit
PinNameDescriptionI/O NameOOPic
I/O Line
1GndGround G
2BLNKBlanking  
3    
4INITInitializationIOLinePAny
5    
6OSCOscillator  
7ECHOEchoIOLineEAny
8BINHBlanking Inhibit  
9V+  +5
See Also:
 

oSonarDV - An Object that reads a Devantech SRF04 Ultrasonic Range Finder.