PING ultrasonic distance sensor is a sensor 40 kHz Parallax production is widely used for applications / robot contest. Advantages of this sensor is that only requires 1 signal (SIG), in addition to the 5V and ground lines.
PING sensor detects the distance of objects by emitting ultrasonic waves (40kHz) during tBURST (200us), then detect the reflection. PING sensors emit ultrasonic waves according to the control of the controlling microcontroller (trigger pulse with the tOUT min 2us).
This sensor specification is as follows:
- Measurement range of 3cm - 3m.
- Input trigger-positive TTL pulse, 2 us min., 5 us typical.
- Echo hold off 750 us from fall of trigger pulse.
- Delay before next measurement 200 us.
- Burst indicator LED displays the activity of sensor.
To try this sensor is required DT Basic Mini System and Software Basic Stamp Editor to program the microcontroller and try this sensor. The output of the SIG pin is connected to one port on the microcontroller kit. The following examples of sensor applications on the PING Basic Stamp 2 microcontroller, which pin SIG is connected to P9 and provide 5V power supply and ground. Function of PULSOUT is to trigger PING, while function of PULSIN is used to measure the pulse corresponding to the distance from the target object.
//Program to test PING distance sensor with DT-Basic Mini System
'{$STAMP BS2p}
'{PBASIC 2.5}
ping PIN 9 //connected to P9
// check type of Basic Stamp
#SELECT $stamp
#CASE BS2,BS2E
trigger CON 13
scale CON $0cd
#ENDSELECT
//constant calculation
rawtoin CON 889
rawtocm CON 2257
isHigh CON 1
isLow CON 0
rawDist VAR Word
inches VAR Word
cm VAR Word
reset:
//displays a message in the window
DEBUG CLS, "Paralaxx PING Sonar" ,CR,
"=============================",CR,
CR,
"Time (uS) . . . ",CR,
"Inches . . . . . ",CR,
"Centimeters . . . "
Main:
Do
GOSUB get_sonar //call function get_sonar
inches=rawDist ** RawToIn
cm=rawDist ** RawToCm
//display the calculation results
DEBUG CRSRXY, 15, 3,
DEC rawDist, CLREOL,
CRSRXY, 15, 4,
DEC inches, CLREOL,
CRSRXY, 15, 5,
DEC cm, CLREOL
PAUSE 100
LOOP
END
get-sonar : //main code
ping =IsLow
PULSOUT ping, trigger
PULSIN ping, isHigh, rawDist
rawDist=rawDist */Scale
rawDist =rawDist/2
RETURN
Then run the above program, then record the lowest and highest values measured in centimeters and also observe the influence of the emission angle of the measurement results.
There are PING sensor and other Distance sensor Selections :
4 comments:
Have a happy Wednesday to you. :)
Visiting and supporting again.
What IC is used in this ultrasonic sensor ??
you can use AT89s52 or ATMega8
Post a Comment