Piezo element as input and output?

Status
Not open for further replies.

HarveyH42

Banned
Was kind of playing with a hopefully simple idea in my head earlier today, and was kind of wondering if it's do-able. Kind of need some direction.

I won't to use a piezo speaker to detect sound or vibration, to be read into a microcontroller. Then I want to output an audio signal through the same speaker. Don't know a whole lot about the timers, or ADC. I don't think the piezo will produce a strong enough signal to be seen on an input pin, so figure ADC. I don't need any kind of accuracy, just something above normal background noise.

For the sound output, it would be much louder if I can sort of push-pull the speaker across to I/O pins. So wondering if I can hook the speaker across to pins, and get an input for the ADC?

Planning on using a ATtiny13, it's 8 pin, but only 5 usable I/O pins. So hope to have the other three for other uses.
 
There is nothing wrong with the idea of using a Piezo element as an output and an input. That is what happens inside crystal ocillators.

If you do run it push/pull, make sure that that when you are reading one end, the other end is not left floating.
 
I was thinking that you should not tristate the end of the crystals that is not being meaured.
 
So when inputing from the piezo speaker, one pin should be set for input in the DDR, the other should be left as output. Should the output pin be set to 1 or 0, when I'm using the ADC input?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…