Author Topic: Problems rectifying input signal to a Microcontroller (for 'note on')  (Read 2253 times)

jonny

Alright I'm designing an effect and I need the micro to know when someone plays a note. So I thought It'd be simple right. Rectify the input and use A/D to read when a note it played. So this is what I came up with.



(from the Output, the top of the cap C5.)

But in reality what I get is something like that - but it's very frequency dependent. For any frequency above about 100Hz it gets attenuated a lot (like below 100mV for 1kHz!) but when I sim it in spice with those cap/res values it works perfectly in the range 80-5kHz?? Also what's odd is if I remove the discharge resistor (R13) I get 0V on the output, shouldn't I get ~4V as that cap can't discharge.. I've double and triple checked everything.. tried a million different cap/res values. Looked on a scope it looks good until after D1. Everthing is connected as it should be, there just must be some theory I'm not quite understanding?? Any ideas would be appreciated!
« Last Edit: April 20, 2012, 08:14:12 PM by jonny »

Seljer

Re: Problems rectifying input signal to a Microcontroller (for 'note on')
« Reply #1 on: April 21, 2012, 06:37:06 AM »
Look at the datasheet for your uC, often the A/D converters have a relatively low input impedance, like only a couple of kiloohms. You may need to put a buffer after that capacitor before it goes to your microcontroller.

Also, if your microcontroller has a analog comparator input that may work better in this application.

jonny

Re: Problems rectifying input signal to a Microcontroller (for 'note on')
« Reply #2 on: April 21, 2012, 08:04:24 AM »
Look at the datasheet for your uC, often the A/D converters have a relatively low input impedance, like only a couple of kiloohms. You may need to put a buffer after that capacitor before it goes to your microcontroller.

Also, if your microcontroller has a analog comparator input that may work better in this application.

I thought that could be the case too, but with the micro removed it's still the same. It's really odd. Something strange is going on.. I might try a buffer but it's a big pain to do.. as it's on a PCB. It works as is but it's frequency response is bad, it will detect low frequencies okay but not so much the higher notes.