Skip to content

matejus/w_meter

Repository files navigation

Watt Meter

Examples how to measure power consumption using current sensors. See application.h file and select the APP you want to deploy.

APP1

Visit Hackster.io to read the story.

The consumed power is measured using inductive currency sensor. The measured value is read by A/D channel as voltage on resitor (R = 340ohm) and have to be recalculated back to current. Because of the sensor is measuring AC currency the input value have to be measured more times to get peak current (5 periods of 50Hz - MEASURING_TIME = 100ms).

The peak current have to be recalculated to effective current. Then using the sensor ratio (RATIO = 1000) and electricity voltage (U = 230V) is possible to calculate the power consumption.

P = U * I

  • where U is electricity voltage
  • and I is calculated effective current

I = Ip * SQRT(2)/2 * RATIO

  • where Ip is measured peak current
  • and RATIO is sensor's induction ratio

Ip = MAX(Um / R) for 5 periods

  • where U is measured voltage
  • and R is resistance used to measure currency, placed between pins of sensor. Max available resistance is 3.3V/5mA=660ohm, but use smaller for sure.

Finally the measured currency and power consumption is written to the LCD display and sent over the radio to computer.

I had used 2 current sensors on L and N wire (named COIL_1 and COIL_2). the solution now can compare currency on both wires (L and N) and could be identical. When there is difference higher than measurement error then it is alerted on display. If you want to use different ADC to measuring change the definitions at the begining of application.c file. You can change measuring period (5 sec by defaut) by modification of MEASURING_PERIOD constant.

Warning

You are playing with voltage of 230 V which is life threating. Be careful, keep everything isolated and don't touch the wires when plug is in the socket!

APP2

Example how to measure battery using the ACS712 Hall sensor. I want to measure battery behavior when the currency consumption increase. Usually the battery voltage goes down until the internal resistance and current passing trough the circuit and voltage are not balanced - old good Ohm's law: U = I*R.

In this case the dividing bridge is used to reduce battery voltage to be measured. Big Clown core module measure voltage up to 3.3V and Li batteries are 3.6V. In this case the resistors R1=680k and R2=220k Ohm are used with dividing ratio cca 4:1 R2/(R1+R2).

ACS712 currency sensor is based on the Hall's effect. Sensor can measure the current in both directions. Output is voltage between 0 and VCC when the zero currency corresponds to VCC/2. Sensor can be powered by 3.3 - 5V. The measuring coefficient is 185mV/A.

The precision of the ASC712 sensor is limited, it cannot measure small currency under 200 mA because of there is electromagnetic smog around. In the datasheet there is information about the noise voltage (21mV) corresponding to 120 mA.

APP3

Third example is variant of APP1. The current is measured using the induction current sensor. Both coils are used, but only one is measuring the currency in the wire. Second is used to measure false magnetic field generated by things around.

About

"non-invasive" watt meter with BgClown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published