EmonTx Arduino Shield

From OpenEnergyMonitor Wiki
Revision as of 00:05, 13 December 2012 by (Talk) (RFM12B Slave Select (SS) Solder Jumper Setting)

Jump to: navigation, search

emonTx Arduino Shield

An open-hardware wireless energy monitoring Arduino compatible (Duemilanove,Uno and Leonardo) shield.

emonTx Shield FrontemonTx Shield Back

See non-invasive section of building blocks for theory behind CT energy monitoring.


  • Apparent Power, Real Power*, Power Factor* and AC RMS voltage readings*
  • 4 x CT Current Sensor input
  • AC 9V RMS voltage sensor input
  • 433/868Mhz RFM12B (HopeRF) wireless transceiver to transmit/receive data to other OpenEnergyMonitor and JeeNode modules
  • On-board DS18B20 digital temperature sensor (not included as standard)
  • Status LED
  • Compatible with Duemilanove,Uno and Leonardo
  • Compatible with OpenEnergyMonitor modules (emonGLCD, emonBase - NannodeRF etc.)

* with 9V AC adapter

Design Files & Part List

Quantity Part
10x 470K (yellow, violet, yellow, gold)
5 x 10uF
4x 33R 1% (orange, orange, black, gold, brown)
4x 10K 1% (brown, black, black, red, brown)
4x 4K7 (yellow, violet, red, yellow, gold)
4x 3.5mm jack (Rapid: 20-0157)
1x 0.1uF (100nF)
1x 470R (yellow, violet, brown, gold)
1x 100K 1% (brown, black, black yellow, brown)
1x 2.1mm DC barrel
1x RFM12B 868/433Mhz (HopeRf)
1x 82mm/165mm Ant
1x 3mm LED
1x DS18B20 temperature sensor (not included as standard)
1x 6 pin ISP header (female)
2x 6 pin header*
2x 8 pin header*

* or 1 x 28 pin header

See OpenEnergyMonitor Shop for recommended CT and recommended plug-in AC-AC adapter

See building blocks for more information on CT's and AC-AC adapters.

The emonTx Shield schematic and board design in Eagle CAD format can be viewed and downloaded from the emonTx Shield SolderPad Git Repo

Build Guide

Follow the component labels on the PCB using the part list above to identify the components and the completed build photo below to double check the correct placement:

emonTx Shield Top emonTx Shield Top

emonTx Shield Top

Hardware Setup Instructions

On the top of the board there are two solder jumpers which need to be connected before emonTx Shield can operate. To make connection the middle solder pad should be connected with a blob of solder to either the left of right solder pad, depending on the connection required. The solder can be re-melted and adjusted at a later date if required.

EmonTxShield solderJumper.jpg

RFM12B Slave Select (SS) Solder Jumper Setting

The left hand solder jumper determines which Arduino digital I/O is used for the RFM12B SS pin. Digital 10 is the default for the JeeLib library. For standard operation Connected the solder jumper to 10 by connecting the middle pad to the left pad shown in the this image.

However if Digital 10 is required by another shield (e.g Arduino Ethernet) another free digital pin can be used for the RFM12B CS pin. There are two options available to do this. The first option requires more hardware modification, while the second requires more software modification. We recommend the first option:

  1. Option 1:
    • Ensure the RFM12B CS pin solder jumper is not connected (middle pad not soldered to either left of right hand pads).
    • Solder a wire from the middle pad (there is a hold available for this, see image above) to either Digital 8 or 9.
    • Make sure you are using the latest JeeLib library
    • In your sketch add the line rf12_set_cs(8) or rf12_set_cs(9) depending on your choosen pin before rf12 initialise in void setup.
    • The steps above work for both Arduino Uno (ATmega328) and Lenoardo (ATmega32u4)
  1. Option 2
    • Digital 5 can be used as the RFM12B CS pin by connecting the solder jumper up the other way.
    • Modifaying the JeeLib library is required since Digital 5 is on a different port
    • For pin 5 to be used as the SS pin the line rf12_set_cs(5) must be added before rf12 initialise in void setup.
    • and the following lines must be added to RF12.cpp in the JeeLib library in the void rf12_set_cs(uint8_t pin) function:

If you're using an Arduino Uno (ATmega328) add the following to the #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) section of void rf12_set_cs(uint8_t pin) function in RF12.cpp file:

if (pin==5)
	 	cs_pin = 5;         //PD5
		#define SS_DDR      DDRD
		#define SS_PORT     PORTD

If you're using an Arduino Leonardo (ATmega32u4) add the following to the #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) section of void rf12_set_cs(uint8_t pin) function in RF12.cpp file:

if (pin==5)
	 	cs_pin = 6;         //PC6
		#define SS_DDR      DDRC
		#define SS_PORT     PORTC

RFM12B Interrupt Solder Jumper Setting

The right hand solder jumper sets the RFM12B interrupt pin. The setting of this jumper depends on which Arduino board the shield is connected. Connect the jumper to Digital 2 for Arduino Uno/Duemilanove or Digital 3 for Arduino Leonardo. These pins connect to the special hardware interrupt pin INT0.

For more information on RFM12B connection to Arduino see this this building block section

Port Map

Function Arduino Port
9V AC sample ADC0
CT 1-4 ADC 1-4
DS18B20 Temperature Dig4
LED Dig9
RFM12B SS Dig10 (recommended) / Dig5
RFM12B INT Dig3 Leonardo / Dig2 Uno

Example Arduino Sketches

See emonTx Shield Folder in emonTx Firmware examples GitHub Repo

Follow instructions on the GitHub readme for required Arduino libraries