Author Topic: measuring 220V ac with MCU  (Read 4242 times)

0 Members and 1 Guest are viewing this topic.

Offline A2Topic starter

  • Contributor
  • Posts: 44
measuring 220V ac with MCU
« on: July 11, 2014, 11:15:12 am »
I want to measure 220V ac with MCU.

Instead of using step down transformer, I want to use voltage divider of 1M & 3.3K.

So that 0V-220Vac gets reduced to 0V-0.724Vac.



Since it will also include negative peaks & MCU cannot measure negative values unless I put some offset to it.

So I have added 2.5Vdc offset.



Now I know that this can be done by opamp as an adder. But since I have -ve going peaks in ac voltage, so do I need to add -ve supply rail to opamp or opamp can add both volatges without using negative rails as one of voltage is going negative.?







1. Do I need negative rails?

2. What should be right opamp for this application?

3. Any reference schematic or any application node explaining measurement of 220V will be helpful
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7369
  • Country: nl
  • Current job: ATEX product design
Re: measuring 220V ac with MCU
« Reply #1 on: July 11, 2014, 11:35:32 am »
I wouldn't connect 220V in any configuration to an MCU this way. It would be inherently unreliable, not to mention, not safe.
If you want to build a measurement system like that, use an ASIC made for that. That is characterised, tested, it has ready made solution, it works. Even if you dont listen to me, read the datasheets, it contains useful know-how information. You will find several solutions at analog devices, but TI, linear technology, and afaik, even microchip makes asic for this.
http://www.analog.com/en/analog-to-digital-converters/energy-measurement/products/index.html
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9931
  • Country: nz
Re: measuring 220V ac with MCU
« Reply #2 on: July 11, 2014, 12:32:58 pm »
Im not suggesting you should do the following...

And this is probably more complex than what you need, but, you can decouple the AC with a capacitor and read the entire positive/negative AC waveform directly with the ADC input and a few resistors.

ie,

ADC input with 5K resistor to VCC and another 5k resistor to GND  (so that the ADC sits at 2.5V assuming 5V VCC)

Then you could connect mains through a large resistor, say 330K, and then a 100nF capacitor connected onto the ADC input.
(Mains earth will of course need to connect to your GND to complete the circuit)

This will generate the AC waveform centered at 2.5V on the ADC input. The amplitude of the AC signal will depend on the resistors/cap used.

Then you can measure the waveform in software using the MCU and do stuff like calculate the peak volts as well as RMS. You can also sample/store the actual AC waveform.

A quick simulation seems to indicate 330K,  100nf and 2x 5K is about right for 220V AC to +/- 2.4V on ADC input. However you should understand what you're doing and why it works before trying it.

And just let me say again, this isn't a good idea from a safety standpoint.
« Last Edit: July 11, 2014, 12:45:41 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Circuitous

  • Supporter
  • ****
  • Posts: 237
  • Country: us
    • Corgi-Tronics
Re: measuring 220V ac with MCU
« Reply #3 on: July 11, 2014, 01:18:37 pm »
As suggested you can go with a dedicated energy monitoring chip like the CS5463 or CS5464, which will perform the RMS calculations and such for you. 
Or, a better fit for your situation might be an isolated AD converter like the ADE7913.  I tried out the ADE7913, and it seemed to work just fine, and it was easy to use.  I haven't really written up my findings and such, but I did review it here:



Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf