voltage measurement using arduino

Hi all,
I'm new to arduino..i am doing a project to detect power outages in areas.so i need to get power outages using arduino.so what is the best way to do this arduino..please be kind enough to tel me how arduno analog input use to detect outages.for demo using 5v power pack hw can we do this??
thank you.

hudayanga:
Hi all,
I'm new to arduino..i am doing a project to detect power outages in areas.so i need to get power outages using arduino.so what is the best way to do this arduino..please be kind enough to tel me how arduno analog input use to detect outages.for demo using 5v power pack hw can we do this??
thank you.

One easy and safe way to detect main AC power failures is to use a simple relay that uses a AC coil relay. Your AC main power would keep the relay energized unless there was a main power outage in which case the relay would deenergize. The arduino would be wired to the relay's contacts and read continuously as a digital input signal.

Lefty

Another safe method would be to plug an AC to DC adapter into the wall, and monitor the DC voltage.

thanks for your response..if i monitor DC voltage how can implement hardware connection with arduino??how do i input voltage to arduino..i'm using arduino uno
thank you

hudayanga:
if i monitor DC voltage how can implement hardware connection with arduino??

If the DC voltage doesn't exceed 5V, you can simply connect the VCC to a digital pin and the GND to the Arduino's GND and use a digitalRead(). If it exceeds 5V, then you will need to use a voltage division circuit to get it under 5V.

If i use analog read which pins in arduino should i connect??

The analogue input ones.

you mean A0 to A5...??ok then my 5v comming from my power pack..then 5v vcc and gnd wire how can i input to arduino??
thank you

hudayanga:
you mean A0 to A5...??ok then my 5v comming from my power pack..then 5v vcc and gnd wire how can i input to arduino??
thank you

You plug the 5v into an input pin and the ground to the ground pin of the Arduino, as has already been explained.

Arrch:

hudayanga:
you mean A0 to A5...??ok then my 5v comming from my power pack..then 5v vcc and gnd wire how can i input to arduino??
thank you

You plug the 5v into an input pin and the ground to the ground pin of the Arduino, as has already been explained.

Little point to trying to measure the board's 5 volt Vcc voltage via a analog input pin as it will always read 1023 counts as the same Vcc is used as the reference voltage. So even as the Vcc battery pack lowers in voltage the analogRead value will still report as 1023 counts.

Best to state what you are trying to accomplish rather then how you think it should be done.

Lefty

retrolefty:
Little point to trying to measure the board's 5 volt Vcc voltage via a analog input pin as it will always read 1023 counts as the same Vcc is used as the reference voltage. So even as the Vcc battery pack lowers in voltage the analogRead value will still report as 1023 counts.

Best to state what you are trying to accomplish rather then how you think it should be done.

Lefty

He's not trying to measure the the board's power supply, he's using a wall wart to determine if there is AC power to an outlet (at least, that's what I've gathered from the limited information he's given).

Arrch:

retrolefty:
Little point to trying to measure the board's 5 volt Vcc voltage via a analog input pin as it will always read 1023 counts as the same Vcc is used as the reference voltage. So even as the Vcc battery pack lowers in voltage the analogRead value will still report as 1023 counts.

Best to state what you are trying to accomplish rather then how you think it should be done.

Lefty

He's not trying to measure the the board's power supply, he's using a wall wart to determine if there is AC power to an outlet (at least, that's what I've gathered from the limited information he's given).

OK, I missed that. However I would just wire the adapter's 5vdc output to a digital input pin rather then bothering to read it's value as it's a on or off type application alarm?

Lefty

If you want to detect short interruptions in power, you may have better luck in monitoring a relay.

retrolefty:
OK, I missed that. However I would just wire the adapter's 5vdc output to a digital input pin rather then bothering to read it's value as it's a on or off type application alarm?

Lefty

Yeah, that's what I recommended as well:

you can simply connect the VCC to a digital pin

You can use a simple voltage divider to get a fraction of 5V (2.5V for instance) at one of the Arduino analog inputs from the wall wart output, provided it has no regulated output and little filtration. That will allow you to check for the power outages and also monitor the line voltage which you will probably be tempted to do in the future. Just monitoring for power outages is so simple that you don't really need an Arduino for that. Lefty's relay hooked up to your alarm device is more than enough.

A safer way of monitoring mains voltage is through an opto isolator. Look here for more info: http://forum.arduino.cc/index.php/topic,171399.0.html

How is the Arduino going to monitor anything if the power is out?

...R