This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spark_counter [2016/09/30 17:29] – update links kingkevin | spark_counter [2024/01/07 17:49] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 13: | Line 13: | ||
{{: | {{: | ||
- | **warning: the electricity meter I am presenting will only work for 1 phase 2 wires power distribution systems. I have a 3 phases | + | **warning: the electricity meter I am presenting will only work for 1-phase 2-wire power distribution systems. I have a 3-phase |
====== peacefair PZEM-004 ====== | ====== peacefair PZEM-004 ====== | ||
Line 37: | Line 37: | ||
{{: | {{: | ||
- | The meter also provides a UART port to query the measured values. | + | The meter also provides a UART port (using an XH-4P connector) |
Two opto-couplers isolate the main power meter circuits from the TX and RX UART ports. | Two opto-couplers isolate the main power meter circuits from the TX and RX UART ports. | ||
Line 52: | Line 52: | ||
The {{: | The {{: | ||
The UART configurations is 9600 bps 8N1. | The UART configurations is 9600 bps 8N1. | ||
- | Before querying the measurements, | + | You have to set the device' |
- | Else it won't reply to the other commands. | + | This address will be saved so the next time (even after power down) you can directly query measurements using the address(es) |
- | The manual uses an IP as address (192.168.1.1 | + | All commands include the target device address and only the device with the specified address will respond, except |
- | No idea why you would set an IP for a UART address. | + | This allows to query multiple devices connected to the same UART port, one after another, when they have different addresses. |
+ | Note: the optocouplers on the Tx pin of the device have a pull-up resistor. Be sure to remove all but one when using multiple devices, else the low value of the signal will be too high for the receiver to decode the serial communication. | ||
The commands use the following 7 bytes message format: | The commands use the following 7 bytes message format: | ||
Line 79: | Line 80: | ||
I removed the pizeo-element to prevent this annoying sound. | I removed the pizeo-element to prevent this annoying sound. | ||
- | {{: | + | {{: |
- | {{: | + | {{: |
- | {{: | + | |
The power meter uses a single chip solution, the [[http:// | The power meter uses a single chip solution, the [[http:// | ||
Line 97: | Line 97: | ||
USART to query the power meter, SPI to communicate with the nRF24L01+, and the nRF24L01+ protocol are implemented in C (using a lot of interrupts). | USART to query the power meter, SPI to communicate with the nRF24L01+, and the nRF24L01+ protocol are implemented in C (using a lot of interrupts). | ||
- | The source code is available [[https:// | + | The source code is available [[https:// |
I prefer directly writing in the registers as described in the [[http:// | I prefer directly writing in the registers as described in the [[http:// | ||
This way I learn how it works in details. | This way I learn how it works in details. | ||
Line 121: | Line 121: | ||
On the [[# | On the [[# | ||
- | The source code is available [[https:// | + | The source code is available [[https:// |
On the [[# | On the [[# | ||
Line 135: | Line 135: | ||
To receive the measurements I used a [[# | To receive the measurements I used a [[# | ||
- | The source code is available [[https:// | + | The source code is available [[https:// |
[[http:// | [[http:// | ||
Line 156: | Line 156: | ||
{{: | {{: | ||
- | ====== Orange Pi ====== | ||
- | The [[http:// | ||
- | This single board computer 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 debian jessie minimal. | ||
- | |||
- | The pin header is the same as the [[http:// | ||
- | The SPI port to connect the nRF24L01 is also available over ''/ | ||
- | But else this board is not really worth spending time on. | ||
- | |||
- | 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. |