CuVoodoo

the sorcery of copper

User Tools

Site Tools


spark_abacus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
spark_abacus [2017/01/21 20:59] – add DDM100TC kingkevinspark_abacus [2024/01/07 17:49] (current) – external edit 127.0.0.1
Line 1: Line 1:
-The spark abacus is a custom electricity meter with wireless data logging capability+{{ :spark_abacus:installation.jpg?400x0|final installation}} 
-It's a follow-up to the [[spark_counter|spark counter]] for a 3-phase 4-wire mains electricity power distribution installation.+ 
 +The spark abacus is a custom electricity meter monitoring system
 +It's a follow-up of the [[spark_counter|spark counter]], but for a 3-phase 4-wire mains electricity power distribution installation. 
 + 
 +It is composed by: 
 +  * 1 [[#DDM100TC|DDM100TC]] 3-phase 4-wire electricity meter with pulse output 
 +  * 3 [[#Eastron SDM120-Modbus|SDM120]] single phase electricity meter with Modbus interface (with an UART to RS-485 adapter) 
 +  * 3 [[#peacefair PZEM-004T|PZEM-004T]] single phase electricity meter with UART interface 
 +  * 1 [[stm32f1xx|STM32F1]] micro-controller to collect the measurements from the electricity meters 
 +  * 1 [[#ESP-01|ESP6266]] WiFi module to transmit the measurement values to the database 
 +  * 1 [[#Orange Pi PC|Orange Pi PC]] single board computer with [[https://influxdb.com/|InfluxDB]] time series database and [[http://grafana.org/|Grafana]] graphical monitoring tool 
 + 
 +====== prototypes ====== 
 + 
 +===== complete ===== 
 + 
 +The first prototype used an old WiFi D-Link router case. 
 +I glued a DIN-rail mount on the back to install it in the distribution panel. 
 +The development board is a small [[stm32f1xx#blue_pill|blue pill]]. 
 + 
 +I could fit all elements inside, including the three PZEM-004Ts, and had nice connectors, but it was too large to fit in the distribution panel along with the other electricity meters and RCCB. 
 + 
 +The source code and all technical details are available on [[https://git.cuvoodoo.info/kingkevin/spark_abacus/src/branch/full|git]]. 
 + 
 +{{:spark_abacus:complete-01.jpg?0x300|complete prototype, inside}} 
 +{{:spark_abacus:complete-02.jpg?0x300|complete prototype, front}} 
 +{{:spark_abacus:complete-03.jpg?0x300|complete prototype, back}} 
 + 
 +===== light ===== 
 + 
 +For this second prototype I used a broken SDM630 electricity meter case. 
 +It is smaller and is designed to fit nicely in the distribution panel. 
 + 
 +This time I did not include the PZEM-004T meters since they are to large to fit in, and would only provide information I could already get from the other electricity meters. 
 +This left a lot of space to include a larger [[stm32f1xx#system_board|development board]], and I could use dupont cables to connect all elements. 
 +I used the connector already available in the case (for two pulse outputs and one RS-485 interface) as inputs for the monitoring system (one pulse input, as RS-485 master, AC input for 5V). 
 + 
 +The source code and all technical details are available on [[https://git.cuvoodoo.info/kingkevin/spark_abacus/src/branch/light|git]]. 
 + 
 +{{:spark_abacus:light-03.jpg?0x300|light prototype, fong}} 
 +{{:spark_abacus:light-01.jpg?0x300|light prototype, inside}} 
 +{{:spark_abacus:light-02.jpg?0x300|light prototype, inside}} 
 +{{:spark_abacus:light-04.jpg?0x300|light prototype, connection}} 
 + 
 +===== improvements ====== 
 + 
 +Future improvments: 
 +  * submit measurement values to influxDB using UDP (faster, no need for credentials) 
 +  * make a bulk ModBus request to get most measurements at once (the pauses between requests for each measurement cost a lot of time) 
 +  * use an LCD to show the values (the LEDs only show the status) 
 +  * use the touch button already available on the SDM630 case
  
 ====== electricity meters ====== ====== electricity meters ======
Line 27: Line 77:
  
 The [[http://www.china-huabang.com/en/product-show.asp?id=31&tt=101|DDM100TC]] (you can find it under different brands) is a 3-phase 4-wire electricity meter. The [[http://www.china-huabang.com/en/product-show.asp?id=31&tt=101|DDM100TC]] (you can find it under different brands) is a 3-phase 4-wire electricity meter.
 +
 +{{:spark_abacus:ddm100tc-01.jpg?0x200|DDM100TC module, front side}}
 +{{:spark_abacus:ddm100tc-02.jpg?0x200|DDM100TC module, connectivity}}
  
 The meter provides: The meter provides:
Line 40: Line 93:
 The number of impulses indicates the energy used, and the time interval between impulses indicates the current power consumption. The number of impulses indicates the energy used, and the time interval between impulses indicates the current power consumption.
 I chose one with a high impulse rate of 1600 impulses/kWh (= 1 impulse for every 0.625 Wh). I chose one with a high impulse rate of 1600 impulses/kWh (= 1 impulse for every 0.625 Wh).
 +
 +{{:spark_abacus:ddm100tc-03.jpg?0x150|DDM100TC module, LCD board, front side}}
 +{{:spark_abacus:ddm100tc-06.jpg?0x150|DDM100TC module, LCD board, back side}}
 +{{:spark_abacus:ddm100tc-04.jpg?0x150|DDM100TC module, meter board, front side}}
 +{{:spark_abacus:ddm100tc-05.jpg?0x150|DDM100TC module, meter board, back side}}
  
 There is also the DDM100TCR model with an RS-485 interface, but I couldn't find any documentation about the protocol messages, thus I wasn't interested in this feature. There is also the DDM100TCR model with an RS-485 interface, but I couldn't find any documentation about the protocol messages, thus I wasn't interested in this feature.
  
-====== EPS8266 ======+===== Eastron SDM120-Modbus ===== 
 + 
 +The [[http://www.eastrongroup.com/|Eastron]] [[http://eastrongroupco.hk02.057321.com/productsview/14.html|SDM120-Modbus]] is a slim 1-phase 2-wire electricity meter. 
 + 
 +{{:spark_abacus:sdm120-02.jpg?0x200|SDM120 front}} 
 +{{:spark_abacus:sdm120-01.jpg?0x200|SDM120 side}} 
 +{{:spark_abacus:sdm120-03.jpg?0x200|SDM120 board back}} 
 +{{:spark_abacus:sdm120-04.jpg?0x200|SDM120 board side}} 
 +{{:spark_abacus:sdm120-05.jpg?0x200|SDM120 board side}} 
 + 
 +Be aware as numerous SDM120 models exist, combining following options: 
 +  * in-line current measurement or using a current sensing coil (CT) 
 +  * with electro-mechanical display or LCD, sometimes with backlight 
 +  * only with 2 pulse outputs, or with additional MBus or Modbus interface 
 + 
 +I chose the {{:spark_abacus:sdm120-modbus_user_manual_scan.pdf|SDM120 model}} (one per phase) since I wanted to learn about the RS-485 interface and Modbus protocol. 
 +The [[http://eastrongroupco.hk02.057321.com/data/uploads/Eastron_SDM120-Modbus_protocol_V2_3_(1).pdf|corresponding Modbus document]] ({{:spark_abacus:sdm120-modbus_protocol_v2.1.pdf |older v2.1}}) lists the registers containing the measurements (input registers) and configuration (holding registers). 
 +This document also explains the Modbus protocol, but I rather recommend to read the one for the [[http://eastrongroupco.hk02.057321.com/data/uploads/Eastron_SDM630MV_CT_protocol_V1_0_.pdf|SDM630]] since it contains more information, most importantly the timing between messages. 
 + 
 +====== ESP8266 ======
  
 To send the values measured by the electricity meters and collected by the micro-controller, I used a WiFi module based on the [[http://www.esp8266.com/wiki/doku.php|ESP8266]] SoC. To send the values measured by the electricity meters and collected by the micro-controller, I used a WiFi module based on the [[http://www.esp8266.com/wiki/doku.php|ESP8266]] SoC.
Line 116: Line 193:
 It is now also possible to get ESP-01 modules with 8 Mbits / 1 MByte of flash, which supports more recent AT firmwares. It is now also possible to get ESP-01 modules with 8 Mbits / 1 MByte of flash, which supports more recent AT firmwares.
  
-====== Orange Pi ======+====== Orange Pi PC ====== 
 + 
 +{{:spark_abacus:opi-01.jpg?0x200|Orange Pi PC, front side}} 
 +{{:spark_abacus:opi-02.jpg?0x200|Orange Pi PC, without heat sink}} 
 +{{:spark_abacus:opi-03.jpg?0x200|Orange Pi PC, back side}}
  
 The [[http://www.orangepi.org/orangepipc/|Orange Pi PC]] is a cheap [[http://www.aliexpress.com/item/Orange-Pi-PC-ubuntu-linux-and-android-mini-PC-Beyond-and-Compatible-with-Raspberry-Pi-2/32448079125.html|$15 alternative]] to the Raspberry Pi 2. The [[http://www.orangepi.org/orangepipc/|Orange Pi PC]] is a cheap [[http://www.aliexpress.com/item/Orange-Pi-PC-ubuntu-linux-and-android-mini-PC-Beyond-and-Compatible-with-Raspberry-Pi-2/32448079125.html|$15 alternative]] to the Raspberry Pi 2.
Line 131: Line 212:
 I am only using this SBC a cheap computer rather than hardware platform. I am only using this SBC a cheap computer rather than hardware platform.
 Also, don't forget to put a heat sink on the CPU, else they will be slowed down quite often because of the high temperatures. Also, don't forget to put a heat sink on the CPU, else they will be slowed down quite often because of the high temperatures.
 +
 +On it I've installed an [[https://www.influxdata.com/|InfluxDB]] time-series database to store the values (using the HTTP API), and [[http://grafana.org/|Grafana]] to visualize them.
 +
 +{{:spark_abacus:grafana.png?1000x0|simple display of the power consumption}}
spark_abacus.1485032367.txt.gz · Last modified: 2024/01/07 17:49 (external edit)