PIEZO driving from microcontroller pins... - Page 1
Forum section: electronics / beginners

author: alank2
author_rank: Super Contributor
timestamp: April 18, 2017, 05:39:51 pm
content: I've had a project where I had two pins connected to the piezo. If I left one at ground or vcc and cycled the other, I could make a frequency. If I cycle them both out of phase to each other, I can get the same frequency with more volume. Here is my question - does it matter what the resting state is of these 2 pins? It is the transitions that consume current, correct? If one pin is low and one is high, it doesn't seem to be using any current. Is that better or worse or the same than two pins low?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 18, 2017, 06:42:27 pm
content: Idle state doesn't matter. No need to use TVS as pin clamping diodes will do the job.

author: Ian.M
author_rank: Super Contributor
timestamp: April 18, 2017, 06:48:22 pm
content: Quote from: mikeselectricstuff on April 18, 2017, 06:42:27 pmHowever *DON'T* immediately set the pins as inputs when idle at the end of a tone-burst. If you set them both to outputs at the same level, the transducer will be heavily damped by the Rds_on of the output drivers and the clamping diodes wont conduct. After the mechanical vibration has died away you can then reset them as inputs if you really need to.

author: langwadt
author_rank: Super Contributor
timestamp: April 18, 2017, 06:59:49 pm
content: Quote from: mikeselectricstuff on April 18, 2017, 06:42:27 pmI'd say both pin high or both pins low might be slightly better, because it will short any voltage generated by the piezorather than pushing current into the supply possibly raising the voltage

author: alank2
author_rank: Super Contributor
timestamp: April 18, 2017, 07:06:58 pm
content: Thanks everyone, I was gonig to just use (H,L) as idle state, but it sounds like (L,L) is probably more ideal. They will be configured as outputs only and stay outputs. I'm using an AVR timer/ocr to generate the frequency.

author: Zero999
author_rank: Super Contributor
timestamp: April 18, 2017, 07:58:51 pm
content: Quote from: alank2 on April 18, 2017, 07:06:58 pmGood idea. The H,L state would apply a DC voltage to the piezo element for a long period of time which is not recommended, especially in a humid environment.Quotehttp://www.murata.com/~/media/webrenewal/support/library/catalog/products/sound/p37e.ashx

author: alank2
author_rank: Super Contributor
timestamp: April 18, 2017, 08:06:31 pm
content: What do you guys think about the resistor in series idea - worth doing or unnecessary?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 18, 2017, 08:56:07 pm
content: Quote from: alank2 on April 18, 2017, 08:06:31 pmNot necessary unless you are concerned about noise while beeping - e.g. doing analogue stuff. When you switch the outputs, there will be a current spike as it charges & discharges the capacitance of the piezo, which could couple somewhere, but only likely to be an issue for sensitive analogue stuff. Adding some resistance probably won't make a huge difference to sound output.

author: alank2
author_rank: Super Contributor
timestamp: April 20, 2017, 03:50:37 pm
content: Thanks Mike - I got the timer instructions all worked out so it is (low, low) at idle, and it will transition from idle into sound and from sound back to idle smoothly. I can also leave one bit unset to drive only one line for less volume.