…about Linux, electronics, digital photography, whatever…
Icône RSS Icône Accueil
  • Piezo transducer signal conditioning

    Posté le 6th juin 2009 leucos 66 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 :

    Raw signal from piezo (2)

    Raw signal from piezo

    In this capture, the signal first drops to -20V, and then flies up to over 35V. Almost 60Vpp here too.

    Raw signal from piezo

    Raw signal from piezo (bis)

    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 :

    Piezo signal close up

    Piezo signal close up

    So signal conditioning is a must with those pesky animals if you’re doing digital.

    Let’s recap what has to be done :

    1. make that signal all positive :  most of the time, piezos signals are read by ADC, so we want positive voltages
    2. restrict signal bounds to 0 – VCC so voltage doesn’t climb to scary values (scary at least for microcontrollers and ADCs),
    3. 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 :

    1. add a half-wave rectifier, in order to keep positive part of the waves
    2. add a zener diode, so signal doesn’t climb over zener’s breakdown voltage
    3. 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.

    Piezo signal as seen after a full-wave rectifier

    Piezo signal as seen after a full-wave rectifier

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

    Piezo signal rectified by only one Schottky diode

    Piezo signal rectified by only one Schottky diode

    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.

    Piezo signal rectified by two Schottky

    Piezo signal rectified by two Schottky

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

    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.

    Piezo signal, after Schottky rectifiers and Zener

    Piezo signal, after Schottky rectifiers and Zener

    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 Error: http://leucos.lstilde.org/wp/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details, 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 aError: http://leucos.lstilde.org/wp/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details capacitor.

    So we end up with this simple little circuit :PiezoFinalCircuit

    And get this nice little shape :

    Finaly, a clean, ADC friendly signal

    Finaly, a clean, ADC friendly signal

    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.

     

    62 réponses à “Piezo transducer signal conditioning” Icône RSS

    • @jbvidigal:

      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.

      best, kuk

      ps: Could you proof check the circuit diagram? i believe the second (reversed) schottky should go from Gnd straight to Piezo-Conn-2.

    • deepak narkhede

      dear sir,
      I m trying to make Dynamic Balancing machine using piezoelectric sensors.
      When I put calibration rotor with 50gm unbalance, I expect to have sine wave with corrosponding frequency for 500 rpm. But on CRO the picture is very disappointing. The further processing is out of quition.
      kindly help.

      deepak narkhede

      English please

    • Hi Leucos!

      Could you please update the circuit design with the working specs?

      Thank you very much!

      Phoc

    • Hi Kuk
      I built the circuit replacing the Schotkys with two 1n4148, but I cannot get a constant reading from the piezos…it reads the first four or five strikes, but then the signal reacts in strange ways, sometimes reads the hit, sometimes I dont have any signal
      Could you please help me to solve that?
      Thanks!

    • Hi! Do you know if they make any plugins to assist with SEO?

      I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
      very good results. If you know of any please share.
      Cheers!

      My homepage … mas

    • This design is spectacular! You most certainly know how to keep a reader amused.
      Between your wit and your videos, I was almost moved to
      start my own blog (well, almost…HaHa!) Wonderful job.
      I really loved what you had to say, and more than that, how you presented it.

      Too cool!

      My web site Bio Melt Diet

    • There’s definately a great deal to learn about this subject.

      I like all the points you have made.

    • I was curious if you ever thought of changing the page layout of your blog?
      Its very well written; I love what youve got to say.
      But maybe you could a little more in the way of content so people could
      connect with it better. Youve got an awful lot of text for only
      having one or 2 pictures. Maybe you could space it out better?

    • You actually make it seem so easy with your presentation but I find this topic
      to be really something that I think I would never understand.

      It seems too complex and very broad for me. I am looking forward for your next post,
      I’ll try to get the hang of it!

      Feel free to surf to my blog – pawn shops las vegas 89147


    4 Trackbacks / Pingbacks

    Laisser une réponse

    Security Code: