Piezo transducer signal conditioningPosté le 6th juin 2009 57 commentaires
WORD Of WARNING : the Bat85 schottky diode used here has a too low Vrrm for the piezos ! Use a diode that can stand at least 200V Vrrm ! Thanks Alan for spotting this.
Piezo transducer are very common, very cheap, and can be very useful as sensors : sound, knock, shock, whenever it « moves » or « makes noise », a piezo sensor can help.
However, the signal from those things is very unpleasant for the digital hacker : it’s roughly a sinewave that dampens over time. Also, the signal often goes negative which is pretty bad for mots digital chips out there. The ATmega168 (and most of the atmel 8 bit microcontrollers), for instance, indicates that voltage on any pin must be between -0.5V to VCC+0.5V. Piezo transducer easily go far beyond those bounds.
In the capture below, voltage from the piezo goes a down as -52V and goes up to 9.2V. This is more than 60V peak to peak. If you don’t do anything, your poor microcontroller might get sick rather quicly :
In this capture, the signal first drops to -20V, and then flies up to over 35V. Almost 60Vpp here too.
These are just examples, I didn’t tweak the piezo or smashed it with a hammer : just a hit with a fingernail, and you almost always end up having huge Vpp values. Also, the behaviour is not predictable (well piezos are, but the way we smack it isn’t), so it might go up first, then down, then up, who knows…
A close up shows the « dampening sine-like signal » that occurs after the first big spikes :
So signal conditioning is a must with those pesky animals if you’re doing digital.
Let’s recap what has to be done :
- make that signal all positive : most of the time, piezos signals are read by ADC, so we want positive voltages
- restrict signal bounds to 0 – VCC so voltage doesn’t climb to scary values (scary at least for microcontrollers and ADCs),
- shape the signal so it doesn’t make bumps and stays clean and predictable
All these requirements are surprisingly easy to achieve. We will get to this goal in three steps, each spect taking care of one item above. Respectively :
- add a half-wave rectifier, in order to keep positive part of the waves
- add a zener diode, so signal doesn’t climb over zener’s breakdown voltage
- add a RC pair so ripples get filtered
Half bridge rectifier
First, we want to rectify the piezo signal, i.e. make it all positive. We’ll use Schottky diodes for that. Schottky are more interesting since they have a pretty low (compared to standard rectifier diodes) forward voltage drop (Vf), around 0.3V.
You might ask : why not use a complete Schottky-based bridge rectifier, and make the whole signal positive, instead of filtering negative voltages ?
Well, look back at the first scope shots of raw piezo signals. When signal changes sign, it makes it rather violently, and can even be higher on the new side than it was on the previous side. Now try to make the math abs() operation on the shape, mirroring the negative part of the shape on the other side of the time axis. You’ll end-up with an erratic plot : low, then high, then low. This means that, even with some filtering, you wont end-up with clean shape, but with a jittering thing that will look like the first signal, but all positive and less wild. This is not what we want, so we are sacrificing the negative part of the signal to get something nicer (the fine Agilent firmware bug is provided free of charge .
In fact, well do a bit more than a half wave rectifier. If we just put a Schottky diode in series with the positive we’ll end up with the kind of signal shape shown on the left. We can see there is a fair amount of signal that is still below 0v, and in our circuit, we’re not supposed to have negative voltages. Even if the ADC can stand it, it probably won’t do any interesting measures with a negative signal.
There is probably a good reason for this to happen, but I don’t have a clue right now. If you do, please leave a comment.
So we have to get rid of this negative leftover, by adding a second Schottky diode, between ground and signal lines. We’ll just keep the positive signal, but it will be much easier to filter this way.
Our piezo signal rectified by two Schottky looks like this (the wavefom has been moved to the bottom of the screen for cosmetic reasons). We still have negative voltable building up, but it’s pretty negligible now. I wonder if that -400mV is linked to the diode’s forward voltage.
Althought the scale isn’t the same, the small ripples seem to have disappeared. This might be due to the Schottky diode capacitance (14pF), which, while low, could impact the small ripples with higher frequency. I didn’t have time to check that though.
Now, we need to cap the maximum voltage in circuit, so we don’t fry our ADC.
As seen above, voltage range is pretty high and can climb quickly to unappropriate values for digital purposes. So wee need to tame the voltage created by the piezo. Zeners have this ability, and can limit voltage to a fixed value. Whenever voltage is higher than the Zener’s rating, the Zeners lets current flow thru and as a side effect, help maintain voltage to a fixed value.
We usually have to add a resistor between the Zener and ground, so voltage builds up around it and current is limited thru the Zener. But this is not necessary with piezo, since involved currents are very very low.
After we add a 5.1v Zener in the circuit, the voltage read from a piezo looks like this.
You can smash the piezo as hard as you want, you’ll never exceed the Zener’s rated voltage.
If we just use this shape as is, we’ll have a hard time trying to guess if the piezo has been smashed or not. We have to filter those spikes to get a smoother shape.
Filtering the signal
This signal can be filtered by using a RC cell. Whe just need to know how long we want the shape to last. For my application (drum trigger), I want the signal to fade out in 10ms maximum. Since we know that the voltage drops to 10% of the initial voltage after , we can find the right resistor knowing the capacitor value, and vice-versa.
Let’s say we use a 1MΩ resistor, we’ll have to use a capacitor.
And get this nice little shape :
Hope this can help you using those pesky beasts. Be warned that piezo are all differents, and that size matters… So experiment with that before engraving the above stuff in copper.
the 2.2 is a constant factor in this equation.
The equation for discharge of a capacitor is: U(t)=Umax*e^(-t/RC). If you wish to get the time for a discharge of 90%, <> is 0.1.
To solve the eqation, you need to <> the whole equation, so you get t(90%)=-ln(0.1)*R*C.
Now get your calculator and look what ln(0.1) is
lol my brackets are gone
the first is: Umax/U(t)
the second : ln
damn the first one is of course U(t)/Umax
Leucos, thank you very much for the write-up. Finally piezo readings make sense, after years of trying to ‘guess’ hit velocity in software. Also i didn’t know about the negative voltage. // i am reading 6 piezo on an arduino and get great dynamics.
- For the Zener i was advised to use one with a breakdown @3.9V
- The Schottkys i use (1N4448) are rated 70V U_rrm only, due to availabilty.
ps: Could you proof check the circuit diagram? i believe the second (reversed) schottky should go from Gnd straight to Piezo-Conn-2.
3 Trackbacks / Pingbacks
[...] Piezo transducer signal conditioning, un article en anglais sur l’optimisation des capteurs piezo. [...]
[...] Piezo transducer signal conditioning, un article en anglais sur l’optimisation des capteurs piezo. Fournisseurs de matériel France [...]
[...] augmentation question After some more digging, I have found this relevant article on the web here. It looks like my only option is to play with the RC circuit values. Reply With [...]
Laisser une réponse