Go Down

### Topic: How to Sense Voltage ( AC Main Line ) using arduino ? (Read 10028 times)previous topic - next topic

#### Dileesha

##### Apr 17, 2013, 07:08 pmLast Edit: Apr 17, 2013, 07:15 pm by Dileesha Reason: 1
Hello Friends,

I need some help for voltage sensing with arduino .

My requirement ;

1. Measure AC voltage ( 230V 50Hz domestic supply ) using arduino analog pins

My idea ;

1. Use a transformer of 230V to 12V ( to step down for safety ) and send it through a simple bridge ( to rectify ) and get the vOut.
( may be i will get around 10.5V DC i think, due to voltage drop at bridge )

2. Then use a voltage divider circuit ( using resistors, and may be a cap for smoothing ), divide and get suitable voltage for arduino analog pin.
( i think arduino can handle upto 5V, so 10.5V to 5V divider circuit is good i think )

3. Next get the voltage input of 5V to the arduino analog pin, and make a coding in the IC to do some math with some constant value, and show the mains voltage proportional to the input voltage given to arduino pin.
( if mains voltage is 230VAC / then transformer LV side 12VAC/ after rectifying i get 10.5VDC / after divider circuit i get 5VDC / and it's given to arduino IC input pin )

My Problem ;

1. Is this possible ? is this dangerous for my self and arduino IC ? or anyother thing ?

2. How to make the correct divider circuit for this ? ( please draw me a sample )

3. If i use a divider for 10.5V to 5V, and give that 5V to arduino input pin ; what happens if the mains voltage goes over 230V, then probably the input for arduino pin may exceed 5V, so it will burn out ? what is the solution for this ?

* I have a 230V to 12V transformer this moment. So please help me to make this work without buying another tr.

Many Thanks.

#### Grumpy_Mike

#1
##### Apr 17, 2013, 09:25 pm
1) yes that is ok. The voltage you get will depend on the transformer and the load you put on it.
2) come on it is two resistors.
3) if the mains voltage goes up then so will your voltage. You must keep it below 5V so arrange things so that with normal mains voltage you only have 4V to give yourself some head room.

The only dangerous wiring is the primary to mains wires. Make sure they are well insulated.

#### Magician

#2
##### Apr 18, 2013, 12:11 am
There is an AC interface to arduino using transformer:
http://coolarduino.wordpress.com/2013/01/04/power-quality-meter/

#### Dileesha

#3
##### Apr 18, 2013, 07:31 pm
@ Grumpy
@ Magician

Thanks so much for both .

So I can use a simple voltage divider with 200kOhm resistor and 100kOhm resistor ( one side grounded ) i think . And across 100kOhm resistor I get about 3.5v if the transformer output LV side gives 12V AC ( and i assume i get about 10.5VDC after rectifying )  .

So 10.5V x ( 1/3 ) = 3.5VDC

Quote
So I can write the code to display 230VAC if the detected voltage is 3.5V at arduino analog input pins . Im I right sirs ?

Do I need to include any diodes to prevent damages to arduino ? or just only two resistors enough ?

And what if i use a smoothing capacitor inbetween the ground pin and the other side of the grounded resistor ( 100kOhm ) ?

And the other thing is lets say i arrange this voltage divider, and then i get the 3.5V to the analog input pin of the arduino . So I feel then the resistance of the circuit becomes parallel to the 100kOhm resistor I used . So the resistance becomes even smaller . So would  this be a problem ? or is it negligible ?

Thanks,
Dileesha.

#### Grumpy_Mike

#4
##### Apr 19, 2013, 10:30 am
Quote
and i assume i get about 10.5VDC after rectifying )  .

No you will probbly get about 16V. Remember that is 12V RMS, rectified and smoothed with no or just a light load will give you the peak value not the RMS value.

#### pyrotuc

#5
##### Apr 20, 2013, 03:46 am
also, theres things called hall effect sensors you may want to look into, but i dont know if they would be appropriate for what you are trying to accomplish.

#### retrolefty

#6
##### Apr 20, 2013, 05:34 pmLast Edit: Apr 21, 2013, 02:41 am by retrolefty Reason: 1

also, theres things called hall effect sensors you may want to look into, but i dont know if they would be appropriate for what you are trying to accomplish.

No it wouldn't. Hall effect sensors designed for power measurement are used to sense and measure current, they won't let you sense or measure voltage. The hall effect sensor itself is a magnetic sensor.

Lefty

Go Up