Electric Consumption with Meter CHINT (pulses) + ESP8266 & Matrix led MAX7912
This time we will return to an interesting project, the measurement of electrical consumption in an invasive way with a CHINT DDS666 Meter Mono phase, technically it is a residential or residential meter that we have already presented in previous tutorials, finally I will finish what I started more than a year:
Warning: Caution is recommended since this project involves electrical risk or electrocucion since 110 VAC -120 VAC connected equipment is used, basic knowledge is required, please be previously documented in this regard.
In the following video-tutorials the power connection of the meter will be explained:
- Power Consumption Measurement – Medicion Consumo Electrico Part 1 Chint DS666:
- Power Consumption Measurement – Medicion Consumo Electrico Part 2 Chint DS666:
For a long time I have this meter and with the help of an ESP8266 and / or arduino we will make the measurement of Active Power, as a load we will use a 45W bulb, to have a fixed charge that represents a “home”.
This meter has 2 features.
- It is invasive “the circuit must be opened to place in series between the source and the load”
- It does not have a serial communication protocol, only a pulse output ratio of 3200imp / kwh.
Calculation Electric Consumption
The meter has 2 terminals (11+) (12-) assigned to an opto-isolated “isolated” output that is activated by generating pulses, said pulses are generated in relation 3200imp / kwh (for this meter), with which we will calculate the instantaneous consumption.
Materials and Where to Buy Cheap!!
- Monofasic Meter CHINT DDS666 u other meter that generates pulses
- ESP8266 12E
- Arduino Nano Clone
- Power supply 5v
- Matrix led x4 MAX7912
- Protoboard 830 Points
- Optocoupler 4n25
Note: Technically should work with any meter the only requirement is that it has a similar factor of integration (3200imp / kwh) example 1000imp / kwh.
Testing Chint DS666 & ESP8266 NodeMCU
The meter only has a pulse output to perform the calculation of electrical consumption, we capture through an interruption in the GPIO 5 (D1), technically using the proper factor of the meter 3200imp / kWh = 3.2, the instantaneous active power is calculated. a time difference between pulses and based on 1 hour = 3600s.
power = (3600000000.0 / (pulseTime – lastTime))/3.2
This calculation is made in the interruption, only each time a new pulse is recorded.
Initially thanks to OpenEnegyMonitor, for the documentation the calculation was taken from one of the previous versions of your page, but the more detailed and technical explanation : Monitoring energy via utility meter pulse output.
Connections Chint DS666 & ESP8266 NodeMCU
During the first tests connected the GPIO directly to the meter, the chint meter has its own optocoupler, for some reason whenever a pulse was generated, the ESP8266 module recorded 2 pulses, something that did not happen with Arduino.
- Connection Diagram
Arduino IDE Code
As mentioned above with an interruption in GPIO 5, the calculation of instantaneous active power is performed. but this calculation is only done when receiving pulses.
A condition has been added to not perform the calculation with the first pulses after downloading the code to the module, because it would calculate an erroneous value in that case, given that a time difference between pulses is made.
There is a second validation that must be improved, if a pulse is received at a lower interval than the previous pulses in the re-calculation of this new frequency will calculate a very large consumption, while the next pulse arrives, a limit has been tentatively set that if the consumption is <1000w use the result otherwise discard, because it is a very large and / or wrong value, I am improving this part ..
Initially I also performed the calculation of kWh in ESP8266, but discard it since it is the accumulated kilowatt hours, I would have to store the values in the eeprom or in the SPIFFFS file system and the code would be extended unnecessarily, it is better and more practical that the final platform that receives the data makes such integration.
Note: Download complete code below …
Conclusions & Considerations
Initially, a lot of caution should be taken since this project involves electrical risk or electrocution since 110VAC -120 VAC is used, although some do not consider it high voltage, this does not minimize the danger, it is recommended to have basic knowledge or documentation, never make connections When hot, always de-energize the power circuits.
This method of measuring electrical consumption by pulses, in this case using this household chint meter, the actualization time of the watts consumed will depend directly on the load that therefore influences the amount of pulses, with this 45 watt light bulb it was received one pulse every 24 sec approx.
To improve in code …
This I mentioned above but I want to emphasize it …
To detect erroneous values before updating measured watts, when changing the frequency of pulses abruptly in a very small time interval, the calculation can generate very small or very large values, an abnormal behavior that does not happen but must be taken into account.
In many projects use an optical or infrared sensor to detect the pulse without requiring to connect, it is another possibility for future improvement.
There is another class of pulse meters this method should work, as long as it has a pulse factor / kWh.
In future tutorials we will integrate it with previously tested platforms,Emoncms mainly with very detailed modules for electrical consumption.
As always we are open to suggestions, improvements and contributions from the comments ….