I am doing a project that reads frequency of audio signals generated from Android device through the headset jack. The audio jack is connected to Atmega microcontroller as shown in the figure.!
I am using the analog comparator to compare between a reference voltage 2.61v and the audio signal (DC biased; AC + 2.5v). The audio signal range is 200mv p-p so after DC biasing it will be from 2.3 to 2.7. When the comparator input 1 passes 2.61 (reference volt), a timer starts to measure the frequency. But the problem is I am not getting a stable reading of frequency. For example, if the signal is 1000Hz, I read it between 4000 and 5000 Hz. The values always change. Sometimes the comparator outputs one for few microseconds even there is no audio signal (the output should be zero).!!
I think the problem is one of these:
- The power supply has a high ripple so I cannot read low-level signals properly.
- I should use a higher blocking capacitor C2 like 10uF instead of 100nF.
- The 200 mv is in the range of noise signals, I should amplify it before read.
- The voltage divider should use high values of resistors like 3MOhm as in the Hijack project below.
What do you think.
This is similar to the hijack project proposed by UMICH. Their schematic is shown below.