
Originally Posted by
Melanie
Oh Guys, stop struggling....
10K between the PIC pin and 0v. Your 500K between the pic in and +5v. Use an ADC pin. If your device is subject to noise pick-up, then put a 100nF across the 10K. That's it.
Calibration. Take an ADC reading with a Resistor at 500k. This is your minimum 'threshold'. Take another ADC reading with a Resistor at say 450k. This is your max threshold.
You now have two values... at which point you decide to signal your 'event' condition between thos two points is up to you. You may have to use 10-bit ADC as the values will be pretty tight and 8-bit won't give you much leeway.
Bookmarks