Raspberry Pi Energy Monitoring Shield
Hardware Technical Wiki Documentation
- 1 Technical Overview
- 2 emonTx / emonPi Comparison Table
- 3 System Diagram
- 4 Port Map
- 5 Raspberry Pi Compatibility
- 6 Power Supply
- 7 SD Card Image
- 8 Uploading Arduino Firmware
- 9 Connectivity
- 10 Electrical Characteristics
- 11 Open-Hardware Design Files
- 12 Open Development
- 13 Physical Dimensions & Fixtures
- 14 License
- 15 Media
- 16 Environmental & Life Cycle
- 17 Disclaimer
- 2 x CT Current Sensor Inputs - designed for 100A max YHDC clip-on SCT-013-000
- 1 x AC Voltage Input - designed for 9V AC power adapter
- Arduino compatible ATmega328P - sketch upload direct from the Pi via GPIO serial
- RJ45 connector for connecting DS18B20 temperature sensors, IRQ pulse counting sensor, and access to power and spare I/O including analog and PWM
- I2C LCD (16 x 2) with control push button
- Raspberry Pi Shutdown Button
Hands-on overview video of emonPi hardware:
emonTx / emonPi Comparison Table
|'||emonPi V1.5||emonTx V3.4|
|Integrated Raspberry Pi web-connected base-station||YES||NO|
|Number of current CT sensor inputs||2||4 (1 high sensitivity)|
|Number of AC voltage sensor inputs||1||1|
|Powered by AC-AC adapter||NO||YES|
|Requires DC 5V power adapter||YES||NO|
|Status LCD display||YES||NO|
|Powered by batteries||NO||YES|
|Firmware remotely updatable||YES||NO|
|Remote IRQ/AUX/PWM/DS18B20 connection via RJ45||YES||YES|
|Arduino Pin||AVR Special Function||emonPi V1.6 Atmega 328||Raspberry Pi|
|Analog 0 (D14)||AC Voltage|
|Analog 1 (D15)||CT1|
|Analog 2 (D16)||CT2|
|Analog 3 (D17)|
|Analog 4 (D18)||(SDA)|
|Analog 5 (D19)||(SCL)|
|Analog 6 (D20)||RJ45 pin 8 – ADC6 / Dig20|
|Analog 7 (D21)|
|Digital 0||(RXD)||FTDI Tx||GPIO 14 / pin 8|
|Digital 1||(TXD)||FTDI Rx||GPIO 15 / pin 10|
|Digital 2||(int0) PWM||RFM12B/69CW INT / (JP5 – RJ45 pin 7)|
|Digital 3||(int1) PWM||RJ45 pin 6 – Pulse counter|
|Digital 4||RJ45 pin 4 – one-wire DS18B20|
|Digital 5||PWM||Raspi GPIO 17 / Pin 11||GPIO 17 / Pin 11|
|Digital 6||PWM||OOK Tx / (GPIO 18 -Pin 12) V1.6|
|Digital 8||Shutdown PTM Button|
|Digital 9||PWM||emonPi PCB LED|
|Digital 10||(SS) PWM||RFM69CW SEL|
|Digital 11||(MOSI) PWM||RFM69CW SDI|
|Digital 12||(MISO)||RFM69CW SDO|
|Digital 13||(SCK)||RFM69CW SCK|
Raspberry Pi GPIO
|Raspberry Pi GPIO||RasPi Function||emonPi V1.6 ATmega328|
|2 (0 REV1)||I2C||SDA I2C LCD|
|3 (1 REV 1)||I2C||SCL I2C LCD|
|4 (pin 7)||ATmega328 reset|
|14||UART Tx||Dig 0 /Rx|
|15||UART Rx||Dig 1 / Tx|
|17 (pin 11)||Atmega Dig 5 – shutdown signal|
|18 (pin 12)||OKK Tx (V1.6)|
|23 (pin 16)||LCD push button|
|27 (21 REV 1)|
Red dots mark GPIO used by the emonPi:
All unused Raspberry Pi GPIO ports can be used to connect additional peripherals using the double header on the emonPi PCB, make sure to take account of additional current requirements.
Raspberry Pi Compatibility
The emonPi has been designed to with the Raspberry Pi Model B+ and Pi2.
The emonPi will also work on the older Model B, although due to physical differences it won't fit inside the emonPi aluminium case. To use the emonPi on the Model B a 13-pin GPIO extender is required instead of the 20-pin extender included; please leave a note at checkout when ordering.
The emonPi is powered by 5V DC via a mini-B-USB socket. The Raspberry Pi is powered by the emonPi via the GPIO pins. The emonPi board itself runs at 3.3V provided by on on-board voltage regulator. The Raspberry Pi's 3.3V rail is left un-touched by the emonPi.
We recommend at least a 1.2A 5V USB power supply
SD Card Image
Based on Raspbien
Run emonPi install script. See script for details
$ git clone https://github.com/openenergymonitor/emonpi.git
$ cd emonpi
$ sudo ./install
Uploading Arduino Firmware
.hex file can be uploaded:
$ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:sketch_name.hex
For further info see avrdude-rpi readme
RFM69CW RF module (default 433Mhz) is used to receive (and transmit) data from other OpenEnergyMonitor sensor nodes such as emonTx and emonTH temperature & humidity. The JeeLabs JeeLib Arduino library is used as the driver for the RFM69CW module. The ATmega328 on the emonPi runs a modified version of RF12 demo, printing data received by the RFM69CW to the serial port in JeeLabs packet format.
See here from an example controlling a lightwave RF plug
The OKK transmitter footprint is (from left to right): ANT, 5V, D6, GND.
The OKK transmitter data line is connected to Dig 6 of ATmega328 and on the next rev of emonPi V1.6 (yet to be released) the OKK will also be connected directly to to GPIO 18 (pin 12) and the antenna connection of the OOK moudule will be able to be jumpered to share the main SMA emonPi antenna.
This photo shows a OOK module hacked onto the older emonPi V1.5, the white wire connects to OOK RF antenna to the SMA antenna. A separate antenna could be used. :
This is not an Ethernet socket! Do not plug into an Ethernet router, this will cause the emonPi power rail to be shorted. This will be fixed in next rev of emonPi. As a precaution the emonPi V1.5 will be shipped with a protector cap on this RJ45 socket.
The emonPi RJ45 socket can be used to connect multiple DS18B20 temperature sensors, an optical pulse counting sensor or access power rails and aux I/O. An RJ45 breakout sold in our shop allows connection of multiple sensors and or optical pulse counting sensor to the emonPi. E.g. 5 x ds18b20 temperature sensors and an optical pulse sensor can be connected simultaneously to the rj45 port on the emonpi.
The RJ45 uses standard pinout used by other manufacturers of DS18B20 temperate sensing hardware such as Sheep Walker Electronics
A DS18B20 digital temperature sensors can easily be connected by the emonPi by connecting the sensors into the emonPi's RJ45 connector. The default firmware (discrete sampling) supports auto-detecting and reading from of up to six DS18B20 sensors.
Further RJ45 breakouts are available from Sheep Walk Electronics
Many meters have pulse outputs, including electricity meters (single phase, 3-phase, import and export), gas meters, water flow meters etc. The pulse output may be a flashing LED or a switching relay (usually solid state) or both. We recommend using the optical interface where available as this decouples the monitoring equipment from any high/mains voltages.
In the case of an electricity meter, a pulse output corresponds to a certain amount of energy passing through the meter (kWh/Wh). For single-phase domestic electricity meters (eg. Elster A100c) each pulse usually corresponds to 1 Wh (1000 pulses per kWh). For water and gas meters they will usually be marked to show the quantity of water (litres/gallons) or of gas (cubic meters/cubic feet) that each pulse represents.
The standard emonPi has one spare interrupt input (IRQ 1, Dig3) which can be used for pulse counting. This is accessible on the RJ45 socket
The second interrupt IRQ0 is usually used by the RFM69CW module on the emonPi. If the RF module is not present this interrupt can be jumped on the PCB (JP5) to be accessible on RJ45, see below for pin out:
Pin 2 = VCC
Pin 5 = GND
Pin 6 = IRQ1
Pin 7 = IRQ0 (usually used by RFM can be jumpered via JP5)
A ready made pulse counting sensor is available in the OpenEnergyMonitor shop , this sensor comes with an RJ45 connector and will work plug-and-play out of the box with emonPi:
The raw pulse count will need to be multiplied by a scalar to convert to wh in Emoncms. Eg for a meter which outputs 800 pulses per Kwh the raw pulse count should be multipled by (1000/800 = 1.25) before logging to a wh accumulator feed in emoncms. If meter outputs 1000 pulses per Kwh this is already one pulse pulse per wh therefore no scalar multiplier is required.
Adding a Real Time Clock (RTC)
The emonPi updates its internal linux time from NTP when connected to the internet. However if the emonPi is used in an offline network or for an application when accurate time stamp is essential a hardware Real Time Clock (RTC) can easily be added to the Pi's GPIO. We have tested using a DS3231 based RTC module. This RTC module communicates with the emonPi via I2C, it can be easily connected as follows by soldering a four-pin header onto the emonPi aux GPIO pins:
Once connected check it's detected on the I2C bus by running:
sudo i2cdetect -y 1
If the RTC is successfully detected it should return the following:
0x27 is the emonPi's I2C LCD display and 0x68 is the RTC module.
Unused input / output ADC 6 / Digital 20 is available on RJ45 connector for general purpose.
Max / typical
|CT 1-2||Monitoring Power @ 240V||23kW||60kW||Using 22R burden and YHDC SCT-013-00 with 22 turns|
|3.3V Rail current output||When powering with 5V USB||150mA||168mA||Limitation SOT22 MCP1700 Ta=40C Vi=5.25V|
|5V Input Voltage||USB||+3.4V||+6V||+6.5V (see note 1)||See note 1|
|3.3V Supply Voltage||on 3.3V supply rail||2.6V *||3.3V||3.9V *||*ADC readings will be incorrect if Vcc!=3.3V|
|Power Consumption with Raspberry Pi email@example.comV||7mA no RasPi - 14mA RasPi Halted||300mA RasPi idle||500mA+ RasPi Load||With ATmega328, RFM69CW, Edimax WIFI + RasPi2|
Open-Hardware Design Files
Hardware Change Log
- V1.5 - First release KickStarter rewards May-Aug 2015
- V.16 - (prototype July 15)
- Pull back tracks and GND place around mount holes
- Connect OOK to GPIO 18
- Move OOK to top of board to avoid Pi2 connector shorting issue
- Disconnect RJ45 pin 1 and 3 from GND to stop short when Ethernet is inserted
- Add to silkscreen that the diode Cathode (flat line - negative) points upward) on the PCB and the Anode goes to GND (downward)
- Add double side silkscreen for LCD I2C & switch header
- Fix 'designed by' typo on rear silkscreen :-)
The emonPi has been developed with input from the OpenEnergyMonitor community. See origional development OpenEnergyMonitor.org forum thread.
Physical Dimensions & Fixtures
PCB: 99.2mm x 76.1mm
Enclosure: 103mm x 85mm x 99mm
Enclosure Screws: Torx T20
Raspberry Pi fixing kit (Rapid Rapid numbers):
- 4 x 15mm spacer: 33-2040
- 4 x M3 screw: 33-2300
LCD fixing kit (Rapid Rapid numbers):
- 4 x 6mm spacer: 33-2034
- 4 x M3 lock Nut: 33-4402
- 4 x M3 12mm countersunk screw: 33-2955
Enclosure CAD Design :
The emonPi is part of the OpenEnergyMonitor.org project
The hardware designs (schematics and CAD files) are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
The firmware is released under the GNU GPL V3 license
The documentation is subject to GNU Free Documentation License
The hardware designs follow the terms of the OSHW (Open-source hardware) Statement of Principles 1.0
Environmental & Life Cycle
OUR PRODUCTS AND ASSEMBLY KITS MAY BE USED BY EXPERIENCED, SKILLED USERS, AT THEIR OWN RISK. TO THE FULLEST EXTENT PERMISSIBLE BY THE APPLICABLE LAW, WE HEREBY DISCLAIM ANY AND ALL RESPONSIBILITY, RISK, LIABILITY AND DAMAGES ARISING OUT OF DEATH OR PERSONAL INJURY RESULTING FROM ASSEMBLY OR OPERATION OF OUR PRODUCTS.
The OpenEnergyMonitor system is sold as a development kit to empower members of the openenergymonitor community to to get involved with the OpenEnergyMonitor open-source energy monitoring development project.
Your safety is your own responsibility, including proper use of equipment and safety gear, and determining whether you have adequate skill and experience. OpenEnergyMonitor and Megni registered partnership disclaims all responsibility for any resulting damage, injury, or expense. It is your responsibility to make sure that your activities comply with applicable laws, including copyright. Always check the webpage associated with each unit before you get started. There may be important updates or corrections. All use of the instructions, kits, projects and suggestions given both by megni.co.uk, openenergymonitor.org, shop.openenergymonitor.org and wiki.openenergymonitor.org are to be used at your own risk. The technology (hardware , firmware and software) are constantly changing, documentation (including build guide and instructions) may not be complete or correct.
If you feel uncomfortable with assembling or using any part of the kit / unit, please return it to us, we will happy to give a full refund.