I need to measure 2 220vp/50Hz AC voltages (in an ATS project). I chosen PIC16F877A as the MCU.
my problem is to measure the 220vAC signal. I made a circuit to convert voltages as follows:
+230v -> 5v
0v -> 2.5v
-230v -> 0v
but now how can I feed it to the MCU the proper way?
I can get the ADC but I need to measure the voltage so that if it get less than a certain value (say 200v on both +and-), the MCU will switch to the other supply... and so on.
I'm confused of the -ve half cycle! if it's just DC voltage I would have done it properly.
I hope you help me with the code too.
Here is my measuring circuit (does it need zener?):
I found an idea to make a voltage divider outputs 220v as 2.5vmax and it will have -2.5v too... now using op-amp or any thing, a +2.5v will be added to make it 0-5v.
^ can anyone help me with that?
If that's done, I still need to measure the RMS voltage to know if the source is at a good level or what...
how about my previous post? adding +2.5v to the 2.5vp AC signal to be 0-5v into ADC pin... can anyone give me a circuit that adds this DC voltage to AC voltage?
RMS, if you're talking about mains voltage. Peak is over 300V. If you allow for +-350V, that should cater for any normal mains. Best to have some sort of clamp/limiter at the PIC input anyway in case there's spikes in the KV range.
Pic mcu has an inbuilt adc that can be used as a voltmeter! I advise you use that POC for your work! If u are still having diffculties, let me know the language you program pic with, so I can try develop a code 4 u! But you should try it yourself with the aid of datasheet. Its pretty simple
Pic mcu has an inbuilt adc that can be used as a voltmeter! I advise you use that POC for your work! If u are still having diffculties, let me know the language you program pic with, so I can try develop a code 4 u! But you should try it yourself with the aid of datasheet. Its pretty simple
I have an idea of converting this 350vp AC to 2.5vp AC. now it has a -2.5vp (and negative cycle) which PIC ADC can't measure... so I made the voltage divider circuit shown above (modified than the above one, but the same schematics... 2k is now 1k ohm and +5v VCC is now +2.5v).
That circuit above adds +2.5v to the 2.5vp AC signal to get rid of the negative cycle so that -2.5v now equals 0v....
so, it is like this:
+350vp = +5v
0v = 2.5v
-350vp = 0v
^ this signal can be easily transferred to PIC ADC and it can read it easily right?
now my problem is how to calculate the RMS value of it. Can u help in it? If you have then post the code here with Proteus ISIS simulation file (for testing it)... Thank you.
RMS, if you're talking about mains voltage. Peak is over 300V. If you allow for +-350V, that should cater for any normal mains. Best to have some sort of clamp/limiter at the PIC input anyway in case there's spikes in the KV range.
Hmm.. for protection I read that adding a 5.1v Zener Diode just before the ADC pin is a great thing to protect the PIC MCU. like this image from a blog here: