Ultrasonic module Hacking
Previously I did a virtual teardown based on my web research. Now that my ultrasonic modules have arrived. I am going to do some hacking and measurement.
Module Weight: 8.3g
Standby current: 2.7mA (5V), 2mA (3.3V)
The following waveforms are for 5V power:
There are 8 pulses. The measurement is singled ended of one of the transmit pins and referenced on ground. The other terminal is driven with an opposite phase. The amplitude is closed to +/- 9V.
Zoom out view of the transducer waveform for larger time scale
It take quite a few hundreds of us for the transducer to damp and the signal to decay.
Good news:
- there are no major overshoots/undershoots, so I might be able to save a couple of diode arrays.
- the amplitude is really only 4.5V single ended, so may be I can drive it at 3.3V. I can always crank up the receiver gain to compensate.
- The case of the transmitter is electrically isolated, so I guess I don't have to worry abut insulating the transducer case. On the other hand, no electrostatic shielding.
I am going to do more measurement/hacking... Stay tuned. Going to try taking better picture at night hopefully less ambient lights means less reflections on the scope pictures.
My quick and dirty way of generating 40kHz waveform from AVR chip (for proof of concept testing/hacking only)
Bare minimum: 3.3V ATmega8L: OC1A, OC1B set up for Fast PWM and complementary waveform using internal 8MHz RC oscillator. The RC oscillator is running a bit slower at 3.3V, so I have to tweak the period to match the speed. (too lazy to look up tweak register)
I have desoldered the Driver and the MCU on the module. I am driving the transmit transducer directly with ATMega pins. CH1, CH2 on scope are hooked up to OC1A, OC1B. So the transducer is being driven at +/- 6.6V.
Waveform of the complementary OC1A, OC1B output
- stop the output after 8 cycles
- ground the two pins for a short period of time
Tristate one of the pins while pulling the other one to ground (for using the same transducer as receiver.)
While the I/O pins on the MKL16 can do the same, I don't think it would be a good idea in an actual product as they are not even 5V tolerant. If the device get dropped, the piezo transducer might generate enough voltage to upset or worse - silently damage the $5 ARM.
I would rather use a $0.50 74LVC125 as a buffer. It has an Absolute Maximum Rating of 6.5V and can be beefed up further with external diode clamps.
New code with the modifications (10 minutes hack, so don't expect too much)
I drive the transducer for 8 cycles (I might have miscounted the start & stop), grounded both the outputs for 8 cycles (shorted them), then tristate one of the pins (which would be used by the receiver as some point.)
Zoomed out to shows the ringing from the stored mechanical energy in the form of vibrations in the transducer which goes on for more than 1 ms. Notice the amplitude exceeds the power rails. I'll need to add some diode clamps. Using the 74LVC125 with the higher voltage tolerant as a driver is a good idea.
Done a bit more work.
Some changes and they seem to make it closer to the original. Haven't done range testing, but now I can see the reflections on the scope.
- Using a 12MHz crystal. This helps with getting a more accurate 40kHZ signal
- Corrected the test board so that it is the same as the other 4 from the same purchase batch. (pin 4 of U2B was grounded instead of connecting to the half rail.)
I have increased the amount of the time that the outputs stays at ground after the initial burst to 32 pulse time. The residual pulse is a lot smaller, but at the same time it increases the dead zone to possibly 20-30cm (8-12") or more if I am to use the same transducer for receiver. There are probably still some minute residual signals that will swamp the echo signal which is at the millivolt or lower.
Top trace shows the received signal at U2B pin 7 - the 2nd stage of amplifier just before the comparator. This is where I'll be feeding the analog signals to the ARM's comparator as well as ADC. That pulse there is probably due to the vibration through the PCB.
I think I can get a bit better performance to compensate for the lower transmit voltage by tweaking the circuit values a bit.
I have noticed that they change the half rail bias values. I'll see if that improves a bit on the power up.
Here is my trade-off analysis:
Weight of Rx transducer: 1.9g each
PCB weight: 3.1g/4= 0.775g (bare module board weight divide by 2 for thinner PCB, another divide by 2 as it is adding 1/2 the board area)
So we are looking at 2.575g x 2 for the two side = 5.15g for using the extra 2 transducer - one for each side. It might be worth keeping the transducer separate even with the extra weight to not have to compromise receive performance.
According to LTSpice for the gain at output of U2C at 40kHz
LTSpice seems to be having some convergence issues with U2B in the model. U2B gain is 7.5X (17.5dB)
With values as show: overall gain = 11.8dB
With R3 = 1.5K, R5 = 22K: gain = 32dB (this ocrrected for the wrong 19kHz filter frequency. It is now at 39.26kHz)
I boost the gain by changing R2 = 220K: gain = 43.54dB
I have to compensate for the reduced transmit power (3.3V vs 5V), so I increased the gain by 3.5X (11dB).
I ran the AVR at 3.3V, so the transmitter is driven at about 6.6Vpp vs the 10Vpp at 5V input.
I took the following measurements for a quick test of the range. This just happens to be a convenient location and not necessarily the limit of the range. (Breadboards and logic probe clips aren't stable nor is the scope portable enough to be moved around for measurements.)
The breadboard is sitting on a cardboard box on top of my tripod. It is about 60cm (2') off the floor.
Top trace is at the ultrasonic transmitter.
Bottom trace is at output of U2B (pin 7)
Ultrasonic receiver waveform from multiple objects |
The 2nd blip is from the wall at the threshold about 2m (~79"). 2[m] /340 [m/s] x 2 = 11.7ms (2.9 divisions)
The blip between the 2nd and 3rd (near scope Y axis) is from the door. Width of door = 0.7m which is just about 4ms.
The 3rd blip is from the far wall at just bit over 4m (~157.5"). 4[m] / 340 [m/s] x 2 = 23.5ms (5.9 divisions)
The module works okay with the modifications I made. The noise floor is a bit high, but there is enough of signal to see the reflections. I don't have an explanation to account for the double echo.
I took off the AC coupling and zoomed out to try to look at the signal again. i.e. literally the bigger picture
Really not to sure what to make of the signal except to see that the top part seems to be clipped. I am expected a symmetrical signal to the 1.65V mid rail virtual ground reference. The opamp on this is SGM324 which is supposed to be a rail to rail part.
I am starting to think that they are Chinese "relabel" LM324 with only get around to VCC - 1.5V = 1.8V (guaranteed min) for VCC = 3.3V They don't specify the light load, but I would expect the voltage is a bit higher. It sort of agrees with the measurement.
LM324 datasheet |
For a digital range finder, one could simply trigger off below the mid rail and get away with the non rail to rail LM324. However, that kind of clipping is unsuitable for the analog sonar mode where artifacts could be an issue.
I have been using the LMV324 model for my LTSpice simulation, it is what I have on my schematic for now. Thankfully most quad opamp are footprint compatible, so I can swap the part easily.
The part doesn't have Rail to rail Input range, so that's something that could cause problems when the input goes above its common mode input range (Vcc-1V) e.g clipping, phrase reversal.
Common mode range for LM324 at supply voltage = 5V |
A certain vendor of LMV324 say it out front that their part do not exhibit Phrase Reversal. Always read the fine prints in the datasheets for the particular vendor before you blindly substitute parts just because they have the same commodity part#.
Based on that last photo, the 2nd burst is likely caused by the transmitter ringing. I shorted the transmitter for 800us and then let the pins float because I was going to switch the transmitter to a receiver. There was enough kinetic energy in the transmitter to cause it to resume ringing. Look like I'll need to short the transmitter for the rest of the duration. Now that mystery has a possible explanation.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.