Difference between revisions of "EmonTx Arduino Shield"

From OpenEnergyMonitor Wiki
Jump to: navigation, search
(RFM12B Slave Select (SS) Solder Jumper Setting)
(uanwGIYJYKkpCvGY)
Line 1: Line 1:
=emonTx Arduino Shield=
+
I have a project coinmg up where I will want to control a peripheral from an Arduino.Since it is similar to your launcher library ( mostly sending commands, not receiving info), I decided to start there.The board is a CircuitsAtHome 2.0 board.I've installed the USB library and it seems to work  the mouse HID routine sends data.The USBHID_desc routine gives me a report OK.I set up your library and example program. It compiled OK.The first time I ran it, the launcher rotated right and stoppedNow it doesn't respond at all.The missile launcher is OK, since it runs on a PC with the Thunder program.The program runs OK, I get:StartDevice RunningDevice Running  in the monitor window.I have tried it both on a Duemilanove and a Mega.Thoughts on how to continue?
'''An open-hardware wireless energy monitoring Arduino compatible (Duemilanove,Uno and Leonardo) shield.'''
+
 
+
{|
+
[[File:EmonTx Shield top3D.png|400 px|emonTx Shield Front]]
+
[[File:EmonTx_Shield_Back.png|300 px|emonTx Shield Back]]
+
 
+
|}
+
 
+
See non-invasive section of [http://openenergymonitor.org/emon/buildingblocks 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 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.)
+
<nowiki>
+
* </nowiki> with [http://shop.openenergymonitor.com/components/ 9V AC adapter ]
+
 
+
==Design Files & Part List==
+
 
+
{| class="wikitable"
+
!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*
+
|-
+
|}
+
<nowiki>
+
* </nowiki>or 1 x 28 pin header
+
 
+
 
+
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.
+
 
+
'''The emonTx Shield schematic and board design in Eagle CAD format can be viewed and downloaded from the [http://solderpad.com/openenergymon/emontx-shield 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:
+
 
+
 
+
[[File:EmonTxShiledV1.0_front_web.png|200 px|emonTx Shield Top]] [[File:EmonTxShiledV1.0_rear_web.png|200 px|emonTx Shield Top]]
+
 
+
[[File:EmonTx Shield top2D.png|300 px|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.
+
+
 
+
[[File: EmonTxShield solderJumper.jpg|300px]]
+
 
+
 
+
====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 [http://github.com/jcw/jeelib JeeLib library]. '''For standard operation Connected 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 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:
+
 
+
# '''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 [http://github.com/jcw/jeelib JeeLib library]
+
#* In your sketch add the line <code> rf12_set_cs(8) </code> or <code> rf12_set_cs(9) </code> depending on your choosen pin before rf12 initialise in void setup.   
+
#* The steps above work for both Arduino Uno (ATmega328) and Lenoardo (ATmega32u4)
+
 
+
#'''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 <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:
+
 
+
 
+
If you're using an Arduino Uno (ATmega328) add the following to the <code>#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__)</code> section of <code>void rf12_set_cs(uint8_t pin)</code> function in RF12.cpp file:
+
<syntaxhighlight lang="cpp">
+
if (pin==5)
+
{
+
cs_pin = 5;        //PD5
+
#define SS_DDR      DDRD
+
#define SS_PORT    PORTD
+
}
+
</syntaxhighlight>
+
 
+
If you're using an Arduino Leonardo (ATmega32u4) add the following to the <code>#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__)</code> section of <code>void rf12_set_cs(uint8_t pin)</code> function in RF12.cpp file:
+
<syntaxhighlight lang="cpp">
+
if (pin==5)
+
{
+
cs_pin = 6;        //PC6
+
#define SS_DDR      DDRC
+
#define SS_PORT    PORTC
+
}
+
</syntaxhighlight>
+
 
+
====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 [http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless this building block section]
+
 
+
==Port Map==
+
 
+
{| class="wikitable"
+
!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 [https://github.com/openenergymonitor/emonTxFirmware emonTx Firmware examples GitHub Repo]
+
 
+
Follow instructions on the GitHub readme for required Arduino libraries
+

Revision as of 16:37, 17 February 2013

I have a project coinmg up where I will want to control a peripheral from an Arduino.Since it is similar to your launcher library ( mostly sending commands, not receiving info), I decided to start there.The board is a CircuitsAtHome 2.0 board.I've installed the USB library and it seems to work the mouse HID routine sends data.The USBHID_desc routine gives me a report OK.I set up your library and example program. It compiled OK.The first time I ran it, the launcher rotated right and stopped. Now it doesn't respond at all.The missile launcher is OK, since it runs on a PC with the Thunder program.The program runs OK, I get:StartDevice RunningDevice Running in the monitor window.I have tried it both on a Duemilanove and a Mega.Thoughts on how to continue?