Hi kenjj thanks for your valuable idea.
1.Yes I have ADC input.
2.After the bridge rectifier (input to the VREG) I set DC range in DMM.(230AC,10.1DC)
3.I cant come up with it because I have to concern about ADC input impedance also
4.No need software I can write it. The hardware is my main problem.
This is the circuit I'm having now.What changes do I have to do?
Note that input to the VREG voltage is smoothed the earlier guy told that there is a problem with that smoother cap.
Morning Suraj,
The Vref is the internal Vdd =+5V.
Go over the calculations:
You want to to measure/detect a change of 10Vac on the mains input.
The transformer has a 9Vac secondary, so thats a step down of 25:1,
so the change of volts on the secondary for a 10V change on the primary is 10V/25 = 0.4Vac.
If you rectify and smooth the 9Vac you will get approx 1.4*9 = 12.6Vdc less the diode drop, say 12Vdc.
This 12Vdc is connected via a voltage divider to the PIC's adc input, say down to 4Vdc.
Thats a further division of 3:1, so for a 0.4Vac change is now 0.4/3 = 130mVolts. [referred as an ac signal].
My concern is is that if you use the same voltage source to power the PIC and LED's etc,
everytime the load of the PIC etc is changed the voltage to the divider to the adc is going to change.
There isnt a great enough voltage margin, in my opinion.
I suppose the way to prove this, is to build and test it.
If it dosnt work reliabily, then just get second low voltage transformer/rectifier and use that as the sampled voltage.
EDIT: Suraj, saw this link while doing another thread, as you using the 12F, I thought it would be useful, one day.
12F675 tutorial 6: Driving a servo motor using a PIC Micro.