In this post i'll cover actual sensor setup for energy monitor.
Energy monitor
To evaluate power consumption i've routed main cable coming from utility energy monitor in a new electrical panel. In this panel i've installed:- 3 three-phase energy meter (16 kW of maximum power)
- 1 single-phase energy meter
This is an internal view of my setup inside an ABB electrical panel (upper part, with two of these energy monitor) after thermal-magnetic circuit breaker and surge protector.
For this duty i preferred to go with an industrial solution, because i was not confident with DIY solutions on main power side.
My solution is a products from Italian manufacturer LOVATO:
My solution is a products from Italian manufacturer LOVATO:
LOVATO DMED300T2 is a compact (four modules) energy meter. The main advantage is the presence of two programmable pulse output (up to 1000 pulses/1kWh or programmable threshold).
The output is an open collector, in which each pulse has a duration of 60ms: an open collector is a transistor based output that can be read by an external PLC (like arduino).
The electrical connection requires only to route an input pin of the arduino to open collector and connect the two IC grounds to have the same reference level and let current from arduino to flow once open collector is open.
There are two methods to read these output, with interrupts or with pooling.
Because i had only one external interrupt, i had to go with pooling: loop forever and check if digital input is high or low. If is high, and previous one was low, than increment a counter and go on to next input.
First of all, in my system maximum power is 16 kW: this means each hour i can have a maximum number of pulses of 16 * 1000 = 16.000 pulses/hour equal to 4.45 pulses/second, each one of 60 ms.
If entire loop timing is less than 60ms, no pulse is missed.
Because open collector is transistor based, i found no debounce routine is needed (situation like button press may need a stabilisation in input reading).
My piece of code for pooling is:
//INPUT SETUP
pinMode(LOVATO1, INPUT); // set pin to input
digitalWrite(LOVATO1, HIGH); // turn on pullup resistors
//INPUT LOOP
READ1 = digitalRead(LOVATO1);
if (READ1 != LASTSTATE1) {
if (LASTSTATE1 == 1) {
COUNTER1 ++;
}
LASTSTATE1 = READ1;
}
Taking into account the time delta between reading A and reading B (60s in my case), is possible to average the energy consumption during this period, and to define average power consumption during the period.
Passing via serial milliseconds and pulse numbers between loops, i can reduce the time spent communicating with host, leaving calculation on other side.
Resulting chart of 1 day power consumption average (1 tick/30 minutes):
The output is an open collector, in which each pulse has a duration of 60ms: an open collector is a transistor based output that can be read by an external PLC (like arduino).
The electrical connection requires only to route an input pin of the arduino to open collector and connect the two IC grounds to have the same reference level and let current from arduino to flow once open collector is open.
There are two methods to read these output, with interrupts or with pooling.
Because i had only one external interrupt, i had to go with pooling: loop forever and check if digital input is high or low. If is high, and previous one was low, than increment a counter and go on to next input.
First of all, in my system maximum power is 16 kW: this means each hour i can have a maximum number of pulses of 16 * 1000 = 16.000 pulses/hour equal to 4.45 pulses/second, each one of 60 ms.
If entire loop timing is less than 60ms, no pulse is missed.
Because open collector is transistor based, i found no debounce routine is needed (situation like button press may need a stabilisation in input reading).
My piece of code for pooling is:
//INPUT SETUP
pinMode(LOVATO1, INPUT); // set pin to input
digitalWrite(LOVATO1, HIGH); // turn on pullup resistors
//INPUT LOOP
READ1 = digitalRead(LOVATO1);
if (READ1 != LASTSTATE1) {
if (LASTSTATE1 == 1) {
COUNTER1 ++;
}
LASTSTATE1 = READ1;
}
Taking into account the time delta between reading A and reading B (60s in my case), is possible to average the energy consumption during this period, and to define average power consumption during the period.
Passing via serial milliseconds and pulse numbers between loops, i can reduce the time spent communicating with host, leaving calculation on other side.
Resulting chart of 1 day power consumption average (1 tick/30 minutes):
No comments:
Post a Comment