1.Working Voltage : 5V(DC)
2.Static current: Less than 2mA.
3.Output signal: Electric frequency signal, high level 5V, low level 0V.
4.Sensor angle: Not more than 15 degrees.
5.Detection distance: 2cm-500cm.
6.High precision: Up to 0.3cm
7.Input trigger signal: 10us TTL impulse
8.Echo signal : output TTL PWM signal
Pinout:
1.VCC
2.trig(T)
3.echo(R)
4.GND
Arduino example:
- #define SOUNDCONSTANT 340.29
- #define TRIG 2
- #define ECHO 3
- void setup()
- {
- Serial.begin(9600);
- pinMode(TRIG, OUTPUT);
- pinMode(ECHO, INPUT);
- digitalWrite(TRIG, LOW);
- }
- void loop()
- {
- unsigned long TimeMs;
- double DistanceCM;
- /* Triggers the module to send a ping */
- digitalWrite(TRIG, HIGH);
- digitalWrite(TRIG, LOW);
- /* Measures the time for ultrasonic burst to leave and return. */
- TimeMs = pulseIn(ECHO, HIGH);
- /* Calculates the distance to an object in CMs */
- DistanceCM = SOUNDCONSTANT * ((double)TimeMs / 20000);
- Serial.print("Distance to object: ");
- Serial.print(DistanceCM);
- Serial.println(" cm");
- delay(1000);
- }
Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.
Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.