I want to use a piezo buzzer alternatively as a sound detector and as a sound emitter, on the same circuit (be gentle, this is my first attempt to electronics since the university long years ago).
I want the piezo to monitor the ambiant sound level, then emit sound for a while when the sound level is above a given threshold (typically, play music when baby cries during the night). I'll use an Arduino for the processing part.
For the sound detector part, I plan to reproduce NerdKits' tutorial. I hear the sound emitter part is much more simple as far as electronics is concerned (just plug the buzzer between input and ground, is that it ?), and I don't fear the programming part.
Now what bothers me is how to switch between the receiver/emitter setups. I understand I'm looking for a kind of transistor-based SPDT. Is a push-pull setup the way to go, or am I on the wrong track ?
NB : Yes, I could just use a second piezo buzzer or whatever, but I find it somehow more satisfying to use the same device both for input and output, provided it's doable.