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/10/25 17:27] – typo kingkevin | spark_counter [2015/12/08 16:29] – [Orange Pi] kingkevin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | The spark counter is a custom electricity meter. | + | The spark counter is a custom electricity meter with wireless data logging capability. |
On one side I have: | On one side I have: | ||
Line 10: | Line 10: | ||
* a [[# | * a [[# | ||
* a [[http:// | * a [[http:// | ||
+ | |||
+ | {{: | ||
====== peacefair PZEM-004 ====== | ====== peacefair PZEM-004 ====== | ||
- | The [[http:// | + | The [[http:// |
It: | It: | ||
* measures voltages 80-260 V AC | * measures voltages 80-260 V AC | ||
Line 22: | Line 24: | ||
* is powered using 80-260 V AC | * is powered using 80-260 V AC | ||
* provides a TTL UART port to query these values (or set an alarm so to beep when a provided power threshold is reached) | * provides a TTL UART port to query these values (or set an alarm so to beep when a provided power threshold is reached) | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
The voltage measurement is done over the power input port. | The voltage measurement is done over the power input port. | ||
Line 27: | Line 32: | ||
Pass the wire on which you would like to measure the current through the coil, and connect the coil to the power meter. | Pass the wire on which you would like to measure the current through the coil, and connect the coil to the power meter. | ||
A drawing on the back of the device will describe how to connect the wires. | A drawing on the back of the device will describe how to connect the wires. | ||
+ | |||
+ | {{: | ||
The meter also provides a UART port to query the measured values. | The meter also provides a UART port to query the measured values. | ||
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. | ||
- | The {{:power_meter: | + | The {{:spark_counter: |
The UART configurations is 9600 bps 8N1. | The UART configurations is 9600 bps 8N1. | ||
Before querying the measurements, | Before querying the measurements, | ||
Line 60: | Line 67: | ||
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:// | ||
This chip does all the necessary work: measure voltage and current, drive the 7-segments LED displays, communicate over UART. | This chip does all the necessary work: measure voltage and current, drive the 7-segments LED displays, communicate over UART. | ||
There is only an additional external I²C EEPROM to store the global energy consumption. | There is only an additional external I²C EEPROM to store the global energy consumption. | ||
Line 66: | Line 77: | ||
====== ATmega328P ====== | ====== ATmega328P ====== | ||
- | {{ :power_meter: | + | {{:spark_counter: |
+ | {{: | ||
+ | {{ : | ||
To read out the measurements from the [[# | To read out the measurements from the [[# | ||
Line 72: | Line 85: | ||
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://to.do|in this git]]. | + | The source code is available [[https://git.cuvoodoo.info/ |
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 89: | Line 102: | ||
====== nRF24L01+ ====== | ====== nRF24L01+ ====== | ||
- | {{ :power_meter: | + | {{:spark_counter: |
+ | {{ : | ||
To transmit the measurements from the [[# | To transmit the measurements from the [[# | ||
Line 95: | Line 109: | ||
On the [[# | On the [[# | ||
- | The source code is available [[https://to.do|in this git]]. | + | The source code is available [[https://git.cuvoodoo.info/ |
On the [[# | On the [[# | ||
Line 102: | Line 116: | ||
====== Raspberry Pi ====== | ====== Raspberry Pi ====== | ||
- | {{ :power_meter: | + | {{:spark_counter: |
+ | {{ : | ||
To store the measurements I use a [[https:// | To store the measurements I use a [[https:// | ||
Line 108: | Line 123: | ||
To receive the measurements I used a [[# | To receive the measurements I used a [[# | ||
- | The source code is available [[https://to.do|in this git]]. | + | The source code is available [[https:// |
- | The values are then simply stored in an [[https:// | + | |
[[http:// | [[http:// | ||
Line 121: | Line 135: | ||
| GPIO9/MISO | P1_21 | 7 | MISO | | | GPIO9/MISO | P1_21 | 7 | MISO | | ||
| GPIO24 | P1_18 | 8 | IRQ | | | GPIO24 | P1_18 | 8 | IRQ | | ||
+ | |||
+ | The values are then simply stored in an [[https:// | ||
+ | |||
+ | Note: there is no ARM build of grafana (armel for RPi 1, armhf for later versions). | ||
+ | This is also because there is no ARM release of [[http:// | ||
+ | I'm running grafana on my local computer (amd64), using the remote database on the RPi. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ====== 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:// |
spark_counter.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1