> From: Joe Jansen/TECH/HQ/KEMET/US[SMTP:JoeJansen@KEMET.COM] > Sent: Tuesday, March 30, 2004 11:27 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [EE]: Analog peak capture > Hey everyone! . . . . > My question is: How do I insure that I am running my A/D conversion on > the highest point of the piezo elements output? the spike that is > generated will be proportional to the strength of the impact, but I want > to make sure that I run my conversion on the highest point of the output. > Is there a way to capture the peak output and then run the A/D conversion > on that? Any other suggestions? I definitely want the velocity info to > control the volume of the playback, or the whole thing becomes a gimmick. > Thanks for any suggestions!!!!! > --Joe Jansen A simple peak detector can be made from a diode and a capacitor.The signal is applied to the anode of the diode. The cathode (banded end) of the diode goes to one end of the capacitor and to the A/D input. The other end of the capacitor goes to ground. The capacitor will charge to the highest value of the input; when the input falls below the capcitor voltage, the diode turns off preventing the capacitor from discharging. After digitizing the voltage, you can discharge the capacitor by setting the PIC port pin to digital output and taking it to zero. The following ideas will be useful: Remember that the capacitor voltage will be one diode drop below the peak input voltage. To protect the port pin during discharge, put a series resistor between the top of the capacitor and the pin. Keep the resistance low enough to satisfy the maximum source inpedance allowed by the A/D (typically 10k). The larger the capacitor, the more current it will need in order to charge up in a short time. The driving amplifier must be able to provide this current. For more precise work, there are op amp circuits available which put the capacitor inside of a feedback loop. Some of the other replies to your post undoubtably will refer you to these. John Power -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu