EmonTx stops sending data - no led activity until reboot

I have substituted the code in the file “rfm.ino” from the 3-phase sketch, instead of using JeeLib. Reporting once per second, it has now run for about 3½ days - equivalent to about a month of normal use - with no issues. I have not, however, found the true source of the problem.

Those of you suffering lock-ups may wish to try this.

Instructions to replace JeeLib.

Caution: The following instructions will remove some of the functions of the JeeLib library - in particular, the part that prevents the transmitter from sending its payload whilst the radio channel is in use. Therefore, it is possible that an emonTx so modified will ‘jam’ any other node, causing the data from both to be corrupted and lost. It is only safe to do this change if the emonTx is the only sensor node in use.

1.  If you have customised your emonTx sketch, ensure you have a copy.

2.  Download “rfm.ino” which is part of the emonTx 3-phase sketch. GitHub - openenergymonitor/emontx-3phase: emonTx 'approximate' 3-phase firmware

3.  Put “rfm.ino” in the same directory as your emonTx sketch.

4.  Open the Arduino IDE and navigate to that directory. You should see a tab for each file in the main window.

5.  In your emonTx sketch, make the following changes (you may wish to comment out rather than delete)

delete #include <JeeLib.h>
add:

#include <Wire.h>
#include <SPI.h>
#include <util/crc16.h>
#include <OneWire.h>

add above void setup() (change the 2nd line below to #define RF12_868MHZ if appropriate):

#define RFM69CW
#define RF12_433MHZ
#define RFMSELPIN 10
#define RFMIRQPIN 2
#define RFPWR 0x99

delete rf12_initialize(nodeID, RF_freq, networkGroup);
and replace that with:
rfm_init();

delete rf12_sendNow(0, &tmp, sizeof tmp);
and replace that with:
rfm_send((byte *)&emontx, sizeof(emontx), networkGroup, nodeID);
(or rfm_send((byte *)&tmp, sizeof(tmp), networkGroup, nodeID); if the original line had tmp instead of emontx)
(two instances)

delete rf12_sendWait(2);

if present, delete

  else
    rf12_recvDone();

6.  Compile and upload to your emonTx.

1 Like