Two identical Si7021 nodes - one just sending temperature



  • Hey there!
    I'm facing a problem that maybe is totally easy because I'm missing something, but I just can't find the problem.

    I have two identical nodes: Arduino Nano, NRF24L01+, SI7021 Sensor.
    The code on both is identical (see below) for everything but the node-ID.

    For some reason the first node (MY_NODE_ID 1) will just send the temperature value to my gateway, however I can see that the sensor reports the humidity value in the serial debugger.
    With MQTT.fx I can see, that node 2 sends the temperature-data to mygateway1-out/2/1/1/0/0; the humidity-data to mygateway1-out/2/1/0/1/0 and node 1 sends just the temperature to mygateway1-out/1/1/1/0/0, nothing else.

    What am I missing? I'll post the debug-log down below.
    If anyone can help me I'd be really glad.
    Thank you very much in advance!

    Here is the code from the node; in this case with ID 1; the second node has the ID set to 2.

    // Enable debug prints
    #define MY_DEBUG
    #define MY_NODE_ID 1
    
    // Enable REPORT_BATTERY_LEVEL to measure battery level and send changes to gateway
    //#define REPORT_BATTERY_LEVEL
    
    // Enable and select radio type attached 
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
    
    #include <MySensors.h>  
    
    #define CHILD_ID_HUM  0
    #define CHILD_ID_TEMP 1
    
    static bool metric = true;
    
    // Sleep time between sensor updates (in milliseconds)
    static const uint64_t UPDATE_INTERVAL = 10000;
    
    #include <SI7021.h>
    static SI7021 sensor;
    
    #ifdef REPORT_BATTERY_LEVEL
    #include <Vcc.h>
    static uint8_t oldBatteryPcnt = 200;  // Initialize to 200 to assure first time value will be sent.
    const float VccMin        = 1.8;      // Minimum expected Vcc level, in Volts: Brownout at 1.8V    -> 0%
    const float VccMax        = 2.0*1.6;  // Maximum expected Vcc level, in Volts: 2xAA fresh Alkaline -> 100%
    const float VccCorrection = 1.0;      // Measured Vcc by multimeter divided by reported Vcc
    static Vcc vcc(VccCorrection); 
    #endif
    
    void presentation()  
    { 
      // Send the sketch info to the gateway
      sendSketchInfo("TemperatureAndHumidity Si7021", "1.0");
    
      // Present sensors as children to gateway
      present(CHILD_ID_HUM, S_HUM,   "Humidity");
      present(CHILD_ID_TEMP, S_TEMP, "Temperature");
    
      metric = getControllerConfig().isMetric;
    }
    
    void setup()
    {
      while (not sensor.begin())
      {
        Serial.println(F("Sensor not detected!"));
        delay(5000);
      }
    }
    
    
    void loop()      
    {  
      // Read temperature & humidity from sensor.
      const float temperature = float( metric ? sensor.getCelsiusHundredths() : sensor.getFahrenheitHundredths() ) / 100.0;
      const float humidity    = float( sensor.getHumidityBasisPoints() ) / 100.0;
    
    #ifdef MY_DEBUG
      Serial.print(F("Temp "));
      Serial.print(temperature);
      Serial.print(metric ? 'C' : 'F');
      Serial.print(F("\tHum "));
      Serial.println(humidity);
    #endif
    
      static MyMessage msgHum( CHILD_ID_HUM,  V_HUM );
      static MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    
      send(msgTemp.set(temperature, 2));
      send(msgHum.set(humidity, 2));
    
    #ifdef REPORT_BATTERY_LEVEL
      const uint8_t batteryPcnt = static_cast<uint8_t>(0.5 + vcc.Read_Perc(VccMin, VccMax));
    
    #ifdef MY_DEBUG
      Serial.print(F("Vbat "));
      Serial.print(vcc.Read_Volts());
      Serial.print(F("\tPerc "));
      Serial.println(batteryPcnt);
    #endif
    
      // Battery readout should only go down. So report only when new value is smaller than previous one.
      if ( batteryPcnt < oldBatteryPcnt )
      {
          sendBatteryLevel(batteryPcnt);
          oldBatteryPcnt = batteryPcnt;
      }
    #endif
    
      // Sleep until next update to save energy
      sleep(UPDATE_INTERVAL); 
    }
    

    Heres the debug-log from node 1:

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSM:INIT:STATID=1
    37 TSF:SID:OK,ID=1
    39 TSM:FPAR
    75 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    156 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    160 TSF:MSG:FPAR OK,ID=0,D=1
    2082 TSM:FPAR:OK
    2083 TSM:ID
    2084 TSM:ID:OK
    2086 TSM:UPL
    2089 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2104 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2108 TSF:MSG:PONG RECV,HP=1
    2111 TSM:UPL:OK
    2112 TSM:READY:ID=1,PAR=0,DIS=1
    2152 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
    4195 !TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=1,st=NACK:2.3.1
    4238 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=2,st=NACK:0
    6246 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=25,sg=0,ft=3,st=OK:TemperatureAndHumidity Si
    6291 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=NACK:1.0
    6337 !TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=1,st=NACK:Humidity
    6385 !TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=6,pt=0,l=11,sg=0,ft=2,st=NACK:Temperature
    6392 MCO:REG:REQ
    6429 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=3,st=NACK:2
    8436 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=4,st=OK:2
    8448 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    8453 MCO:PIM:NODE REG=1
    8455 MCO:BGN:STP
    8457 MCO:BGN:INIT OK,TSP=1
    Temp 20.02C	Hum 56.63
    8522 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=NACK:20.02
    8567 !TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=1,st=NACK:56.63
    8573 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8579 TSF:TDI:TSL
    8581 MCO:SLP:WUP=-1
    8583 TSF:TRI:TSB
    Temp 20.01C	Hum 56.64
    8651 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=2,st=NACK:20.01
    8696 !TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=3,st=NACK:56.64
    8702 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8708 TSF:TDI:TSL
    8710 MCO:SLP:WUP=-1
    8712 TSF:TRI:TSB
    Temp 20.01C	Hum 56.58
    8744 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=4,st=OK:20.01
    8790 !TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=NACK:56.58
    8796 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8801 TSF:TDI:TSL
    8803 MCO:SLP:WUP=-1
    8805 TSF:TRI:TSB
    


  • @zerosquared
    Imo there's not really a problem with the sensor itself but with the transmission towards the GW.

    8696 !TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=3,st=NACK:56.64
    

    The only exception in your log is wrt one temperature reading. So have a look at the troubleshooting guide; especially use a capacitor to enhance power sourcing of the nRF modules.


Log in to reply
 

Suggested Topics

  • 3
  • 24
  • 2
  • 10
  • 2
  • 2

21
Online

11.2k
Users

11.1k
Topics

112.5k
Posts