Maker Pro
Maker Pro

using the comparator on a pic

jimtr6

Jun 16, 2010
5
Joined
Jun 16, 2010
Messages
5
I have an application where I want to detect audio on a pin, presently I'm using op amps and a opto isolator then using a diode I'm amplifying and converting the small audio signal into a high anf putting it on an input pin and jumping to a set of instructions, it works ok but is there a way where I can eliminate this circuitry and send the analog/audio into a comparator and test it there. It is not really ADC as I only want to compare the voltage amplitude, not convert it. Even if I need to rectify it and get it to a DC voltage is ok, just so I can simplify it. On this eight pin 12F629 there is a comparator, I'm new to this so I have trouble interpretting the data sheet explanations, I understand I would have to configurate a register to allow an analog voltage on a pin, has anyone done this and can you give me some understandable info....thanks, much
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I think I would use an AC coupled amplifier with the output charging a capacitor via a diode, and having some resistor to discharge it fairly quickly. Measure the voltage across the capacitor using the uC. For added speed, use the capacitor voltage as an input to a schmitt trigger (or measure the logic level using a schmitt trigger input).

I don't think it's a lot less complex though.

The question I have is: If your current circuit works, why change it?
 

blocka

Jul 7, 2010
18
Joined
Jul 7, 2010
Messages
18
the problem with going through a diode your voltage has to exceed the diode voltage and an audio signal wont necessarily do it.

I dont know how accurate you want it or what your application is, but i would do it either with the adc or comparator.
For the ADC i would set a threshold level and for it to stay on would have to have this threshold exceeded at least once a second for example.
The comparator would work the same way except you would need to set you reference level with a resistor divider instead of a software reference using the adc pin.
 
Top