0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« on: March 06, 2012, 07:16:02 pm » |
I am trying to measure AC voltage using arduino and a 3-0-3 step down transformer. After rectification , I am giving the input to ADC channel. and measuring by multiplying by a factor (230/1023), But the output I am getting is around 130v I think there is a mistake in the multiplication factor . Please help me
|
|
|
|
|
Logged
|
|
|
|
|
Montreal
Offline
Edison Member
Karma: 16
Posts: 2209
Per aspera ad astra.
|
 |
« Reply #1 on: March 06, 2012, 07:42:28 pm » |
What is input voltage to transformer? What is output voltage from transformer? Measuring voltage after a rectifier would create an error, proportional to current drown by load. You better to measure AC.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #2 on: March 06, 2012, 08:10:37 pm » |
Ac voltages are normally expressed as RMS equivalent volts unless otherwise specified. The conversation factor you will have to use in your program depends on the type of rectifier/filter you use, half wave, full wave bridge, full wave with center tapped transformer, etc. Basically the rectifier/filter will charge is some AC peak voltage value and the RMS factor will be some percentage of that value, .707 times that value is one classic value ratio.
So draw up your total wiring set-up and post your code and I'm pretty sure we can guide you to the proper conversion factor to use.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #3 on: March 06, 2012, 08:13:25 pm » |
What is input voltage to transformer? What is output voltage from transformer? Measuring voltage after a rectifier would create an error, proportional to current drown by load. You better to measure AC.
If the purpose is to just measure the normal equivalent AC primary line voltage and the only load is the arduino analog input pin then it can be done that way without significant error.
|
|
|
|
|
Logged
|
|
|
|
|
Montreal
Offline
Edison Member
Karma: 16
Posts: 2209
Per aspera ad astra.
|
 |
« Reply #4 on: March 06, 2012, 08:24:17 pm » |
If the purpose is to just measure the normal equivalent AC primary line voltage and the only load is the arduino analog input pin then it can be done that way without significant error. There would be voltage drop on bridge, even w/o load p-n junction drop is temperature dependent. The question how accurate measurements OP needs, and if lag-off is acceptable.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #5 on: March 06, 2012, 08:27:16 pm » |
If the purpose is to just measure the normal equivalent AC primary line voltage and the only load is the arduino analog input pin then it can be done that way without significant error. There would be voltage drop on bridge, even w/o load p-n junction drop is temperature dependent. The question how accurate measurements OP needs, and if lag-off is acceptable. Yes, but if the purpose is to just measure the nominal AC line voltage, then the diode loss can be just part of the conversion factor used, as the voltage drop is fairly constant and not changing with normal AC line voltage variation.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 9
Posts: 771
|
 |
« Reply #6 on: March 06, 2012, 08:34:07 pm » |
...and a 3-0-3 step down transformer. Sorry, I don't know what that is... What's the output-voltage rating or the step-down ratio? Do you have a multimeter to measure the actual secondary voltage? Most transformers put-out their rated voltage at full load. A "12V 1A" transformer might actually put-out 12V when loaded to 1 Amp, but 18V with no load (or with a light load). 230VAC is the RMS voltage. You can look-up the math if you wish, but RMS is sort-of an average*. The peak value of a sine wave is about 1.4 times the RMS value (~plus and minus 320V peak). And of course, the minimum is zero. So with a rectifier, you should be getting "random" readings between zero and 320V (assuming everything is calibrated). Or, if you put a capacitor on the rectifier output to hold the peak, you should read 320V. ...measuring by multiplying by a factor (230/1023) You should give yourself some "breathing room"... If 230V gives you 1023, then 250V is also going to give you 1023. * RMS is related to power, and you get the same power with 230VAC as you get with 230VDC. If you hook-up 230VDC to a light bulb, it will glow with the same brightness as with 230VAC.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #7 on: March 06, 2012, 09:11:27 pm » |
Thanks for the support and sorry for forgetting to give the details I am using a 3-0-3 ,500 ma transformer with full wave rectifier. What I need is to measure the AC line voltage( Accuracy not so). Input is 230v/50Hz domestic line voltage.After the rectification I am using a10uF capacitor for filtering . About 230/1023. I think its a mistake. Since ADC is 10 bit , output voltage will be (analogout*(5/1024)). I am trying to change this. I tried with a load resistance 10K, but readings drops to 160v void setup() { Serial.begin(9600); } void loop() { int x,volt,y; x=analogRead(4); volt=x*(230/1023); Serial.println(x); delay(500); Serial.println(volt); delay(500); }
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #8 on: March 06, 2012, 09:20:58 pm » |
About 230/1023. If you know the the factor, then you are probably better off using the map(value, fromLow, fromHigh, toLow, toHigh) function to scale your reading, it will make your life easier. So read in the analog value as X Y= map(X, 0, 1023, 0, 230); //Adjust the 230 value based on real world comparison to actual measured // line voltage until they agree. Print the Y value. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #9 on: March 06, 2012, 09:25:28 pm » |
I tried the map function , but value was very high. Also, there is a chance of change in limit, as the voltage may fluctuate between 200-230. So I cant use that function
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #10 on: March 06, 2012, 09:30:31 pm » |
I tried the map function , but value was very high. Also, there is a chance of change in limit, as the voltage may fluctuate between 200-230. So I cant use that function
The map function will track the changing input value and calculate the proper value every time you call it with a new value of X. You may have to adjust the 230 value if the conversion is too high, as I showed in the comment. Map is the proper tool to use and if not working for you then there is something else wrong going on. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Montreal
Offline
Edison Member
Karma: 16
Posts: 2209
Per aspera ad astra.
|
 |
