Skip to toolbar
Digital dice roller

Digital dice roller

Supported by (Turn Off)

Give it a whack

Tutoring 6
Skill 6
Idea 5
No Comments

What happens when we give a piezo a whack?

It generates voltage. Maybe only a tiny amount. Maybe quite a large amount. It depends how hard you whack it. Although the current may only be a few milliamps, the voltage can be in the tens of volts

Give it a whack

The voltage also goes positive and negative. And repeats, as the signal decays. Give a piezo a hard enough whack and a single hit can produce four, five, six or more detectable “peaks”.

Now microcontrollers (into which we’re planning on feeding such a signal) are sensitive little things (especially the AVR chips that make up the hobby-friendly Arduino development platform) and really don’t like too high a voltage being pushed into them, and they really, really don’t like negative voltages (PIC microcontrollers, with their “clamp diodes” on the i/o pins are far more robust, but we’re sticking with AVR to keep the project “hobbyist friendly”).

So we need to do two things to this signal – prevent any negative signal from reaching our microcontroller, and peaking the voltage at about 5v.

Give it a whack

This is a diode. It’s a component that only lets current flow in one direction. It allows current to flow from the anode (positive) to the cathode (negative) terminals, but blocks any negative voltage trying to flow back the other way (hence the little “barrier” mark on the symbol, to indicate that current will be blocked).

 

Give it a whack

Now the above is a very simplified analogy and while not strictly true for the pedants who might want to argue against it, it serves the purpose to demonstrate that positive voltage flows easily through a diode from anode to cathode, but negative voltage cannot.

Interestingly, it is possible for negative voltage to flow “backwards” through a diode (negative voltage on the cathode, marked -ve, can flow through the diode towards the anode, marked +ve).

We can make use of this property, and a special kind of diode to help us achieve our aims: with a zener diode.

Zener diodes are special in that they act like normal diodes up to a specific voltage. Over this voltage, they “break down” and allow the “excess voltage” to pass through.

 

Give it a whack

Zener diodes have specific values at which they “break down” so by placing a 5V zener diode as in the diagram above, we achieve two things:

If the piezo transducer is creating a negative voltage, this negative voltage is allowed to pass “backwards” through the diode, and will safely go to ground – it does not enter the microcontroller.

Secondly, if the piezo is creating a positive voltage (that we want to capture) any voltage above 5V will also pass through the diode, into ground. This means that the maximum voltage that will reach our microcontroller is positive, up to 5V (it can still be less than 5V).

 

Give it a whack

So this is how we wire the piezo to our Arduino input, ensuring that it is protected from over-voltage and negative voltage, generated by giving the transducer an almighty great whack (hey, who knows which klutz is going to be using these things?)

Leave a Reply

Supported by (Turn Off)