Community
OpenEnergyMonitor

Community

emonGLCD time not updating


(chris_cronin) #1

I’ve updated my old nanodeRF to an emonBasePi but the emonGLCD is not updating the time (the LCD shows ‘emonBase fail’).
The commented out section in ‘void power_calculations()’ is to stop the resetting of wh_gen & wh_consuming to zero during the day (not at 00:00).
Is the RTC code in the nanodeRF different than the emonBasePi?

My_latest_emonGLCD_SolarPV_3_3_2019_1.ino (17.0 KB)


(Robert Wall) #2

Have you looked in emonhub.conf?

You need to turn on the time transmission in there:

[interfacers]
### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
        com_baud = 38400                        # 9600 for old RFM12Pi
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        subchannels = ToRFM12,

        group = 210
        frequency = 433
        baseid = 5                              # emonPi / emonBase nodeID
        quiet = true                            # Report incomplete RF packets (no implemented on emonPi)
        calibration = 230V                      # (UK/EU: 230V, US: 110V)
        # interval =  0                         # Interval to transmit time to emonGLCD (seconds)

change “interval” to a suitable number - 60? 300?


(chris_cronin) #3

I changed the interval to 60, saved emonhub.conf, restarted emonBasePi but still getting ‘emonBase fail’


(Robert Wall) #4

You’re probably looking for the emonBase on Node 15. Sorry, I forgot the standard had been changed. Take a look at your emonGLCD sketch. The node ID is hard coded (BAD idea) near the top of the main loop:

void loop()
{

  if (rf12_recvDone())
  {
    if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)  // and no rf errors
    {
      int node_id = (rf12_hdr & 0x1F);
      if (node_id == 10) {emontx = *(PayloadTX*) rf12_data; last_emontx = millis();}  //Assuming 10 is the emonTx NodeID

      if (node_id == 15)			//Assuming 15 is the emonBase node ID
      {
        RTC.adjust(DateTime(2012, 1, 1, rf12_data[1], rf12_data[2], rf12_data[3]));
        last_emonbase = millis();
      }
    }
  }

The if (node_id == 15) bit needs to be changed to if (node_id == 5)


(chris_cronin) #5

changed as suggested but still the same problem.
This is my section of code in void loop():

if (rf12_recvDone())
{
  if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)  // and no rf errors
  {
    int node_id = (rf12_hdr & 0x1F);
    
    if (node_id == emonTx_nodeID)             // === EMONTX node ID (default = 10) ====
    {
      emontx = *(PayloadTX*) rf12_data;       // get emontx payload data
      last_emontx = millis();                 // set time of last update to now
      
      print_emontx_payload();                 // print data to serial
             
      delay(100);                             // delay to make sure printing finished
      power_calculations();                   // do the power calculations
    }      
    
    if (node_id == emonBase_nodeID)           // ==== EMONBASE node ID (default = 5) ====
    {
      emonbase = *(PayloadBase*) rf12_data;   // get emonbase payload data
       
      print_emonbase_payload();               // print data to serial
      
      RTC.adjust(DateTime(2012, 1, 1, rf12_data[0],rf12_data[1],rf12_data[2]));               //emonbase.hour, emonbase.mins, emonbase.sec));  // adjust emonglcd software real time clock
      last_emonbase = millis();
   
      
      delay(100);                             // delay to make sure printing and clock setting finished
       
      emonglcd.temperature = (int) (temp * 100);                          // set emonglcd payload
      int i = 0; while (!rf12_canSend() && i<10) {rf12_recvDone(); i++;}  // if ready to send + exit loop if it gets stuck as it seems too
      rf12_sendStart(0, &emonglcd, sizeof emonglcd);                      // send emonglcd data
      rf12_sendWait(0);
      
      Serial.println("3 emonglcd sent");                                  // print status
                                  
    }
  }
}

(Robert Wall) #6

I’m struggling. If emonBase_nodeID has the value 5, that should work.

Try my debugger sketch:

emonGLCD_Debug.ino (9.2 KB)

Load this into your emonGLCD, it will show what is being received. It makes no attempt to fully decode the data, but as it displays the data as hex bytes, char, signed integer and unsigned long, you should be able to make a good guess as to what the format is. You will need to add
#define RF69_COMPAT 1
above
#include <JeeLib.h>
if you are using an RFM69CW radio. (My old emonGLCD has the RFM12B.)

