Selecting right capacitor filter values, while measuring ac mains

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1. I am measuring ac mains directly though microcontroller. Microcontroller is power by isolation. So what I did, I put a divider of 330K & 2.2K between line & neutral. 
Shorted neutral to microcontroller ground.
Ac to measure is 220vac/50hz, mains vary from 170Vac to 300vac & freq could be 50 or 60hz from mains supply.

 

2. On this divider I was thinking of placing a capacitor for filtering also, for noises. How to calculate value of this capacitor:
a) make a low pass filter, block freq above 60Hz
b) make a band pass filter, pass only 50/60Hz component only
c) make a software based filter 

 

3. With a divider of 330K & 2.2K, MCU will see a equivalent thevenin by 2.2K parallel to 330K i.e 2.18K
If I look at this:  http://www.electronics-tutorials...

 

What fc should I select, but keeping in error margins of all resistors & capacitors?
or should I select 60Hz ?

 

If I select 60Hz, then fc = 1/2*pi*R*C
C = 1.21uF, nearest I have is 1uF.
With 1uF fc will be: 72Hz

Are these calculations correct?

 

4. Similarly for band pass, values can be found.  http://www.electronics-tutorials...

 

5. Or should I use software filter? I am sampling using:
a) Sample every 500us after for 50 readings i.e 25ms. Find the highest point, this is peak.
b) find 25 peaks like this & store it in array.
c) sort this array, reject lowest 5 & highest 5. Take avarge of mid 15 values
d) this is peak, divide by root2, to get rms.

 

What cut off freq should be selected keeping in mind all variation of resistors & caps assuming 1% resistors & X7R caps.

 

6. Currently I am able to measure values which are near to its calibrated values. 2 point calibration is done.
Just curious to know how to calculate these values.

Last Edited: Sat. Aug 19, 2017 - 07:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should choose 180Hz for the filter. If you choose 60Hz, there will be 3db of attenuation at that frequency. You do not attenuate 60Hz significantly only if the filter frequency is 3X the signal frequency or higher. Most of the noise will be higher than 180Hz so that should work fine.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Vindhyachal Takniki wrote:
Shorted neutral to microcontroller ground.

 

And when line goes negative relative to neutral? Maybe a diode is needed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what do you want to measure?
peak to peak?
Average?
RMS?
zero shift?
frequency?

I think you are at risk of electric shock!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microcontroller is power by isolation

However, your resistor connections to the lines mean the isolation is no longer in effect--your circuit is "hot", so at least beware & be aware & be wary.  In other words, be extra careful to isolate any user controls (like double insulated)

 

Note if using the ADC  bandgap reference it's like +/-10% accuracy, which can be fixed by your cal/scaling factor.

 

this is peak, divide by root2, to get rms.   --of course that assumes perfect sinewave shape...with all the processing power at your disposal, why not square, sum for x cycles, and take square root, for better accuracy?

 

A full bridge ahead of dividers will get rid of negative inputs, if you have them.  Any diode drop gets divided by your divider.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

a few resources for sqr roots:

 

ENIAC's very simple method...(multiply your number by 256, apply this, then divide answer by 16 for extra precision)  http://www4.wittenberg.edu/academics/mathcomp/bjsdir/ENIACSquareRoot.htm

 

interesting RMS method

http://www.eletrica.ufpr.br/edu/artigos/CIL22-012_final_gerson.pdf

 

 

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0