# Using an mbed and piezo disc to determine frequency

I am attempting to determine the frequency of an instrument from its vibration using a piezo disc and an mbed LCP1768.

I attempted this with a raspberry pi but couldn't get the sample frequency high enough to get accurate readings. I've now moved onto using an mbed which gives much higher conversion rates using less parts.

The piezo is stuck to my guitar using blue-tac and I play an E note (82Hz).

The schematic shows the set up I have. The code that runs just reads the input every millisecond and writes the values to a text file. Then I get the text file and put the values into excel and generate a graph.

simulate this circuit – Schematic created using CircuitLab

I would expect to see a very flat line where the DC offset is, before the guitar is played then a wave like format for the rest centered around the offset but I get a fluctuating offset to start with with values ranging from 1.52 and 1.48, which then jumps up to 1.65 between the first 163-358 samples and then back down again. Can anyone explain how I can reduce the noise of the DC offset to get a more accurate signal?

Thank you.

• I really don't like how you're generating a DC offset here. – Scott Seidman Dec 2 '15 at 17:09
• I did try and put the offset into the op amp but the fluctuation was greatly magnified. How would I generate 1.65V in a different way? – JamesDonnelly Dec 2 '15 at 17:13
• Try using an additional op amp. You are currently SHORTING your DC offset to the output of your op amp. That just won't work. – Scott Seidman Dec 2 '15 at 17:21
• Also, your voltage follower can't go negative unless you provide a negative power supply to the op amp. Start over. Search for "guitar tuner circuit" and move on from there. – Scott Seidman Dec 2 '15 at 17:25
• I intend to try Spehro's response. (I've been at work) but will something like this suitable? Swapping the guitar for the piezo of course. courses.cit.cornell.edu/ee476/FinalProjects/s2004/ddb25/… – JamesDonnelly Dec 2 '15 at 22:35