spark_counter
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
spark_counter [2015/12/28 10:26] – [peacefair PZEM-004] kingkevin | spark_counter [2016/10/01 09:59] – [peacefair PZEM-004] address kingkevin | ||
---|---|---|---|
Line 12: | Line 12: | ||
{{: | {{: | ||
+ | |||
+ | **warning: the electricity meter I am presenting will only work for 1 phase 2 wires power distribution systems. I have a 3 phases 4 wires system and I am doing it wrong.** | ||
====== peacefair PZEM-004 ====== | ====== peacefair PZEM-004 ====== | ||
- | The [[http:// | + | The [[https:// |
It: | It: | ||
* measures voltages 80-260 V AC | * measures voltages 80-260 V AC | ||
Line 50: | Line 52: | ||
The {{: | The {{: | ||
The UART configurations is 9600 bps 8N1. | The UART configurations is 9600 bps 8N1. | ||
- | Before querying | + | All commands include a device address (i.e. C0 A8 01 01 = 192.168.1.1). |
- | Else it won't reply to the other commands. | + | Only the device with the specified address will respond. |
- | The manual uses an IP as address (192.168.1.1 = C0 A8 01 01). | + | This allows to query multiple devices on the same UART port, one after another, when they have different addresses. |
- | No idea why you would set an IP for a UART address. | + | Thus you have to set the device' |
+ | This address | ||
The commands use the following 7 bytes message format: | The commands use the following 7 bytes message format: | ||
Line 95: | Line 98: | ||
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 119: | Line 122: | ||
On the [[# | On the [[# | ||
- | The source code is available [[https:// | + | The source code is available [[https:// |
On the [[# | On the [[# | ||
Line 133: | Line 136: | ||
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 167: | Line 170: | ||
The pin header is the same as the [[http:// | 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. |
spark_counter.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1