Re: emonTx V2.2 Build Guide
Submitted by santosh.singh on Sat, 10/08/2013 - 08:32.
My EmonTx fails to send RF signals.
I soldered the PCB with components. And then connected it to the IDE using FTDI. I can run my own LED sketches they work fine. But when I used the Emonlib example sketch the Arduino hangs when sendWait is issued.
//CT 1 is always enabled
const int CT2 = 1; // Set to 1 to enable CT channel 2
const int CT3 = 1; // Set to 1 to enable CT channel 3
#define freq RF12_433MHZ // Frequency of RF12B module can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.
const int nodeID = 10; // emonTx RFM12B node ID
const int networkGroup = 210; // emonTx RFM12B wireless network group - needs to be same as emonBase and emonGLCD needs to be same as emonBase and emonGLCD
const int UNO = 1; // Set to 0 if your not using the UNO bootloader (i.e using Duemilanove) - All Atmega's shipped from OpenEnergyMonitor come with Arduino Uno bootloader
#include <avr/wdt.h> // the UNO bootloader
#include <JeeLib.h> // Download JeeLib: http://github.com/jcw/jeelib
ISR(WDT_vect) { Sleepy::watchdogEvent(); }
#include "EmonLib.h"
EnergyMonitor ct1,ct2,ct3; // Create instances for each CT channel
typedef struct { int power1, power2, power3, Vrms; } PayloadTX; // neat way of packaging data for RF comms
PayloadTX emontx;
const int LEDpin = 9; // On-board emonTx LED
unsigned long timer = millis();
void setup()
{
Serial.begin(9600);
Serial.println("emonTX CT123 Voltage example");
Serial.println("OpenEnergyMonitor.org");
Serial.print("Node: ");
Serial.print(nodeID);
Serial.print(" Freq: ");
if (freq == RF12_433MHZ) Serial.print("433Mhz");
if (freq == RF12_868MHZ) Serial.print("868Mhz");
if (freq == RF12_915MHZ) Serial.print("915Mhz");
Serial.print(" Network: ");
Serial.println(networkGroup);
ct1.voltageTX(228.268, 1.7); // ct.voltageTX(calibration, phase_shift) - make sure to select correct calibration for AC-AC adapter http://openenergymonitor.org/emon/modules/emontx/firmware/calibration. Default is set for Ideal Power voltage adapter.
ct1.currentTX(1, 111.1); // Setup emonTX CT channel (channel (1,2 or 3), calibration)
// CT Calibration factor = CT ratio / burden resistance
ct2.voltageTX(234.26, 1.7); // CT Calibration factor = (100A / 0.05A) x 18 Ohms
ct2.currentTX(2, 111.1);
ct3.voltageTX(234.26, 1.7);
ct3.currentTX(3, 111.1);
rf12_initialize(nodeID, freq, networkGroup); // initialize RF
rf12_sleep(RF12_SLEEP);
pinMode(LEDpin, OUTPUT); // Setup indicator LED
digitalWrite(LEDpin, LOW);
if (UNO) wdt_enable(WDTO_8S); // Enable anti crash (restart) watchdog if UNO bootloader is selected. Watchdog does not work with duemilanove bootloader // Restarts emonTx if sketch hangs for more than 8s
}
void loop()
{
if ((millis()-timer)>5000)
{
timer = millis();
ct1.calcVI(20,2000); // Calculate all. No.of crossings, time-out
emontx.power1 = ct1.realPower;
Serial.print(emontx.power1);
emontx.Vrms = ct1.Vrms*100; // AC Mains rms voltage
if (CT2) {
ct2.calcVI(20,2000); //ct.calcVI(number of crossings to sample, time out (ms) if no waveform is detected)
emontx.power2 = ct2.realPower;
Serial.print(" "); Serial.print(emontx.power2);
}
if (CT3) {
ct3.calcVI(20,2000);
emontx.power3 = ct3.realPower;
Serial.print(" "); Serial.print(emontx.power3);
}
Serial.print(" "); Serial.print(ct1.Vrms);
Serial.println(); delay(100);
send_rf_data(); // *SEND RF DATA* - see emontx_li
digitalWrite(LEDpin, HIGH); delay(40); digitalWrite(LEDpin, LOW); // flash LED
emontx_sleep(5); // sleep or delay in seconds - see emontx_lib
}
}
I have modified the code to blink the LED on pin 13. If I comment out send_rf_data() command then the LED blinks.
On further debugging, I found out that rf12_sendWait(2) is blocking and not returning at all. If I comment that line then the blinking is fine.
help please?
I also checked the schematic on http://solderpad.com/openenergymon/emontx/ and compared it with the soldered connections using http://www.hoperf.com/upload/rf/rfm12b.pdf
I found that the SEL pin on RFM12B is not connected to pin 16 of M/Controller. I am not sure if that is change in design?
I also tried to see if IRQ pin number matches the RF12.cpp library definitions.
I will appreciate any feedback on how to verify the setup?
Please suggest best course of action to get this resolved?
»
santosh.singh's picture
Re: emonTx V2.2 Build Guide
Submitted by santosh.singh on Sat, 10/08/2013 - 08:35.
My EmonTx fails to send RF signals.
I soldered the PCB with components. And then connected it to the IDE using FTDI. I can run my own LED sketches they work fine. But when I used the Emonlib example sketch the Arduino hangs when sendWait is issued.
I have modified the code to blink the LED on pin 13. If I comment out send_rf_data() command then the LED blinks.
On further debugging, I found out that rf12_sendWait(2) is blocking and not returning at all. If I comment that line then the blinking is fine.
help please?
I also checked the schematic on http://solderpad.com/openenergymon/emontx/ and compared it with the soldered connections using http://www.hoperf.com/upload/rf/rfm12b.pdf
I found that the SEL pin on RFM12B is not connected to pin 16 of M/Controller. I am not sure if that is change in design?
I also tried to see if IRQ pin number matches the RF12.cpp library definitions.
I will appreciate any feedback on how to verify the setup?
Please suggest best course of action to get this resolved?
Re: emonTx RF issue - question moved from comments
Hi Santosh,
Sorry to hear your having issues. The RFM12B SEL (SS) is connected to digital 10 on the emonTx. You should be able to check the connections with a multimeter. An emonTx port map is here: http://openenergymonitor.org/emon/emontx/reference%20
Double check that you are using the correct JeeLib Arduino library.
If all the connections seem ok there is a chance that the RF module could be faulty. If that is the case we can send you a replacement if you are happy to try and de solder. Or a complete replacement kit (minus the ATmega) if you have not got de-soldering equipment. Please send me a PM if you require a replacement,
Best of luck,
Re: emonTx RF issue - question moved from comments
Glyn, I PM'd Santosh and explained that his post had got missed and that he should have posted here, then locked the thread. I suggested he check the soldering around the RFM12B, but he hasn't replied yet.
Re: emonTx RF issue - question moved from comments
Sorry to bring this old post back, but did you solved the issue? I'm having exactly the same problem.
Thanks
Re: emonTx RF issue - question moved from comments
You have an emonTx V2? I think you need to post full details of what you have and what your problem is.
Re: emonTx RF issue - question moved from comments
Hi
I've have already post it here http://openenergymonitor.org/emon/node/11828 .
But since i've seen this post and wanted to know if there was a solution.
Re: emonTx RF issue - question moved from comments
DON'T double post in that case. It wastes everyone's time.
Re: emonTx RF issue - question moved from comments
I don't think it's a double post. I just wanted to know if there was a solution for the problem on this post. When i first posted i didn't see this one...