Ac mains current detector

I am fairly new to all of this but I know enough about it to be able to figure most things out given enough time. One of the best ways to learn something is to apply what you're trying to learn into a project. That's why we have school courses. So I I want to build a project and understand why I'm doing the things I'm doing. This is the project that I chose that I would really appreciate if you guys would take the time to explain the concepts to me to provide links for me to read and walk me through so I understand it.

I want to build a power detector. I wanted to plug into an outlet just a normal 110-volt Outlet and I want it to tell me on my phone if it has power or if it does not have power. I don't need to figure out what the power is or anything else just a simple on or off. From my reading 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. So I have an acs712 hall effect sensor from SparkFun. I also purchased a beetle ble which is a super small Arduino compatible ble microcontroller. I have taken apart a plug tester and hollowed it out. I plan on putting the two two components in the plug tester to plug it into an outlet for testing.

I am not the greatest programmer in the world by any means but I can stumble my way through most things. In addition to the hardware help once we get the circuit figured out I would then like to move on to the programming and understand why the things I type work or what am I missing that I should be doing. This project has pretty good spectrum of Concepts I'm going to need to apply to learn.

A lot of the things I don't understand are when to use resistors, I still don't understand what a pull-up resistor.

I'm big on organization. So if you guys don't mind let's start with did I choose the correct hardware for this? Then let's move on to the circuit which I will upload a sketch of it when I'm not on my phone. And then the coding for it.

I asked that anyone who does not have constructive criticism or general guidance to please not include yourself. It does nobody any good being told to Google it to look somewhere else or bring up it's been asked a billion times. That's the point of forums and if people didn't continually ask it there would be no where to look. For everybody else I really appreciate your help and I thank you in advance.

take your ESP8266 and power it from a cell phone charger.
have it connect to the web.
tie in a battery and charge the battery from the same plug.
when you loose power, bingo ! you know you do not have power.
you would have battery and an internet connection via wifi so you can send you message.

jnkfile:
I asked that anyone who does not have constructive criticism or general guidance to please not include yourself. It does nobody any good being told to Google it to look somewhere else or bring up it's been asked a billion times. That's the point of forums and if people didn't continually ask it there would be no where to look. For everybody else I really appreciate your help and I thank you in advance.

if it has been asked 100 times,
then you do need to read the archives.
if you cannot get an answer after an hour of googling, we can help you refine your google search terms.
we are here to help those who are in actual need of help to get things working.
People who have been able to get parts of their system working and are having troubles.
We are not a free hardware and software programming service.
so, please don't post like you are our boss and giving us directions.

[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.

A relay is the easiest way to do this.

I also purchased a beetle ble which is a super small Arduino compatible ble microcontroller.

Power that using a wall wart. If you can't connect to it with your phone, no power.