-
Notifications
You must be signed in to change notification settings - Fork 225
PING 28015 ultrasonic sensor
Jaume Olivé Petrus edited this page Sep 18, 2017
·
22 revisions
This sensor provides precise, non-contact distance measurements from about 2 cm to 3 meters.
The PING))) sensor works by transmitting an ultrasonic (well above human hearing range) burst and providing an output pulse that corresponds to the time required for the burst echo to return to the sensor. By measuring the echo pulse width, the distance to target can easily be calculated.
Please, take in mind, that sound speed depends on ambient temperature, about 0.6 m/secs per celsius degree, so combine this sensor with a temperature sensor if you want to get accurate measurements or if the sensor can be subjected to a wide temperature range.
Power supply:
- Supply voltage: +5 VDC
- Supply current: 30 mA typ; 35 mA max
What | Comments | |
---|---|---|
Identifier | PING28015 | |
Interface | GPIO | 1 pin |
Provides | distance | cm |
Properties | temperature | sound speed depends on ambient temperature |
Datasheet |
-- Attach sensor to GPIO26
s = sensor.attach("PING28015", pio.GPIO26)
-- We tell to PING28015 that ambient temperature are 25º for adjust
-- the sound speed, used internally for calculate the distance from an
-- object
s:set("temperature", 25)
while true do
print("distance: "..s:read("distance"))
tmr.delayms(500)
end