Investigation of HC-SR04 Ultrasonic Transducers - Page 1
Forum section: electronics / projects

author: TonyBe
author_rank: Regular Contributor
timestamp: October 07, 2021, 09:14:44 am
content: Hi folks,recently I've had a chat with a student of electronics at the university im working at. He was complaining about the missing possibilities to get into radar concepts like simple puls radar or phased array antennas to determine the angle of arrival. Open source radar plattforms are rarely available and quiet expensive. So we've discussed to get to lower frequencys to play around with those concepts.Looking for Ultrasonic transducers I've quickly realized, that there are not many cheap parts available. So I've remembered my experiments with the so familiar HC-SR04 back the good old days. I acutally can remeber that nearly everbody playing around with arduino and stuff had some of them floating around in the parts bin. So I've desided to examine those modules a little further - especially the transducers. These modules are incredibly cheap and even come with some chips (Quad LM324 f.ex.) to add to the parts bin if necessary.To get us all to the same point:HC-SR04 on RS:https://de.rs-online.com/web/p/bbc-micro-bit-add-ons/2153181/?cm_mmc=DE-PLA-DS3A-_-google-_-PLA_DE_DE_Raspberry+Pi+%26+Arduino+und+Entwicklungstools-_-(DE:Whoop!)+BBC+micro:bit+Add-Ons-_-2153181&matchtype=&pla-328481528778&gclid=CjwKCAjwkvWKBhB4EiwA-GHjFrCJMQqtmoMNHvE_7eVK3P8whGZq2mV1NesbNbtTyuoPUNaOQQtxahoClcoQAvD_BwE&gclsrc=aw.ds (can be much more cheaper if bought at other places)a lot of good work has been done on the topic by various people (for example:https://www.davidpilling.com/wiki/index.php/HCSR04)My scope - as mentioned, will be on the transducers. First thing I did was to unsolder both of the transducers from a sonar module. As expected they were labeled with "T" and "R" for transmitting and receiving. Fun fact: they were swapped on my boardand as we will see later, that makes quiet a huge difference indeed.First measurement was done on the Impedance of the transducers. To do so, I've used a RedPitaya in BodeAnalyzer mode and measured the frequency response from 1 kHz to 1 MHz. With a 1K resistor in series, the impedance was easily calculated from the measured response:Measuring the impedance should show the frequencies at which the piezo inside the transducer works the best. As clearly visible, there are several resonance points, the most obvious been at around 330 kHz, followed by the peak at around 340 kHz. At those two frequencies, a series and parallel resonant circuit is formed (therefore biggest and lowest local impedance). One thing to take into account here, is that we will not only measure the response of the mechanical resonant circuit of the piezo, but all other components as well. For these transducers, it is well known, that they work at around 40 kHz. So it is obvious, that these two resonances are from electrical origin (capacitance formed by the two plates and inductance of the wires and stuff)."Trap for young players[..]" - David L. JonesSo let's check the rest of the response. Below 100 kHz you can also see some thing going on:In this plot I've measured the RX and TX transducers impedance to compare against each other. As we can clearly see, there are several spots, where the impedance is at a local minimum. The TX piezo hits the 40 kHz quiet well, where as the RX one is off by ~2 kHz. I actually don't know if this is due to fabrication variation, but since those resonances are quiet high Q, we can expect to lost a lot of sensitivity there.Another thing that pops out is the fact, that the TX seems to have 3 resonance frequencies instead of the 2 from the RX piezo. This makes me wonder what the mechanical difference between RX and TX might be. I'm planing to open up the two transducers and have a look under the microscope.One last test was done: The TX transducer was connected to the generator side of the bode analyzer, RX to the scope side (so correct orientation). Then I've faced the cones of the transducers to each other and taped them down to the table. Measuring the frequency response ones with this correct setup and then with RX and TX being swapped, shows the difference in the transmission path:This test shows clearly, that - when connected as intended, we can achieve about 20 dB less path loss at 40 kHz. The test also shows, that the other resonance at ~58 kHz provides transmission as well. So if your HC-SR04 is performing poorly, it might be worth it, to check if the transducers are placed correctly.So I hope this will help some of you. I am planing to throw some more content to this kind of stuff out in the next time - using these results as basics for circuit design.This post should be more of a knowledge sharing thing than a perfectly fine concluded evaluation.Please feel free to ask, share suggestions or correct me if I'm wrong.Have a good time,Tony

