I wrote this sketch to read the ping delay of a HC-SRO4 ultrasonic distance sensor, and activate a buzzer whenever something got within a 500 millisecond delay of the sensor. My plan was to mount the ultrasonic sensor to the bottom of the bumper of my father’s car, which has a very low front chrome bumper, so that it would beep whenever he got too close. Please help! It always turns on the relay, no matter the status of the sensor. I double checked this by including a “print to serial” command. Any troubleshooting advice would be greatly appreciated.
A round trip time of 500 ms from ping to echo detection would mean the distance was 85 meters (280 ft). Can your range finder detect the echo from a car sized object at that distance?
You should probably let the library translate to centimeters (.ping_cm()) ot inches (.ping_in()) for you. How many people know the round-trip distance for 500 microseconds?
johnwasser:
Oh... the sketch says 500 microseconds.
You should probably let the library translate to centimeters (.ping_cm()) ot inches (.ping_in()) for you. How many people know the round-trip distance for 500 microseconds?
Assuming the speed of sound = 767 mph = 343 metres per second, then I reckon the round trip would be about 8.5 cm = 3.3 inches. Rather close at 1.6 inches I’d have thought!