Sunday, December 5, 2010

Mains Monitor

Mains Monitor or Manager is the circuit; i used to measure or check the ac voltage and frequency. Its accuracy is about 90-97% and quite handy for hobbyist. The ac voltage limit is 500v ac and 99Hz for frequency. There are two different ideas combine, to achieve this goal. 

First to measure the ac voltage; analog to digital conversion is used. But a secret lies in measuring the voltage that is; set the ac voltage to 500v ac, then with the help of pot VR2 adjust the 5v ac across the capacitor C2. Because the maximum input for ADC is 5, that is why we have to do this. For this we will get 1023 at the end of ADC conversion, as 10-bit ADC is used. To convert this into the actual value we have to do some math; divide the ADC result with 2.046 to get the desired value (as 1023/500=2.046). You can also use a 5.1v zener across C2 for protection purpose. Also do not forget to use 3mA or appropriate fuse with the main ti prevent excess current. D1 is used for half wave rectification and R1 to limit the voltage.      

Now the second part; frequency measurement. It is quite simple timer0 is used for this; just delay 1 second and read the value from timer0 register. To calculate the frequency first you have to step down the ac voltage with the help of transformer (secondary voltage should be 9v or 12v). This voltage is applied to the base of the transistor Q1. Q1 acts like a switch and generate the pulses, these pulses are applied at RA4 that count these pulses. In other words Q1 is used to convert the sinusoidal wave into square wave. So, this is the way i use to measure the ac frequency.   

You can modify the code, use this project as a protector and connect your ac devices. Port C is free for this purpose. If you have any question or problem please let me know. 

Downloads:Code and Schematic
Mains Monitor
Components Required:
IC1,        PIC16F876
R1,         150K ohm
R2,         10K ohm
R3,R11,   4.7K ohm
RV2,       10K ohm
D2,         1N4007
C2,         33uF/16v electrolyte
Q1,         BC547
Misc,       12v 100mA transformer (see text)
              16x2 LCD

              Fuse (see text)

No comments:

Post a Comment