author: Kleinstein
author_rank: Super Contributor
timestamp: October 07, 2021, 09:29:27 am
content: The resonance at some 330 kHz is still relative sharp. An electrical resonance from parasitic inductance tends to be no very high Q, like a mechanical resonance.For the transmission the distance and possible acoustic resonances in the air can have some effect. So for the test it may be better to have the sender / receiver more separated (e.g. some 10 cm) in a relativeyl free field to reduce resonances.It is interesting that they both work resonable well also at 58 kHz. Chances are the directionality could be different with the high frequency.

author: TonyBe
author_rank: Regular Contributor
timestamp: October 07, 2021, 10:59:26 am
content: Yeah, that's right. I even was suprised that there is a resonance at 300 kHz since the parasitics have to be quiet large to form a resonance circuit at that lowish frequency. Since I've used coaxial cables of ~4cm length, it shouldn't be that much of inductance or capacitance.Directivity.. also a good point. I can think of a higher surface wave mode on the metal cone of the "speaker" part of the transducer could result in this second resonance. But then the directivity won't be as focused due to interference.Regards

author: TonyBe
author_rank: Regular Contributor
timestamp: October 08, 2021, 11:37:35 am
content: Hi again,today I've measured the RX Frontend path. Suprisingly, the bandpass filter seems to have been designed around 20 kHz. That is kind of strange isn't it?I wonder if this is a general issue or just due to horrible production variance in the parts on my board here.I've used LTSpice to build the filter according to the schematic, given by David Pilling (see Link above). And it confirmes, that this filter is made to sit around 20 kHz. That will mean that all HC-SR04 give away ~20 dB of sensitivity... Why would that make sense?I think I'll quickly design a filter to fit the 40 kHz region better.Kind regardsTony

author: TonyBe
author_rank: Regular Contributor
timestamp: October 21, 2021, 04:39:42 pm
content: Hi,took a while to get it done due to vacation. Anyway. I'll tried to keep it as simple as possible so that one can easily reproduce it without of modifying the whole PCB.There are actually 2 steps to go to buff this module massively, refer to the schematic @http://www.pcserviceselectronics.co.uk/arduino/Ultrasonic/electronics.php#circuit:1) Replace C2 and C3 (the two capacitors on the bottom left when looking from the populated side of the PCB) with 390pF Caps. That will shift the bandpass frequency to the right place (~41 kHz)2) Since the RX Signal is now much stronger, the sonar keeps triggering on the first crosstalk pulse of the transducers, making it "blind" for actual measurements. After thinking about this problem I decided to keep it extremly simple as well. Just put a little diode across R12 with the anode pointing to the right. This has the effect, that the Threshold Cap C8 gets discharged further down before R12 charge it back up. The goal here was to create enough charging time, that the crosstalk has been over before the threshold is back up again. I honestly expected the need of tuning R12, but it happenes to work out exactly fine with the 75k in there. Lets have a look at some measurements here:One can clearly see the Trigger in Yellow, the resulting Echo Signal in Green, the output of the RX Frontend in Red and the Threshold input in Blue. Cause of my setup, the red curve is the output of the last OPA stage, not the exact input to the comparator, so don't be confused about the voltage scaling of the channels. You can clearly see, that the Blue curve gets discharged all the way down, increasing the charge cycle and therefore ignoring the high crosstalk pulse.For completeness, a picture on where to put the modifications:Conclusion:with this mod i was able to measure the oposing wall of my lab, beeing roughly 5m away. When placing my hand ~2m away, I still get quiet stable responses. When measuring my self, I can get clear recognition from the sonar up to 3-4m with respectable jitter in the "Echo" signal.I really hope that this might be usefull for some of you!Enjoy, have a nice day and keep on playing with electronicsCheersEdit: Forgot to mension one important thing here. Of course the diode discharge will stress the MCU Gpio stage with high pulse current and can lead to damage in that stage, although I don't think that this would be an critical issue with that low of a cap and voltage. If you're feeling able to, put a series resistor of 10r or so in series with the diode to be on the safe side.