Ac mains current detector

[EDIT] I may have misunderstood you. Maybe you only need to detect the presence of voltage, not current or power??? That's easy with a 5V power supply, which will give you a safe-isolated voltage. Of course if you're detecting a power outage, you'll need a battery powered Arduino. And if you want to communicate over the cell phone network, your Arduino will need a cell number/contract. (Your Wi-Fi router won't work if there's a power outage, and Wi-Fi will only work locally.) And, you may need to write an app for the phone.

First... This is OK as a learning exercise, but it's cheaper & easier to buy a [u]Kill-A-Watt[/u]. And, it's not really a "beginner project", and of course you're playing around with voltages that can kill you.

Check out [u]OpenEnergyMonitor.org[/u].

I have figured that a hall effect sensor will be the best route to go because of the separation of the high voltage and low voltage.

Right! The power line voltage MUST be isolated from the Arduino (and from you). That can be done with a Hall effect sensor or a current transformer. The hall-effect sensor mounted on the board is the "easiest" way to go. If you get-around to measuring voltage, a regular (voltage) transformer is the easiest way to get isolation and voltage reduction.

Make sure to wire the current monitor in series with the load. If you connect it in parallel, you'll fry it!

I haven't studied the ACS712 and I don't know how it handles [u]AC current[/u]... I don't know if it will give you instantaneous readings (between the positive & negative peaks) or an average, and I'm not sure how it handles the negative half of the cycle. That's for you to research and experiment with. The ACC712 can't put-out negative voltages and the Arduino can't read negative voltages (in fact it can be damaged by negative voltages).

For power calculations you'll need the [u]RMS[/u] voltage and current. Since you know you've got a sine wave, there is a known ratio between average* and RMS or between peak and RMS. (You can look those up depending on what your software needs to do.)

To built a "proper" power meter you need to measure the simultaneous-instantaneous current and voltage, and make an RMS power calculation. However, the RMS voltage is known and fairly constant and with most loads the current & voltage are mostly in-phase. That means you can get a pretty good power measurement with just the RMS (or average) current. It's probably best to start with that... Just measure the average (or short-term peak) current, convert to RMS, and calculate the power. Once that works, if you wish you can add the RMS voltage measurement, and finally the simultaneous-instant measurements to account for inductive loads (which cause a phase difference between voltage & current).

  • The mathematical average of a sine wave is zero (positive half the time and negative half the time) but you can average the absolute values.