Piezo buzzer as Microphone?

Hi, I am new to “Built-from-scratch” robots and the way they are coded, but I am learning! I thought a good test for programming would be a robot that changed direction and speed depending on somebody clapping a certain number of times, with different intervals between each clap. So I was wondering if it was possible to use the buzzer built into the 3pi as a microphone. I know that the Piezo buzzers can be used like that, but I don’t know if the PWM output it’s on can be configured as a analog input. If it is possible, could somebody tell me how? If not, then is there a simple way to use a microphone component, such as the one on this board with the 3pi?

I’m using AVR Studio 4 and Pololu AVR Programmer, with, of course, the 3pi(ATMega 328p version).

EDIT: I forgot to mention that I have YEARS of experience with LEGO MindStorms.

Hi,

The 3pi’s simplified schematic says the buzzer is on PB2, and the pin assignment table says PB2 is a digital pin. This means it can’t be configured as an analog input, but it can be configured as a digital input.

You can use that microphone breakout with the 3pi. You would connect GND and VCC to the corresponding pads on the 3pi and the AUD line to one of the “free” analog inputs (also listed in the pin assignment table). Each of the “free” analog inputs requires giving up some feature. I recommend giving up the user trimpot (ADC7) first.

- Ryan

Ok, Thanks. I have looked at the schematics before, but really didn’t understand much. I looked at the schematic for the breakout, and it looks to me to basically be a Microphone, and a OpAmp, right? If so, then couldn’t I make my own using a microphone part and something like this? I’d really like it to be as “DIY” as possible, so that I get the most out of it(And I just spent all my allowance before I thought of this. I can get the TI chip as a free sample, and already have a microphone).

Turns out that I think I can recreate your board with parts I already have and the opa344 chip, which I can get a free sample of, from TI! I didn’t see that they had the same one before, so just disregard the previous post. I just have one question: Will using through hole components instead of SMD affect the functionality?

I doubt it will affect it much; it will be bigger of course. By the way, that is not our board. SparkFun makes it.

- Ryan

By “your board” I just meant that you had it in your shop. Thanks again! I’ll post it in the “projects” section when it’s completed.