Difference between revisions of "EmonTx Arduino Shield"

From OpenEnergyMonitor Wiki
Jump to: navigation, search
(Hardware Setup Instructions)
(spelling/punctuation corrections)
Line 1: Line 1:
 
=emonTx Arduino Shield=
 
=emonTx Arduino Shield=
'''An open-hardware wireless energy monitoring Arduino compatible (Duemilanove,Uno and Leonardo) shield.'''  
+
'''An open-hardware wireless energy monitoring Arduino compatible shield.'''  
  
 
{|
 
{|
Line 11: Line 11:
 
==Overview==
 
==Overview==
 
*Apparent Power, Real Power*, Power Factor* and AC RMS voltage readings*  
 
*Apparent Power, Real Power*, Power Factor* and AC RMS voltage readings*  
*4 x CT Current Sensor input
+
*4 x CT Current Sensor inputs
 
*AC 9V RMS voltage sensor input
 
*AC 9V RMS voltage sensor input
 
*433/868Mhz RFM12B  / RFM69CW(HopeRF) wireless transceiver to transmit/receive data to other OpenEnergyMonitor and JeeNode modules
 
*433/868Mhz RFM12B  / RFM69CW(HopeRF) wireless transceiver to transmit/receive data to other OpenEnergyMonitor and JeeNode modules
Line 25: Line 25:
 
See OpenEnergyMonitor Shop for [http://shop.openenergymonitor.com/100a-max-clip-on-current-sensor-ct recommended CT] and [http://shop.openenergymonitor.com/components/ recommended plug-in AC-AC adapter]
 
See OpenEnergyMonitor Shop for [http://shop.openenergymonitor.com/100a-max-clip-on-current-sensor-ct recommended CT] and [http://shop.openenergymonitor.com/components/ recommended plug-in AC-AC adapter]
  
See [http://openenergymonitor.org/emon/buildingblocks building blocks] for more information on CT's and AC-AC adapters.
+
See [http://openenergymonitor.org/emon/buildingblocks building blocks] for more information on CTs and AC-AC adapters.
  
'''The emonTx Shield schematic and board design in Eagle CAD format can be viewed and downloaded from the [http://solderpad.com/openenergymon emonTx Shield SolderPad Git Repo]'''
+
'''The emonTx Shield schematic and board design, in Eagle CAD format, can be viewed and downloaded from the [http://solderpad.com/openenergymon emonTx Shield SolderPad Git Repo]'''
  
 
==Build Guide==
 
==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. If you are going to use a current transformer with an internal burden resistor (e.g. the YHDC SCT-013-030 or another "voltage output" type), do not fit the 33 Ω resistor for that input channel:  
+
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 correct component placement. If you are going to use a current transformer with an internal burden resistor (e.g. the YHDC SCT-013-030 or another "voltage output" type), do not fit the 33 Ω resistor for that input channel:  
  
  
Line 42: Line 42:
  
  
On the top of the board there are two solder jumpers (older boards only) which '''need to be connected before emonTx Shield can operate'''. On later boards, these have been replaced by header pins and jumper links.
+
On the top of the board, there are two solder jumpers (older boards only) which '''need to be connected before the emonTx Shield can operate'''. On later boards, these have been replaced by header pins and jumper links.
 
   
 
   
  
Line 52: Line 52:
  
  
The left hand solder jumper determines which Arduino digital I/O is used for the RFM SS pin. Digital 10 is the default for the [http://github.com/jcw/jeelib JeeLib library]. '''For standard operation Connect the solder jumper to 10 by connecting the middle pad to the left pad shown in the [http://wiki.openenergymonitor.org/index.php?title=File:EmonTx_Shield_top2D.png this image]. '''
+
The left hand solder jumper determines which Arduino digital I/O is used for the RFM SS pin. Digital 10 is the default for the [http://github.com/jcw/jeelib JeeLib library]. '''For standard operation, connect the solder jumper to 10 by connecting the middle pad to the left pad shown in the [http://wiki.openenergymonitor.org/index.php?title=File:EmonTx_Shield_top2D.png this image]. '''
  
  
However if Digital 10 is required by another shield (e.g Arduino Ethernet) another free digital pin can be used for the RFM 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:
+
However if Digital 10 is required by another shield (e.g Arduino Ethernet) another free digital pin can be used for the RFM CS pin. There are two options available. The first option requires hardware modification, the second requires software modification. We recommend the first option:
  
 
# '''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).
+
#* Ensure the RFM12B CS pin solder jumper is not connected (middle pad not soldered to either left or right pads).
 
#* Solder a wire from the middle pad to either Digital 8 or 9. There is a hole available for this, see the image above.
 
#* Solder a wire from the middle pad to either Digital 8 or 9. There is a hole available for this, see the image above.
 
#* Make sure you are using the latest [http://github.com/jcw/jeelib JeeLib library]
 
#* Make sure you are using the latest [http://github.com/jcw/jeelib JeeLib library]
Line 65: Line 65:
  
 
#'''Option 2'''
 
#'''Option 2'''
#* Digital 5 can be used as the RFM CS pin by connecting the solder jumper up the other way.  
+
#* Digital 5 can be used as the RFM CS pin by connecting the solder jumper the other way.  
 
#* Modifying the JeeLib library is required since Digital 5 is on a different port
 
#* Modifying 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 <code> rf12_set_cs(5) </code> must be added before rf12 initialise in void setup.  
+
#* For pin 5 to be used as the CS pin the line <code> rf12_set_cs(5) </code> 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 <code> void rf12_set_cs(uint8_t pin) </code>function:
+
#* The following lines must be added to RF12.cpp in the JeeLib library in the <code> void rf12_set_cs(uint8_t pin) </code>function:
  
  
Line 124: Line 124:
  
  
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.
+
The right hand solder jumper sets the RFM12B interrupt pin. The setting of this jumper depends on which Arduino board the shield is connected to. '''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 [http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless this building block section]
+
For more information on RFM12B connection to Arduino, see this [http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless this building block section]
 
For RFM69CW see [openenergymonitor.org/emon/buildingblocks/RFM69cw this building block section]
 
For RFM69CW see [openenergymonitor.org/emon/buildingblocks/RFM69cw this building block section]
  
 
===Arduino Compatibility===
 
===Arduino Compatibility===
  
Some Arduino clone boards that have on-board Ethernet (e.g. one made by Freetronics in Australia) and some Ethernet Shields appear to use Analog I/O for purposes connected with the Ethernet controller. This is not compatible with the use of that analogue input(s) for voltage or current measurements. On the Freetronics unit, it appears that there are pull-up resistors for the MAC address chip attached to A4 and A5 that can be disconnected by cutting track jumpers, which when cut disable MAC addressing but enable proper use of CT 4 input for current measurements.
+
Some Arduino clone boards that have on-board Ethernet (e.g. The Australian-made Freetronics) and some Ethernet Shields appear to use Analog I/O for purposes connected with the Ethernet controller. This is not compatible with the use of that analogue input(s) for voltage or current measurements. On the Freetronics unit, it appears there are pull-up resistors for the MAC address chip attached to A4 and A5 that can be disconnected by cutting track jumpers to disable MAC addressing, but enable use of CT 4 input for current measurements.
 
More details can be found here:
 
More details can be found here:
 
[http://forum.freetronics.com/viewtopic.php?f=4&t=6024 freetronics forum] and  
 
[http://forum.freetronics.com/viewtopic.php?f=4&t=6024 freetronics forum] and  

Revision as of 04:15, 20 August 2015

emonTx Arduino Shield

An open-hardware wireless energy monitoring Arduino compatible shield.

emonTx Shield Front

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

Overview

  • Apparent Power, Real Power*, Power Factor* and AC RMS voltage readings*
  • 4 x CT Current Sensor inputs
  • AC 9V RMS voltage sensor input
  • 433/868Mhz RFM12B / RFM69CW(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

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

See building blocks for more information on CTs 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 correct component placement. If you are going to use a current transformer with an internal burden resistor (e.g. the YHDC SCT-013-030 or another "voltage output" type), do not fit the 33 Ω resistor for that input channel:


emonTx Shield Top emonTx Shield Top

RFM69CW


Hardware Setup Instructions

On the top of the board, there are two solder jumpers (older boards only) which need to be connected before the emonTx Shield can operate. On later boards, these have been replaced by header pins and jumper links.


EmonTxShield solderJumper.jpg


RFM12B / RFM69CW Slave Select (SS) Solder Jumper Setting

The left hand solder jumper determines which Arduino digital I/O is used for the RFM SS pin. Digital 10 is the default for the JeeLib library. For standard operation, connect 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 RFM CS pin. There are two options available. The first option requires hardware modification, the second requires 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 or right pads).
    • Solder a wire from the middle pad to either Digital 8 or 9. There is a hole available for this, see the image above.
    • 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 chosen 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 RFM CS pin by connecting the solder jumper the other way.
    • Modifying the JeeLib library is required since Digital 5 is on a different port
    • For pin 5 to be used as the CS pin the line rf12_set_cs(5) must be added before rf12 initialise in void setup.
    • 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), in the file RF12.cpp, replace the entire function "void rf12_set_cs(uint8_t pin)" with this:

void rf12_set_cs(uint8_t pin)
{
#if defined(__AVR_ATmega32U4__)     //Arduino Leonardo
  if (pin==10) cs_pin=6;      // Dig10, PB6    
  if (pin==9)  cs_pin=5;      // Dig9,  PB5
  if (pin==8)  cs_pin=4;      // Dig8,  PB4           
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined (__AVR_ATmega328P__) // ATmega168, ATmega328
  if (pin==10) cs_pin = 2;      // Dig10, PB2
  if (pin==9) cs_pin = 1;       // Dig9,  PB1
  if (pin==8) cs_pin = 0;       // Dig8,  PB0
  if (pin==5)
  {
    cs_pin = 5;         //PD5
    #define SS_DDR      DDRD
    #define SS_PORT     PORTD
  }

#endif
}


If you're using an Arduino Leonardo (ATmega32u4), in the file RF12.cpp, replace the entire function "void rf12_set_cs(uint8_t pin)" with this:

void rf12_set_cs(uint8_t pin)
{
#if defined(__AVR_ATmega32U4__)     //Arduino Leonardo
  if (pin==10) cs_pin=6;      // Dig10, PB6    
  if (pin==9)  cs_pin=5;      // Dig9,  PB5
  if (pin==8)  cs_pin=4;      // Dig8,  PB4           
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined (__AVR_ATmega328P__) // ATmega168, ATmega328
  if (pin==10) cs_pin = 2;      // Dig10, PB2
  if (pin==9) cs_pin = 1;       // Dig9,  PB1
  if (pin==8) cs_pin = 0;       // Dig8,  PB0
  if (pin==5)
  {
    cs_pin = 6;         //PD6
    #define SS_DDR      DDRC
    #define SS_PORT     PORTC
  }

#endif
}

RFM12B / RFM69CW 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 to. 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 For RFM69CW see [openenergymonitor.org/emon/buildingblocks/RFM69cw this building block section]

Arduino Compatibility

Some Arduino clone boards that have on-board Ethernet (e.g. The Australian-made Freetronics) and some Ethernet Shields appear to use Analog I/O for purposes connected with the Ethernet controller. This is not compatible with the use of that analogue input(s) for voltage or current measurements. On the Freetronics unit, it appears there are pull-up resistors for the MAC address chip attached to A4 and A5 that can be disconnected by cutting track jumpers to disable MAC addressing, but enable use of CT 4 input for current measurements. More details can be found here: freetronics forum and OpenEnergyMonitor forum


Example Arduino Sketches

See emonTx Shield Folder in emonTx Firmware examples GitHub Repo

Follow instructions on the GitHub readme for required Arduino libraries