« Reply #11 on: March 06, 2012, 09:39:06 pm » |
O'k, if I understand it right , your transformer is 230 / 3 - 0 - 3 But where is your bridge connected, to 3 - 0 pins or 3 - 3? If to 3 - 3 , than after rectifier should be around 6 V x sqrt ( 2 ) - 1.4 = 7.2 V, what is too mach for arduino input . For 3 - 0 pins, 3 V x sqrt(2) - 1.4 = 2.8 V should be fine. Formula to calculate AC = (( x * 5.0 / 1024 ) + 1.4 ) * ( 230.0 / 3.0 ) / 1.414) ;
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #12 on: March 06, 2012, 09:54:19 pm » |
O'k, if I understand it right , your transformer is 230 / 3 - 0 - 3 But where is your bridge connected, to 3 - 0 pins or 3 - 3? If to 3 - 3 , than after rectifier should be around 6 V x sqrt ( 2 ) - 1.4 = 7.2 V, what is too mach for arduino input . For 3 - 0 pins, 3 V x sqrt(2) - 1.4 = 2.8 V should be fine. Formula to calculate AC = (( x * 5.0 / 1024 ) + 1.4 ) * ( 230.0 / 3.0 ) / 1.414) ;
I'm sure your math is correct, and the algorithm makes sense, but why bother with all the complexity and floating point? As long as the rectified/filtered DC voltage is less the +5vdc for the highest possible line voltage, why not use the much simpler map() function Y=map(x,0,1023,0,240) where 240 value is tweaked until Y indeed measures what a measurement of the line voltage actually is. The relationship is a straight linear one and the map function does that just fine using simple integer math. Lefty
|
|
|
|
« Last Edit: March 06, 2012, 09:56:58 pm by retrolefty »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #13 on: March 06, 2012, 10:03:23 pm » |
I am attaching my circuit here. I will try your calculations and reply you soon
|
|
|
|
|
Logged
|
|
|
|
|
Montreal
Offline
Edison Member
Karma: 16
Posts: 2209
Per aspera ad astra.
|
 |
« Reply #14 on: March 06, 2012, 10:05:25 pm » |
The relationship is a straight linear one and the map function does that just fine using simple integer math. You are right, map would be easier, but at least bridges 1.4V (drop voltage) has to be included in map, otherwise error with 3 V transformer almost 30 %. Y= map(X, 0, 1023, OFF-SET, 230); //Adjust the 230 value based on real world comparison to actual measured Off- set could-be pre-calculated, approximately 230 x 1.4 / ( 3 * 1.414 )= 76 V, not very accurate , with 0.6 V per diode it's 65 V Corrected: just noticed a drawings, there is only one diode, off-set about 230 x 0.7 / 3 x 1.414 = 38 V
|
|
|
|
« Last Edit: March 06, 2012, 10:27:45 pm by Magician »
|
Logged
|
|
|
|
|
|