spark_abacus
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spark_abacus [2017/01/18 20:20] – add PZEM-004T kingkevin | spark_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. | + | {{ : |
- | It's a follow-up | + | |
+ | The spark abacus is a custom electricity meter monitoring system. | ||
+ | It's a follow-up | ||
+ | |||
+ | It is composed by: | ||
+ | * 1 [[# | ||
+ | * 3 [[#Eastron SDM120-Modbus|SDM120]] single phase electricity meter with Modbus interface (with an UART to RS-485 adapter) | ||
+ | * 3 [[# | ||
+ | * 1 [[stm32f1xx|STM32F1]] micro-controller to collect the measurements from the electricity meters | ||
+ | * 1 [[# | ||
+ | * 1 [[#Orange Pi PC|Orange Pi PC]] single board computer with [[https:// | ||
+ | |||
+ | ====== 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# | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ===== 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# | ||
+ | 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:// | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ===== 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 19: | Line 69: | ||
The device also offers a serial port (isolated from mains electricity using optocouplers) so to be able to read out the measured values. | The device also offers a serial port (isolated from mains electricity using optocouplers) so to be able to read out the measured values. | ||
- | The serial | + | The serial |
Compared to the [[spark_counter# | Compared to the [[spark_counter# | ||
Else it uses the same design and chip. | Else it uses the same design and chip. | ||
- | ====== EPS8266 ====== | + | ===== DDM100TC |
- | To send the values I used a WiFi module based on the [[http:// | + | The [[http:// |
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | The meter provides: | ||
+ | * 1 LCD to show the energy used in kWh (with a precision od 0.1 kWh) | ||
+ | * 3 LEDs to show which phase powered (L1, L2, L3) | ||
+ | * 1 LED to show the direction to the current (reverse if REV is on) | ||
+ | * 1 LED to show impulses as energy is used | ||
+ | * 1 S0 interface to output impulses as energy is used | ||
+ | |||
+ | The S0 interface (labelled TEST on the side) allows me to collect the energy used on my micro-controller. | ||
+ | Connect the + side (pin 8) to a positive voltage (i.e. +5V), an the - side (pin 7) to an input (with a pull-down resistor). | ||
+ | Each impulse will generate a high signal (+2.5V in my case) on - for ~ 90 ms. | ||
+ | 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/ | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | There is also the DDM100TCR model with an RS-485 interface, but I couldn' | ||
+ | |||
+ | ===== Eastron SDM120-Modbus ===== | ||
+ | |||
+ | The [[http:// | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | 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 {{: | ||
+ | The [[http:// | ||
+ | This document also explains the Modbus protocol, but I rather recommend to read the one for the [[http:// | ||
+ | |||
+ | ====== ESP8266 ====== | ||
+ | |||
+ | To send the values | ||
Several [[http:// | Several [[http:// | ||
- | Since I only use it' | + | Since I only use its WiFi functionality, |
===== ESP-01 ===== | ===== ESP-01 ===== | ||
Line 35: | Line 131: | ||
{{ : | {{ : | ||
- | To use the device, simply connect | + | To use the device, simply connect GND, VCC (3.3V), RX (module input), TX (module output), RST (using a pull-up resistor), and CH_PD (using a pull-up resistor). |
===== AT firmware ===== | ===== AT firmware ===== | ||
My module showed the following firmware information when powered up (with 9600 8N1 serial configuration): | My module showed the following firmware information when powered up (with 9600 8N1 serial configuration): | ||
- | When using the '' | + | When using the '' |
- | This custom firmware wasn't particularly stable, so I decided to use a more recent standard one. | + | This custom firmware wasn't particularly stable, so I decided to use a more recent, and standard one. |
To flash a firmware you have to enter the bootloader mode by connecting GPIO0 to ground. | To flash a firmware you have to enter the bootloader mode by connecting GPIO0 to ground. | ||
Line 47: | Line 143: | ||
I used [[https:// | I used [[https:// | ||
- | Espressif | + | Espressif |
Since I only want to use this module for its WiFi connectivity I only care about the AT firmware. | Since I only want to use this module for its WiFi connectivity I only care about the AT firmware. | ||
- | The AT firmware allows to use the ESP over serial | + | The AT firmware allows to control |
- | This firmware is provided in the NONOS SDKs (V2.0.0 | + | This firmware is provided in the NONOS SDKs (V2.0.0 |
The module I had uses a 25Q40 flash chip with only 4Mbits/ | The module I had uses a 25Q40 flash chip with only 4Mbits/ | ||
Line 97: | 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 ====== |
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
The [[http:// | The [[http:// | ||
Line 107: | Line 207: | ||
* [[http:// | * [[http:// | ||
* various [[http:// | * various [[http:// | ||
- | Since I'll only use it as server I decided to go with debian jessie | + | Since I'll only use it as server I decided to go with an [[https:// |
The pin header is the same as the [[http:// | The pin header is the same as the [[http:// | ||
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:// | ||
+ | |||
+ | {{: |
spark_abacus.1484770803.txt.gz · Last modified: 2024/01/07 17:49 (external edit)