I would like to make an ultrasonic range finder with a single transducer. The reason for only one transducer is because I'm limited in the amount of space I have for what I'm sensing. I've purchased the EZ01 ultrasonic sensor and it works well but I need to make my own now with a waterproof transducer. I have the transducer which is 40kHz but need to put together the other components along with my arduino. I'm wondering if anyone has any experience with this and could direct me to a schematic or any information on how to wire this up and use the one transducer as a transmitter and receiver.
-
1\$\begingroup\$ Sounds a neat project - any ideas what the method used in the EZ01 was to measure range? It could use a radar type ping and quickly switch the transducer over to be a receiver and detect a ping coming back. Or it may be a continuous wave circuit with a sensitive circuit that differentiates reflections from output signals? \$\endgroup\$– Andy akaCommented Mar 24, 2013 at 20:47
-
\$\begingroup\$ This is do-able however you'll be limited in the minimum range you can detect. The ceramic transducers ring for a while (at the resonant frequency, obviously). The Polaroid SX-70 used a single electrostatic transducer for sonar ranging (autofocus). \$\endgroup\$– Spehro 'speff' PefhanyCommented Aug 8, 2018 at 14:46
1 Answer
How do you make a range sensor using one transducer:
- EZ01 ultrasonic sensor is a 42kHz transducer
- Arduino-based
As you can see from the EZ01 datasheet, it has the ability to do both. It is the same pinout as my MB7380 sensor:
How do you waterproof electronic sensors?
→ silicone heat shrink tubing and waterproof epoxy
There are $13 waterproof ultrasonic sensors on eBay ($15 on Amazon). As Chris Stratton says, the EZ01 is not designed to work in aquatic environments. After all, water is 850 times denser than air.
C
unsigned long startMillis;
unsigned long currentMillis;
const byte pinTX = 9; // trigger
const byte pinRX = 10; // echo
void setup() {
startMillis = millis(); // initial start time
pinMode(pinTX, OUTPUT);
Serial.begin(9600);
}
void loop() {
currentMillis = millis(); // milliseconds since start
// Reads & returns sound wave traveled in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculate distance
distance= duration*0.034/2; // DO: Change this calculation...
// From here it depends on how you want to output the data: datalogger, LCD screen, etc.
// See https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/
}
// Function you probably don't need:
void read(){ // for connecting to pin 4 on sensor
int len, m;
char testStr[] = "R012\r"; // <test> This version takes 1870 bytes
// in = Serial.read(pinRX);
len = strlen(testStr); // <test>
// len = strlen(in);
return m = atoi(&testStr[len - 3]); // <test>
// Serial.println(m); // <test>
// m = atoi(&in[len - 3]); // measured TTL serial output converted
}
-
3\$\begingroup\$ You simply cannot waterproof a typical in-air ultrasonic sensor leaving it still working, you must use one designed from the start to be waterproof. \$\endgroup\$ Commented Aug 8, 2018 at 15:15
-
\$\begingroup\$ Maybe he means water resistant or rain proof. Another way is putting the pinout end in a box like I show. \$\endgroup\$– adamaeroCommented Aug 28, 2019 at 14:12