CuVoodoo

the sorcery of copper

User Tools

Site Tools


spark_counter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
spark_counter [2015/10/25 18:52] – [Raspberry Pi] kingkevinspark_counter [2015/12/08 16:27] – [Orange Pi] kingkevin
Line 15: Line 15:
 ====== peacefair PZEM-004 ====== ====== peacefair PZEM-004 ======
  
-The [[http://www.aliexpress.com/wholesale?catId=0&SearchText=peacefair|peacefair]] [[http://www.aliexpress.com/wholesale?catId=0&SearchText=peacefair+pzem-004|PZEM-004]] is a simple power meter.+The [[http://www.aliexpress.com/wholesale?catId=0&SearchText=peacefair|peacefair]] [[http://www.aliexpress.com/wholesale?catId=0&SearchText=peacefair+pzem-004|PZEM-004]] is a simple power meter ({{:spark_counter:peacefair_pzem-004_porduct.pdf|datasheet}}).
 It: It:
   * measures voltages 80-260 V AC   * measures voltages 80-260 V AC
Line 85: 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/kingkevin/spark_counter/tree/master|in this git]].
 I prefer directly writing in the registers as described in the [[http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf|datasheet]] rather than using an [[https://www.arduino.cc/en/Main/Software|abstract IDE]] and [[https://github.com/TMRh20/RF24|libraries]]. I prefer directly writing in the registers as described in the [[http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf|datasheet]] rather than using an [[https://www.arduino.cc/en/Main/Software|abstract IDE]] and [[https://github.com/TMRh20/RF24|libraries]].
 This way I learn how it works in details. This way I learn how it works in details.
Line 109: Line 109:
  
 On the [[#ATmega328P|micro-controller]] side I implemented the complete SPI-based protocol using the [[https://www.nordicsemi.com/eng/content/download/2726/34069/file/nRF24L01P_Product_Specification_1_0.pdf|datasheet]]. On the [[#ATmega328P|micro-controller]] side I implemented the complete SPI-based protocol using the [[https://www.nordicsemi.com/eng/content/download/2726/34069/file/nRF24L01P_Product_Specification_1_0.pdf|datasheet]].
-The source code is available [[https://to.do|in this git]].+The source code is available [[https://git.cuvoodoo.info/kingkevin/spark_counter/tree/master|in this git]].
  
 On the [[#Raspberry Pi|computer]] side I use the [[https://github.com/TMRh20/RF24|RF24 library]]. On the [[#Raspberry Pi|computer]] side I use the [[https://github.com/TMRh20/RF24|RF24 library]].
Line 123: Line 123:
  
 To receive the measurements I used a [[#nRF24L01+|nRF24L01+ transceiver]] with the [[https://github.com/TMRh20/RF24|RF24 library]]. To receive the measurements I used a [[#nRF24L01+|nRF24L01+ transceiver]] with the [[https://github.com/TMRh20/RF24|RF24 library]].
-The source code is available [[https://to.do|in this git]].+The source code is available [[https://git.cuvoodoo.info/kingkevin/spark_counter/tree/master|in this git]].
  
 [[http://elinux.org/RPi_Low-level_peripherals#P1_Header|RPi]] - nRF24L01+ connection: [[http://elinux.org/RPi_Low-level_peripherals#P1_Header|RPi]] - nRF24L01+ connection:
Line 137: Line 137:
  
 The values are then simply stored in an [[https://influxdb.com/|InfluxDB]] time series database for visualisation in [[http://grafana.org/|grafana]]. The values are then simply stored in an [[https://influxdb.com/|InfluxDB]] time series database for visualisation in [[http://grafana.org/|grafana]].
 +
 +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://phantomjs.org/|PhantomJS]].
 +I'm running grafana on my local computer (amd64), using the remote database on the RPi.
  
 {{:spark_counter:grafana.png?0x200|grafana visualization}} {{:spark_counter:grafana.png?0x200|grafana visualization}}
 +
 +====== Orange Pi ======
 +
 +The [[http://www.orangepi.org/orangepipc/|Orange Pi PC]] is a cheap [[http://www.aliexpress.com/item/Orange-Pi-PC-ubuntu-linux-and-android-mini-PC-Beyond-and-Compatible-with-Raspberry-Pi-2/32448079125.html|$15 alternative]] to the Raspberry Pi 2.
 +This single board computer is based on an [[https://linux-sunxi.org/H3|Allwinner H3 (sun8iw7p1)]] SoC with ARM Cortex-A7 @ 1.2GHz (often over-clocked), and 1 GB of RAM.
 +
 +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://www.orangepi.org/downloadresources/|images]] are quite old (e.g. Android 4.2.2), but there are a bit newer images made available by the community:
 +  * such as [[http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=755|Android]], with weird [[http://www.orangepi.org/Docs/SDcardinstallation.html#Install_Android_OS_image|installation process]]
 +  * various [[http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=342|linux]] distributions
 +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://www.raspberry-projects.com/pi/pi-hardware/raspberry-pi-2-model-b/rpi2-model-b-io-pins|40-pin Raspberry Pi]].
spark_counter.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1