Go Down

Topic: 4 pin ultrasonic range finder, 3 pin ping sensor (Read 1 time) 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.
Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

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