Read the comments for instructions.
(If it misses a message, don’t worry - it does from time to time. I need to speed up how it writes to the display.)

This should show messages wherever they come from, and you’ll be able to see if the emonBase is actually transmitting, and what it is sending.


(chris_cronin) #7

On my GLCD I’m seeing:
node: 10 433MHz count: 14
xx xx xx xx xx xx xx xx xx xx xx xx (changing Hex values?)

char:158 Byte: 0
int: 671 Bytes:0 -1
ulong: 671 Bytes:0 -3
The values in the LH column change but those in the RH column stay the same

Don’t forget I’m not a coder

ps the green led’s flash evry 5s the red led’s don’t flash at all


(Robert Wall) #8

That’s really of no interest - it’s saying that you have 671 W on CT1 of your emonTx.
(You step through the message, byte by byte, with the up & down buttons. The RH side tells you where you are in the string.)

So the emonBase is not transmitting - you should be seeing something from Node 5 - but you’ll need to wait for a minute to see it, and it will disappear as soon as Node 10 transmits again.
There’s a green flash for every message received. So you should see 13 flashes per minute - 12 evenly spaced every 5 s from your emonTx, and somewhere in that stream an extra one from the emonBase, also regularly but at 1 minute intervals.

I don’t know the emonPi/emonBase/emonHub well enough to suggest what to look at next.


(chris_cronin) #9

The 3 buttons on the RH side of my emonGLCD do nothing!
Thanks Robert (I’m out of my depth here)


(Robert Wall) #10

They should do - I’ve absolutely no idea why they don’t.

A quick recap - is this correct?
You swapped your NanodeRF for an emonBase (= Raspberry Pi + RFM69Pi)
You’re running the “shop” SD emonCMS on it.
You’re seeing the data from your emonTx both in emonCMS and on the GLCD.
You’re not getting the time from the emonBase.
With the ‘debugger’ sketch in the GLCD, you’re only seeing transmissions from the emonTx.


(chris_cronin) #11

Correct.
I sent the output of your sketch emonGLCD_debug to the serial port & there is no data from node 5 (emonBasePi), only node 10 (emonTx)


(Robert Wall) #12

We need someone who knows how to make the emonBase transmit. There have been recent changes - someone pushed through a change that transmitted the emonPi’s data, I don’t know whether it’s been incorporated in the standard software, or whether that has broken the time transmissions from the emonBase, but it needs looking into.


(chris_cronin) #13

Thanks Robert. Hopefully someone out there knows where to go from here


(Robert Wall) #14

You did delete the hash ‘#’ at the beginning of that line, didn’t you?

        # interval =  0                         # Interval to transmit time to emonGLCD (seconds)

so that it reads

        interval =  60                        # Interval to transmit time to emonGLCD (seconds)

(chris_cronin) #15

Bingo! that sorted it. :slight_smile: Now if it had been // instead of # I might have spotted it (told you I wasn’t a coder)
Thanks for all your help Robert


(Robert Wall) #16

What beats my logic is why that line needed to be commented, when AFAIK, ‘0’ means don’t do it anyway. :roll_eyes:

Different programs use different characters to denote a comment. The safe way is to look for an obvious comment and see what’s being used.

e.g. Bloody Awful Set of Interpreted Commands uses a single quote ’


(chris_cronin) #17

Since interval = 60 (seconds) could interval = 0 means the time is transmitted continously (every 0 seconds) Just a thought.
I’ve only come across REM & // for commenting out lines


(Robert Wall) #18

So why isn’t a sensible default set - 30, 60, 300 - in the value instead of zero? I don’t know. If I’d written it, I’d have used 0 as a special value meaning ‘No transmit’.


(Bill Thomson) #19

[quote=“Robert.Wall, post:16, topic:10343”]
Bloody Awful Set of Interpreted Commands

thumbsup


(chris_cronin) #20

Just tried setting interval = 0. The time on page 2 of the emonGLCD continues to update but time on page 1 is replaced with ‘emonBase fail’. Curiouser & curiouser