I want to build an energy consumption meter using my Raspberry Pi. I have done some research, and determined that the ACS712 current sensor could be interfaced with my RPi for this purpose. I do not understand electrical jargon very well, and so I am asking this first question here to determine feasibility and a general approach.

closed as too broad by joan, Milliways, Aurora0001, Dmitry Grigoryev, tlhIngan Aug 14 '18 at 17:54

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Your question might lead some to believe that you haven't done much research before posting. Only you know what you did before posting, but I'll suggest that you read the guidelines here for asking a "good question"; this will give you some insight into how others might see your question.

That said, I'll try to answer some of your questions, as I understand them:

  1. "Is it possible to measure my energy consumption using ACS current sensor..."?

Yes, but know that "energy consumption" is not directly measured by taking a current reading. Energy consumption is the product of power and time (i.e. E = P*T), and is measured in terms of watt-hours or (sometimes) joules.

Power is the product of current and voltage (i.e. P=V*I), and measured in watts. Current is measured in amperes (or amps), and voltage is measured in volts.

One way to help keep this straight is to look at your electric utility bill. Note that you are (likely) billed on your usage in "kilowatt-hours", and electric power producers often quote their rates as $/£/€ per kilowatt-hour. So you're buying energy from your supplier - not power, or current because those are instantaneous measures.

  1. "... then how to do it?"

Based on the above, and in general, you will measure voltage, current and time, and then you will multiply them together to get energy:

E = V * I * T
And if your units are volts, amps and hours, then your result (E) will be in watt-hours.

With all of that out of the way, as a practical matter, here's how you might proceed:

  • time: you can measure time in software in any number of ways; for example in bash: timestamp=$(date +%T), or in Python use the time module. You'll need elapsed time of course, so measure time when you commence your electrical readings, and then again when you finish a measurement.
  • voltage: you can most likely get the voltage value from a specification. Also, if your power source is a constant voltage source (dc or rms), you could also take a measurement, and use that value with little loss in accuracy.
  • current: At long last, this is where you will use your ACS current sensor. You should probably be using the ACS723 chip instead of the ACS712, since the `712 has been declared as "Not for new design", but they operate on the same principle - they are "Hall Effect Sensors". There are plenty of resources detailing the hardware connection that can be consulted for the price of a Google search, and so I'll leave that for you. Most fortunately, there is a Python library for the ACS712 that should make your software interface much easier.

I hope this helps get you started. We'll leave it up to you to do a bit of research, and fill in some details. Once you've tried something, and if it doesn't work, please post those specific questions here iaw the guidelines in The Tour

Not the answer you're looking for? Browse other questions tagged or ask your own question.