Go Down

Topic: 4 pin ultrasonic range finder, 3 pin ping sensor (Read 2011 times) previous topic - next topic

wikitjuggla

can a 4 pin ultrasonic range finder be operational using only 3 pins as on the parallax ping sensors?

Thank You

HazardsMind

No, with the 4 pin, they have split the data lines to Echo and Trigger, instead of a single line. The 3 pin code will work, you just need to tweak it to work with trigger and echo. HINT: one is input and the other is output.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

liudr

You want some code or just general advice whether to buy a 4-pin sensor but run the 3-pin code?

Here is code snippet:

Quote
micros_now=micros();
    digitalWrite(sonic_ranger_init,LOW);
    delayMicroseconds(2);
    digitalWrite(sonic_ranger_init,HIGH);
    delayMicroseconds(15);
    digitalWrite(sonic_ranger_init,LOW);
    delayMicroseconds(20);
    micros_delay=pulseIn(sonic_ranger_echo,HIGH,35000L);
    distance_mm=micros_delay*343/2000; // This is round trip time so 1/2/1000=1/2000
    Serial.println(distance_mm);


Go ahead and but the 4-pin sensor.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy