I have a 16F688 that is measuring voltage from a battery (and battery charger from a forklift battery) that closes a relay when it reaches a voltage. Everything works OK (there are some additional functions) but there is way too much noise on the input to the PIC pin from the battery charger.

The input comes into the PIC through a voltage divider, .1uf cap and a half-wave rectifier. I've tried many things but I cannot solve this problem. The AC ripple on the DC is about 5VAC and I have little experience with solving AC ripple problems. The chargers are old and giving me huge headaches!!!

What else can I do to solve this problem?