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.
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
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview