spark_abacus
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
spark_abacus [2016/09/30 09:55] – add ESP8266 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 to the [[spark_counter|spark counter]] for a 3 phases 4 wires electricity | + | |
- | ====== EPS8266 ====== | + | 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. | ||
- | To send the values I used a WiFi module based on the [[http:// | + | 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 ====== | ||
+ | |||
+ | For the spark abacus I am using several electricity meters. | ||
+ | This just evolved over time as I wanted to try different technologies, | ||
+ | |||
+ | ===== peacefair PZEM-004T ===== | ||
+ | |||
+ | The [[https:// | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | Connect mains electricity (AC) and the current sensing coil (put around the wire going to the load to monitor) and this electricity meter will measure voltage, current, power (active), and energy used by the load to monitor. | ||
+ | The energy value is saved (in EEPROM) and can be reset using the button (on the board). | ||
+ | |||
+ | 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 protocol is the same as for the [[spark_counter# | ||
+ | |||
+ | Compared to the [[spark_counter# | ||
+ | Else it uses the same design and chip. | ||
+ | |||
+ | ===== DDM100TC ===== | ||
+ | |||
+ | 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 13: | 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 25: | 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 68: | Line 186: | ||
OK | OK | ||
</ | </ | ||
- | |||
- | I wasn't able to get AT firmware for later SDKs to flash though. | ||
Here is also the [[https:// | Here is also the [[https:// | ||
+ | I wasn't able to get AT firmware from later SDKs (>1.5.0) to work though. | ||
+ | But again, this is just if you have only 4 Mbits (512KBytes) of flash. | ||
+ | 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 PC ====== | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | The [[http:// | ||
+ | This single board computer (SBC) is based on an [[https:// | ||
+ | |||
+ | For this price the hardware is unbeatable, but the software support is really poor. | ||
+ | Also only Android supports the video hardware acceleration currently. | ||
+ | The official [[http:// | ||
+ | * [[http:// | ||
+ | * various [[http:// | ||
+ | Since I'll only use it as server I decided to go with an [[https:// | ||
+ | |||
+ | The pin header is the same as the [[http:// | ||
+ | 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. | ||
+ | On it I've installed an [[https:// | ||
+ | {{: |
spark_abacus.1475229347.txt.gz · Last modified: 2024/01/07 17:49 (external edit)