Waspmote P&S Smart Cities showiing fasle sensor data

New sensors integration, sensor boards usage...
Post Reply
syedasad
Posts: 9
Joined: Sun Dec 04, 2016 2:27 pm

Waspmote P&S Smart Cities showiing fasle sensor data

Post by syedasad » Tue Nov 26, 2019 3:14 pm

Mote : Smart Cities PRO
Sensors:
• Noise Level Sensor (Socket A)
• CO Sensor 9371-LC-P (Socket B)
• CO2 Sensor 9372-P (Socket C)
• Temp Humidity and Pressure Sensor 9370-P (Socket E)
• O2 Sensor 9373-P (Socket F)
Connectivity: LoRaWAN

We connected the sensors as per the above specifications and programmed the Waspmote P&S.

The sensor data was showing real values for 2 weeks and all of a sudden started showing false readings for gas sensors and THP. Upon reseting the plug and sense the correct readings were restored. May i know what could be the possible issue to have these false reading all of a sudden.

Code: Select all

#include <WaspSensorCities_PRO.h>
#include <WaspFrame.h>

#define NID_MAX   999
#define NID_MIN   0
#define NOISE_MAX 100
#define NOISE_MIN 49
#define TEMP_MAX  65
#define TEMP_MIN  0
#define HUM_MAX   100
#define HUM_MIN   0
#define PRES_MAX  110
#define PRES_MIN  30
#define O2_MAX    30
#define O2_MIN    0
#define CO_MAX    500
#define CO_MIN    0
#define CO2_MAX   5000
#define CO2_MIN   0
#define BAT_MAX   100
#define BAT_MIN   0
#define TIMER_MIN 5
#define TIMER_MAX 1440

//EEPROM parameters address map ======================
  // WARNING: Reserved EEMPROM addresses below @1024
  // Utils.writeEEPROM do not let the user to write 
  // below this address.
  // Do not try to write below this address as 
  // you could over-write important configuration
  // --> Available addresses: from 1024 to 4095
#define EEPROM_TOTAL_BYTES  36
#define EEPROM_MAGIC_BYTE   0x55

#define EEPROM_CSUM    1024

#define NODE_ID        0 // 0~999 => 2 bytes

//noise 50~100 => 1 byte
#define NOISE_ALARM    2
#define NOISE_UPPER    3
#define NOISE_LOWER    4
#define NOISE_THR_CNT  5

//temp 0~65 => 1 byte
#define TEMP_ALARM     6
#define TEMP_UPPER     7
#define TEMP_LOWER     8
#define TEMP_THR_CNT   9

//humidity 0~100 => 1 byte
#define HUM_ALARM      10
#define HUM_UPPER      11
#define HUM_LOWER      12
#define HUM_THR_CNT    13

//pressure 100 => 1 byte
#define PRES_ALARM     14
#define PRES_UPPER     15
#define PRES_LOWER     16
#define PRES_THR_CNT   17

//o2 0~100 => 1 byte
#define O2_ALARM       18
#define O2_UPPER       19
#define O2_LOWER       20
#define O2_THR_CNT     21

//co => 2 bytes
#define CO_ALARM       22
#define CO_UPPER       23
#define CO_LOWER       24
#define CO_THR_CNT     25

//co2 => 2 bytes
#define CO2_ALARM      26
#define CO2_UPPER      27
#define CO2_LOWER      28
#define CO2_THR_CNT    29

//battery 0-100 => 1 byte
#define BAT_ALARM      30
#define BAT_UPPER      31
#define BAT_LOWER      32
#define BAT_THR_CNT    33

#define REPORT_TIMER   34 // 2 bytes

#define NOISE 0
#define TEMP  1
#define HUMI  2
#define PRES  3
#define O2    4
#define CO    5
#define CO2   6
#define BAT   7


uint8_t alarm[]={NOISE_ALARM, TEMP_ALARM, HUM_ALARM, PRES_ALARM, O2_ALARM, CO_ALARM, CO2_ALARM, BAT_ALARM};
uint8_t upper[]={NOISE_UPPER, TEMP_UPPER, HUM_UPPER, PRES_UPPER, O2_UPPER, CO_UPPER, CO2_UPPER, BAT_UPPER};
uint8_t lower[]={NOISE_LOWER, TEMP_LOWER, HUM_LOWER, PRES_LOWER, O2_LOWER, CO_LOWER, CO2_LOWER, BAT_LOWER};
uint8_t th_val[]={NOISE_THR_CNT, TEMP_THR_CNT, HUM_THR_CNT, PRES_THR_CNT, O2_THR_CNT, CO_THR_CNT, CO2_THR_CNT, BAT_THR_CNT};
uint8_t th_cnt[8], alarm_flag, last_alarm_flag;
float readings[8];
void(*reset)(void) = 0;
uint8_t vars[]={0,1,
                    1,90,0,2,     //NOISE
                    0,30,20,5,    //TEMP
                    0,70,40,5,    //HUMI
                    0,110,90,5,   //PRES
                    2,26,17,5,    //O2
                    1,0x3,0x20,5, //CO
                    1,0xF,0xA0,5, //CO2
                    2,0,30,3,     //BAT
                    0,30};
/*
   Define object for sensor: gas_sensor
   Input to choose board socket.
   Waspmote OEM. Possibilities for this sensor:
    - SOCKET_1
    - SOCKET_3
    - SOCKET_5
   P&S! Possibilities for this sensor:
    - SOCKET_B
    - SOCKET_C
    - SOCKET_F
*/
Gas O2gas_sensor(SOCKET_F);
Gas COgas_sensor(SOCKET_B);
Gas CO2gas_sensor(SOCKET_C);

/*
   Waspmote OEM. Possibilities for this sensor:
    - SOCKET_1
    - SOCKET_2
    - SOCKET_3
    - SOCKET_4
    - SOCKET_5
   P&S! Possibilities for this sensor:
    - SOCKET_A
    - SOCKET_B
    - SOCKET_C
    - SOCKET_E
    - SOCKET_F
*/
bmeCitiesSensor bme(SOCKET_E);

unsigned long current_millis = 0, report_millis;
int status;
char node_ID[] = "ID:001";
char sleep_timer[] = "00:00:02:10";
char hex_ascii[] = {0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15};

#define COMM
//#define SLEEP
#define SENSORS_ALWAYS_ON
#define SENSOR_CITIES_PRO_BAT 52
#define SENSOR_CITIES_PRO_PS  128 //pressure
#ifdef COMM
#include <WaspLoRaWAN.h>

//////////////////////////////////////////////
uint8_t socket = SOCKET0;
//////////////////////////////////////////////

// Device parameters for Back-End registration
////////////////////////////////////////////////////////////
char DEVICE_EUI[]  = "0004A30B00E9AF73";
char DEVICE_ADDR[] = "00000007";
char NWK_SESSION_KEY[] = "01020304050607080910111213141516";
char APP_SESSION_KEY[] = "000102030405060708090A0B0C0D0E0F";
char APP_KEY[] = "000102030405060708090A0B0C0D0E0F";
////////////////////////////////////////////////////////////
// Define port to use in Back-End: from 1 to 223
uint8_t PORT = 1;
// variable
uint8_t error, send_config=0;
#endif

void setup()
{
#ifdef COMM
  setup_lorawan_configmodule();
  //setup_lorawan_configchannel();
  setup_lorawan_power();
  //setup_lorawan_datarate();
  //setup_lorawan_ADR();
#endif
#ifdef SENSORS_ALWAYS_ON
  bme.ON();
  O2gas_sensor.ON();
  COgas_sensor.ON();
  CO2gas_sensor.ON();
  USB.ON();
  noise.configure();
#endif
  init_vars();
  USB.println(RTC.getTime());
  USB.println(F("Program started!"));
  current_millis = millis() - report_millis + (unsigned long)90000;
}
// 20 loops = 3min. --- 1 loop = 9sec.  --- threshold time = 30 sec. = 3 loops
// 20 loops => 150000 millis --- 1 loop => 7500 millis 3min 225000
void loop()
{
  ///////////////////////////////////////////
  // 1. Read Temperature, humidity and pressure sensor (BME)
  ///////////////////////////////////////////
  // switch off gas sensor for better performance
#ifndef SENSORS_ALWAYS_ON
  O2gas_sensor.OFF();
  COgas_sensor.OFF();
  CO2gas_sensor.OFF();
  // switch on BME sensor (temperature, humidity and pressure)
  bme.ON();
#endif
  // Read enviromental variables
  readings[TEMP] = bme.getTemperature();
  readings[HUMI] = bme.getHumidity();
  readings[PRES] = bme.getPressure();

#ifndef SENSORS_ALWAYS_ON
  // switch off BME sensor (temperature, humidity and pressure)
  bme.OFF();
  // switch on gas sensor again
  O2gas_sensor.ON();
  COgas_sensor.ON();
  CO2gas_sensor.ON();
  ///////////////////////////////////////////
  // 2. Wait heating time
  ///////////////////////////////////////////

  // Sensors need time to warm up and get a response from gas
  // To reduce the battery consumption, use deepSleep instead delay
  // After 2 minutes, Waspmote wakes up thanks to the RTC Alarm
  // USB.println();
  // USB.println(F("Enter deep sleep mode to wait for sensors heating time..."));
  PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
  USB.ON();
#endif
  // USB.println(F("wake up!!\r\n"));
  ///////////////////////////////////////////
  // 3. Read gas sensor
  ///////////////////////////////////////////
  // Read the electrochemical sensor and compensate with the temperature internally
  readings[O2] = O2gas_sensor.ppm2perc(O2gas_sensor.getConc(readings[TEMP]));
  readings[CO] = COgas_sensor.getConc(readings[TEMP]);
  readings[CO2] = CO2gas_sensor.getConc(readings[TEMP]);
  // And print the values via USB
  // USB.println(F("***************************************"));
  USB.ON();
  USB.print(F("O2: "));
  USB.printFloat(readings[O2], 3);
  USB.print(F(" % | "));
  USB.print(F("CO: "));
  USB.printFloat(readings[CO], 3);
  USB.print(F(" ppm | "));
  USB.print(F("CO2: "));
  USB.printFloat(readings[CO2], 3);
  USB.print(F(" ppm | "));
  USB.print(F("Temp.: "));
  USB.printFloat(readings[TEMP], 3);
  USB.print(F(" C | "));
  USB.print(F("RH: "));
  USB.printFloat(readings[HUMI], 3);
  USB.print(F(" % | "));
  USB.print(F("Pres: "));
  USB.printFloat(readings[HUMI], 3);
  USB.print(F(" Pa | "));

  // Get a new measure of the SPLA from the noise sensor
  //noise.configure();
  status = noise.getSPLA(FAST_MODE);
  USB.print(F("Noise: "));
  if (status == 0)
  {
    readings[NOISE] = noise.SPLA;
    USB.print(noise.SPLA);
    USB.print(F(" dBA | "));
  }
 else
  {
    USB.print(F("ERROR dBA | "));
  }

  ///////////////////////////////////////////
  // 4. Read battery level
  ///////////////////////////////////////////
  // Show the remaining battery level
  readings[BAT] = PWR.getBatteryLevel();
  USB.print(F("Bat.: "));
  USB.print(readings[BAT],DEC);
  USB.println(F(" %"));
  
  // Show the battery Volts
  // USB.print(F(" | Battery (Volts): "));
  // USB.print(PWR.getBatteryVolts());
  // USB.println(F(" V"));

  ///////////////////////////////////////////
  // 5. Publish readings
  ///////////////////////////////////////////
  check_alarms();
  #ifdef COMM
  if( millis() - current_millis > report_millis){
    loop_lorawan();
    current_millis = millis();
    last_alarm_flag = alarm_flag;
  }
  else if(last_alarm_flag != alarm_flag){
    loop_lorawan();
    last_alarm_flag = alarm_flag;
  }else if(send_config){
    loop_lorawan();
  }
  #endif
  
  // USB.println(F("***************************************"));
#ifdef SLEEP
  ///////////////////////////////////////////
  // 6. Enter deep sleep mode
  ///////////////////////////////////////////  
  // After 30 seconds, Waspmote wakes up thanks to the RTC Alarm
  USB.print(F("Enter deep sleep mode for: "));
  USB.println(sleep_timer);
  PWR.deepSleep(sleep_timer, RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
  USB.ON();
  USB.println(F("wake up!!"));
#endif
}

void init_vars()
{
  int i, val;
  
  val = Utils.readEEPROM(1024);
  if(val == EEPROM_MAGIC_BYTE){
    USB.print(F(">> Reading parameters from EEPROM..."));
    for (i=0; i<EEPROM_TOTAL_BYTES; i++){
      vars[i] = Utils.readEEPROM(1025+i);
      USB.print(F("Address EEPROM:  "));
      USB.print((1025+i),DEC);
      USB.print(F(" -- Value: "));
      USB.println(vars[i],DEC);
    }
  }else{
    USB.print(F(">> Writing default values to EEPROM..."));
    for (i=0; i<EEPROM_TOTAL_BYTES; i++){
      Utils.writeEEPROM(1025+i, vars[i]);
    }
    Utils.writeEEPROM(1024, EEPROM_MAGIC_BYTE);
  }
  USB.println(F(" Done."));
  report_millis = (unsigned long)150000 + \
                  ((unsigned long)(vars[REPORT_TIMER]*256 + (unsigned long)vars[REPORT_TIMER+1] - 3)*60000);
}

void check_alarms()
{
  uint8_t i;
  uint16_t threshold;
  
  for(i=0;i<8;i++){
    //upper limit
    if(vars[alarm[i]] & 0x1){
      if(i==CO || i==CO2){
        threshold = vars[upper[i]] * 256 + vars[upper[i]];
      }else{
        threshold = vars[upper[i]];
      }
      if(readings[i] > threshold){
        if(th_cnt[i] < vars[th_val[i]]){
          th_cnt[i]++;
          if(th_cnt[i] == vars[th_val[i]]) alarm_flag+=(i+1);
        }else{
          th_cnt[i] = vars[th_val[i]];
        }
      }else{
        if(th_cnt[i] >= vars[th_val[i]] && th_cnt[i] < 2*vars[th_val[i]]){
          th_cnt[i]++;
          if(th_cnt[i] == 2*vars[th_val[i]]){
            alarm_flag-=(i+1);
            th_cnt[i] = 0;
          }
        }else{
          th_cnt[i] = 0;
        }
      }
    }
    //lower limit
    if(i!=CO && i!=CO2){
      if(vars[alarm[i]] & 0x2){
        if(readings[i] < vars[lower[i]]){
          if(th_cnt[i] < vars[th_val[i]]){
            th_cnt[i]++;
            if(th_cnt[i] == vars[th_val[i]]) alarm_flag+=(i+1);
          }else{
            th_cnt[i] = vars[th_val[i]];
          }
        }else{
          if(th_cnt[i] >= vars[th_val[i]] && th_cnt[i] < 2*vars[th_val[i]]){
            th_cnt[i]++;
            if(th_cnt[i] == 2*vars[th_val[i]]){
              alarm_flag-=(i+1);
              th_cnt[i] = 0;
            }
          }else{
            th_cnt[i] = 0;
          }
        }
      }
    }
  }
}

#ifdef COMM
void loop_lorawan() 
{
  uint8_t data[100], length=0;
  uint32_t i;
  //////////////////////////////////////////////
  // 1. Switch on
  //////////////////////////////////////////////

  error = LoRaWAN.ON(socket);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("1. Switch ON OK"));     
  }
  else 
  {
    USB.print(F("1. Switch ON error = ")); 
    USB.println(error, DEC);
  }
  
  //////////////////////////////////////////////
  // 2. Join network
  //////////////////////////////////////////////
  LoRaWAN.getUpCounter();
  LoRaWAN.getDownCounter();
  error = LoRaWAN.joinABP();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("2. Join network OK"));     
  }
  else 
  {
   USB.print(F("2. Join network error = ")); 
    USB.println(error, DEC);
  }
  
  //////////////////////////////////////////////
  // 3. Send confirmed packet 
  //////////////////////////////////////////////
  if(send_config){
    if(send_config == NODE_ID || send_config == REPORT_TIMER || \
       send_config == CO_UPPER || send_config == CO2_UPPER)
    {
      sprintf((char*)data, "#%d:%d%d#", send_config, vars[send_config], vars[send_config+1]);
      length=4;
      while(data[length]!='#') length++;
      length++;
    }
    else if(send_config == 99)
    {
      data[0] = '#';
      data[1] = '9';
      data[2] = '9';
      data[3] = ':';
      data[40] = '#';
      for(i=0;i<EEPROM_TOTAL_BYTES;i++){
        data[4+i]=vars[i];
      }
      length = 41;
    }
    else if(send_config < 34)
    {
      sprintf((char*)data, "#%d:%d#", send_config, vars[send_config]);
      length=4;
      while(data[length]!='#') length++;
      length++;
    }
    error = LoRaWAN.sendConfirmed( PORT, data, length);
    send_config = 0;
    // Check status
    if( error == 0 ) 
    {
      USB.println(F("3. Send confirmed packet 1/1 OK")); 
      if (LoRaWAN._dataReceived == true)
      { 
        USB.print(F("  There's data on port number "));
        USB.print(LoRaWAN._port,DEC);
        USB.print(F(".\r\n   Data: "));
        USB.println(LoRaWAN._data);
        lorawan_rx_data();
      }
    }
    else 
    {
      USB.print(F("3. Send confirmed packet 1/1 error = ")); 
      USB.println(error, DEC);
    }
  }
  else
  {
    // Create new frame (ASCII)
    frame.createFrame(ASCII, node_ID);
    // Add sensor values
    frame.addSensor(SENSOR_CITIES_PRO_TC, readings[TEMP]);
    frame.addSensor(SENSOR_CITIES_PRO_HUM, readings[HUMI]);
    frame.addSensor(SENSOR_CITIES_PRO_NOISE, readings[NOISE]);
    // Show the frame
    frame.showFrame();
    error = LoRaWAN.sendConfirmed( PORT, &frame.buffer[22], frame.length-22);
    // Check status
    if( error == 0 ) 
    {
      USB.println(F("3. Send confirmed packet 1/3 OK")); 
      if (LoRaWAN._dataReceived == true)
      { 
        USB.print(F("  1/3 There's data on port number "));
        USB.print(LoRaWAN._port,DEC);
        USB.print(F(".\r\n   Data: "));
        USB.println(LoRaWAN._data);
        lorawan_rx_data();
      }
    }
    else 
    {
      USB.print(F("3. Send confirmed packet 1/3 error = ")); 
      USB.println(error, DEC);
    }
    delay(5000);
    // Create new frame (ASCII)
    frame.createFrame(ASCII, node_ID);
    // Add sensor values
    frame.addSensor(SENSOR_CITIES_PRO_PRES, readings[PRES]);
    frame.addSensor(SENSOR_CITIES_PRO_O2, readings[O2]);
    // Show the frame
    frame.showFrame();  
    error = LoRaWAN.sendConfirmed( PORT+1, &frame.buffer[22], frame.length-22);
    // Check status
    if( error == 0 ) 
    {
      USB.println(F("3. Send confirmed packet 2/3 OK")); 
      if (LoRaWAN._dataReceived == true)
      { 
        USB.print(F("  2/3 There's data on port number "));
        USB.print(LoRaWAN._port,DEC);
        USB.print(F(".\r\n   Data: "));
        USB.println(LoRaWAN._data);
        lorawan_rx_data();
      }
    }
    else 
    {
      USB.print(F("3. Send confirmed packet 2/3 error = ")); 
      USB.println(error, DEC);
    }
    delay(5000);
    // Create new frame (ASCII)
    frame.createFrame(ASCII, node_ID);
    // Add sensor values
    frame.addSensor(SENSOR_CITIES_PRO_CO2, readings[CO2]);
    frame.addSensor(SENSOR_CITIES_PRO_CO, readings[CO]);
    frame.addSensor(SENSOR_CITIES_PRO_BAT, readings[BAT]);
    // Show the frame
    frame.showFrame();  
    error = LoRaWAN.sendConfirmed( PORT+2, &frame.buffer[22], frame.length-22);
    // Check status
    if( error == 0 ) 
    {
      USB.println(F("3. Send confirmed packet 3/3 OK")); 
      if (LoRaWAN._dataReceived == true)
      { 
        USB.print(F("  3/3 There's data on port number "));
        USB.print(LoRaWAN._port,DEC);
        USB.print(F(".\r\n   Data: "));
        USB.println(LoRaWAN._data);
        lorawan_rx_data();
      }
    }
    else 
    {
      USB.print(F("3. Send confirmed packet 3/3 error = ")); 
      USB.println(error, DEC);
    }
  }
  // Error messages:
    /*
     * '6' : Module hasn't joined a network
     * '5' : Sending error
     * '4' : Error with data length   
     * '2' : Module didn't response
     * '1' : Module communication error   
    */

  error = LoRaWAN.saveConfig();
  
  // Check status
  if( error == 0 ) 
  {
    USB.println(F("15. Save configuration OK"));     
  }
  else 
  {
    USB.print(F("15. Save configuration error = ")); 
    USB.println(error, DEC);
  }

  //////////////////////////////////////////////
  // 4. Switch off
  //////////////////////////////////////////////

  error = LoRaWAN.OFF(socket);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("4. Switch OFF OK"));     
  }
  else 
  {
    USB.print(F("4. Switch OFF error = ")); 
    USB.println(error, DEC);
  }
  
  USB.println();
  //delay(5000);
}
void lorawan_rx_data()
{
  char data[20], *p, i=0;
  int key, val, d;
  
  p = LoRaWAN._data;
  USB.print(F(">> Rx data: "));
  while (*p != '\0'){
    data[i] = (hex_ascii[*p-0x30]<<4) | hex_ascii[*(p+1)-0x30];
    if(data[0] == '#' && data[i] == '#' && i>0){
      data[i+1] = 0;
      USB.print(data);
      i--;
      val=0;
      d=1;
      while(data[i]!=':' && i>0){
        val = val+((data[i]-0x30)*d);
        d = d*10;
        i--;
      }
      if(i==0){ //Command with no data (GET CMD)
        if(val<100){
          switch(val){
            case 98:
              Utils.writeEEPROM(1024, 0);
              reset();
            break;
            default:
              send_config=val;
            break;
          }
        }
      }else{    //Command with data (SET CMD)
        i--;
        key=0;
        d=1;
        while(data[i]!='#' && i>0){
          key = key+((data[i]-0x30)*d);
          d = d*10;
          i--;
        }
        i=0;
        USB.print(" key:");
        USB.print(key, DEC);
        USB.print(" val:");
        USB.println(val, DEC);
        switch(key){
          case REPORT_TIMER:
            if(val >= TIMER_MIN && val<= TIMER_MAX){
              vars[REPORT_TIMER] = val>>8;
              vars[REPORT_TIMER+1] = val&0xFF;
              Utils.writeEEPROM(1025+key, val);
              report_millis = (unsigned long)150000 + \
                             ((unsigned long)(vars[REPORT_TIMER]*256 + (unsigned long)vars[REPORT_TIMER+1] - 3)*60000);
              USB.print(" report_millis:");
              USB.println(report_millis, DEC);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case NOISE_ALARM:
          case TEMP_ALARM:
          case HUM_ALARM:
          case PRES_ALARM:
          case O2_ALARM:
          case CO_ALARM:
          case CO2_ALARM:
          case BAT_ALARM:
            if(val<=3){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case NOISE_THR_CNT:
          case TEMP_THR_CNT:
          case HUM_THR_CNT:
          case PRES_THR_CNT:
          case O2_THR_CNT:
          case CO_THR_CNT:
          case CO2_THR_CNT:
          case BAT_THR_CNT:
            if(val<=10){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case NOISE_UPPER:
          case NOISE_LOWER:
            if(val<=NOISE_MAX && val>=NOISE_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case TEMP_UPPER:
          case TEMP_LOWER:
            if(val<=TEMP_MAX && val>=TEMP_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case HUM_UPPER:
          case HUM_LOWER:
            if(val<=HUM_MAX && val>=HUM_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case PRES_UPPER:
          case PRES_LOWER:
            if(val<=PRES_MAX && val>=PRES_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case O2_UPPER:
          case O2_LOWER:
            if(val<=O2_MAX && val>=O2_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case CO_UPPER:
          //case CO_LOWER:
            if(val<=CO_MAX && val>=CO_MIN){
              vars[key] = val>>8;
              vars[key+1] = val&0xFF;
              Utils.writeEEPROM(1025+key, val>>8);
              Utils.writeEEPROM(1026+key, val&0xFF);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case CO2_UPPER:
          //case CO2_LOWER:
            if(val<=CO2_MAX && val>=CO2_MIN){
              vars[key] = val>>8;
              vars[key+1] = val&0xFF;
              Utils.writeEEPROM(1025+key, val>>8);
              Utils.writeEEPROM(1026+key, val&0xFF);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case BAT_UPPER:
          case BAT_LOWER:
            if(val<=BAT_MAX && val>=BAT_MIN){
              vars[key] = val;
              Utils.writeEEPROM(1025+key, val);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          case NODE_ID:
            if(val<=NID_MAX && val>=NID_MIN){
              vars[NODE_ID] = val>>8;
              vars[NODE_ID+1] = val&0xFF;
              Utils.writeEEPROM(1025+NODE_ID, vars[NODE_ID]);
              Utils.writeEEPROM(1026+NODE_ID, vars[NODE_ID+1]);
            }else{
              USB.println(F(">> value out of range!"));
            }
          break;
          default: break;
        }
      }
    }
    i++;
    p+=2;
  }
  USB.println();
}
void setup_lorawan_configmodule()
{
//////////////////////////////////////////////
  // 1. switch on
  //////////////////////////////////////////////

  error = LoRaWAN.ON(socket);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("1. Switch ON OK"));     
  }
  else 
  {
    USB.print(F("1. Switch ON error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 2. Reset to factory default values
  //////////////////////////////////////////////
/* 
  error = LoRaWAN.factoryReset();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("2. Reset to factory default values OK"));     
  }
  else 
  {
    USB.print(F("2. Reset to factory error = ")); 
    USB.println(error, DEC);
  }

 */
  //////////////////////////////////////////////
  // 3. Set/Get Device EUI
  //////////////////////////////////////////////

  // Set Device EUI
  error = LoRaWAN.setDeviceEUI(DEVICE_EUI);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("3.1. Set Device EUI OK"));     
  }
  else 
  {
    USB.print(F("3.1. Set Device EUI error = ")); 
    USB.println(error, DEC);
  }

  // Get Device EUI
  error = LoRaWAN.getDeviceEUI();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("3.2. Get Device EUI OK. ")); 
    USB.print(F("Device EUI: "));
    USB.println(LoRaWAN._devEUI);
  }
  else 
  {
    USB.print(F("3.2. Get Device EUI error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 4. Set/Get Device Address
  //////////////////////////////////////////////

  // Set Device Address
  error = LoRaWAN.setDeviceAddr(DEVICE_ADDR);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("4.1. Set Device address OK"));     
  }
  else 
  {
    USB.print(F("4.1. Set Device address error = ")); 
    USB.println(error, DEC);
  }
  
  // Get Device Address
  error = LoRaWAN.getDeviceAddr();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("4.2. Get Device address OK. ")); 
    USB.print(F("Device address: "));
    USB.println(LoRaWAN._devAddr);
  }
  else 
  {
    USB.print(F("4.2. Get Device address error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 5. Set Network Session Key
  //////////////////////////////////////////////

  error = LoRaWAN.setNwkSessionKey(NWK_SESSION_KEY);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("5. Set Network Session Key OK"));     
  }
  else 
  {
    USB.print(F("5. Set Network Session Key error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 6. Set Application Session Key
  //////////////////////////////////////////////

  error = LoRaWAN.setAppSessionKey(APP_SESSION_KEY);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("6. Set Application Session Key OK"));     
  }
  else 
  {
    USB.print(F("6. Set Application Session Key error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 7. Set retransmissions for uplink confirmed packet
  //////////////////////////////////////////////

  // set retries
  error = LoRaWAN.setRetries(7);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("7.1. Set Retransmissions for uplink confirmed packet OK"));     
  }
  else 
  {
    USB.print(F("7.1. Set Retransmissions for uplink confirmed packet error = ")); 
    USB.println(error, DEC);
  }
  
  // Get retries
  error = LoRaWAN.getRetries();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("7.2. Get Retransmissions for uplink confirmed packet OK. ")); 
    USB.print(F("TX retries: "));
    USB.println(LoRaWAN._retries, DEC);
  }
  else 
  {
    USB.print(F("7.2. Get Retransmissions for uplink confirmed packet error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 8. Set application key
  //////////////////////////////////////////////

  error = LoRaWAN.setAppKey(APP_KEY);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("8. Application key set OK"));     
  }
  else 
  {
    USB.print(F("8. Application key set error = ")); 
    USB.println(error, DEC);
  }


  ////////////////////////////////////////////////////////
  //  ______________________________________________________
  // |                                                      |
  // |  It is not mandatory to configure channel parameters.|
  // |  Server should configure the module during the       |
  // |  Over The Air Activation process. If channels aren't |
  // |  configured, please uncomment channel configuration  |
  // |  functions below these lines.                        |
  // |______________________________________________________|
  //
  ////////////////////////////////////////////////////////

  //////////////////////////////////////////////
  // 9. Channel configuration. (Recommended)
  // Consult your Network Operator and Backend Provider
  //////////////////////////////////////////////

  /////////////////////////////
  // EU module
  /////////////////////////////
  // Set channel 3 -> 867.1 MHz
  // Set channel 4 -> 867.3 MHz
  // Set channel 5 -> 867.5 MHz
  // Set channel 6 -> 867.7 MHz
  // Set channel 7 -> 867.9 MHz
  /////////////////////////////
  // ASIA-PAC / LATAM module
  /////////////////////////////
  // Set channel 2 -> 923.6 MHz
  // Set channel 3 -> 923.8 MHz
  // Set channel 4 -> 924.0 MHz
  // Set channel 5 -> 924.2 MHz
  // Set channel 6 -> 924.4 MHz
  /////////////////////////////

  uint32_t freq = 867100000;

  for (uint8_t ch = 3; ch <= 7; ch++)
  {
    error = LoRaWAN.setChannelFreq(ch, freq);
    freq += 200000;

    // Check status
    if( error == 0 ) 
    {
      USB.println(F("9. Frequency channel set OK"));     
    }
    else 
    {
      USB.print(F("9. Frequency channel set error = ")); 
      USB.println(error, DEC);
    }
  }

  

  //////////////////////////////////////////////
  // 10. Set Duty Cycle for specific channel. (Recommended)
  // Consult your Network Operator and Backend Provider
  //////////////////////////////////////////////

  for (uint8_t ch = 0; ch <= 2; ch++)
  {
    error = LoRaWAN.setChannelDutyCycle(ch, 33333);

    // Check status
    if( error == 0 ) 
    {
      USB.println(F("10. Duty cycle channel set OK"));     
    }
    else 
    {
      USB.print(F("10. Duty cycle channel set error = ")); 
      USB.println(error, DEC);
    }
  }

  for (uint8_t ch = 3; ch <= 7; ch++)
  {
    error = LoRaWAN.setChannelDutyCycle(ch, 40000);

    // Check status
    if( error == 0 ) 
    {
      USB.println(F("10. Duty cycle channel set OK"));     
    }
    else 
    {
      USB.print(F("10. Duty cycle channel set error = ")); 
      USB.println(error, DEC);
    }
  }

  //////////////////////////////////////////////
  // 11. Set Data Range for specific channel. (Recommended)
  // Consult your Network Operator and Backend Provider
  //////////////////////////////////////////////

  for (int ch = 0; ch <= 7; ch++)
  {
    error = LoRaWAN.setChannelDRRange(ch, 0, 5);

    // Check status
    if( error == 0 ) 
    {
      USB.println(F("11. Data rate range channel set OK"));     
    }
    else 
    {
      USB.print(F("11. Data rate range channel set error = ")); 
      USB.println(error, DEC);
    }
  }

  

  //////////////////////////////////////////////
  // 12. Set Data rate range for specific channel. (Recommended)
  // Consult your Network Operator and Backend Provider
  //////////////////////////////////////////////

  for (int ch = 0; ch <= 7; ch++)
  {
    error = LoRaWAN.setChannelStatus(ch, "on");

    // Check status
    if( error == 0 ) 
    {
      USB.println(F("12. Channel status set OK"));     
    }
    else 
    {
      USB.print(F("12. Channel status set error = ")); 
      USB.println(error, DEC);
    }
  }


  //////////////////////////////////////////////
  // 13. Set Adaptive Data Rate (recommended)
  //////////////////////////////////////////////

  // set ADR
  error = LoRaWAN.setADR("on");

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("13.1. Set Adaptive data rate status to on OK"));     
  }
  else 
  {
    USB.print(F("13.1. Set Adaptive data rate status to on error = ")); 
    USB.println(error, DEC);
  }
  
  // Get ADR
  error = LoRaWAN.getADR();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("13.2. Get Adaptive data rate status OK. ")); 
    USB.print(F("Adaptive data rate status: "));
    if (LoRaWAN._adr == true)
    {
      USB.println("on");      
    }
    else
    {
      USB.println("off");
    }
  }
  else 
  {
    USB.print(F("13.2. Get Adaptive data rate status error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 14. Set Automatic Reply
  //////////////////////////////////////////////

  // set AR
  error = LoRaWAN.setAR("on");

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("14.1. Set automatic reply status to on OK"));     
  }
  else 
  {
    USB.print(F("14.1. Set automatic reply status to on error = ")); 
    USB.println(error, DEC);
  }
  
  // Get AR
  error = LoRaWAN.getAR();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("14.2. Get automatic reply status OK. ")); 
    USB.print(F("Automatic reply status: "));
    if (LoRaWAN._ar == true)
    {
      USB.println("on");      
    }
    else
    {
      USB.println("off");
    }
  }
  else 
  {
    USB.print(F("14.2. Get automatic reply status error = ")); 
    USB.println(error, DEC);
  }

  
  //////////////////////////////////////////////
  // 15. Save configuration
  //////////////////////////////////////////////
  
  error = LoRaWAN.saveConfig();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("15. Save configuration OK"));     
  }
  else 
  {
    USB.print(F("15. Save configuration error = ")); 
    USB.println(error, DEC);
  }


  USB.println(F("------------------------------------"));
  USB.println(F("Now the LoRaWAN module is ready for"));
  USB.println(F("joining networks and send messages."));
  USB.println(F("Please check the next examples..."));
  USB.println(F("------------------------------------\n"));
  }
void setup_lorawan_configchannel()
{
    USB.println(F("LoRaWAN example - LoRaWAN EU Channel configuration"));

  //////////////////////////////////////////////
  // 2. Set frequency for specific channel
  //////////////////////////////////////////////

  error = LoRaWAN.setChannelFreq(3, 865000000);

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("2. Frequency set OK. "));    
    USB.print(F("Frequency:"));
    USB.println(LoRaWAN._freq[3]);
  }
  else 
  {
    USB.print(F("2. Frequency set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 3. Set Duty Cycle for specific channel
  //////////////////////////////////////////////

  error = LoRaWAN.setChannelDutyCycle(3, 999);

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("3. Adaptive Data Rate disabled OK. "));    
    USB.print(F("Duty Cycle:"));
    USB.println(LoRaWAN._dCycle[3], DEC);
  }
  else 
  {
    USB.print(F("3. Duty cycle set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 4. Set Data rate range for specific channel
  //////////////////////////////////////////////

  error = LoRaWAN.setChannelDRRange(3, 0, 2);

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("4. Data Rate range set OK. "));    
    USB.print(F("Data Rate min:"));
    USB.print(LoRaWAN._drrMin[3], DEC); 
    USB.print(F(". Data Rate max:"));
    USB.println(LoRaWAN._drrMax[3], DEC);
  }
  else 
  {
    USB.print(F("4. Data rate range set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 5. Set Data rate range for specific channel
  //////////////////////////////////////////////

  error = LoRaWAN.setChannelStatus(3, "on");

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("5. Channel status set OK: "));
    USB.println(LoRaWAN._status[3], DEC);
  }
  else 
  {
    USB.print(F("5. Channel status set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 6. Save configuration
  //////////////////////////////////////////////

  error = LoRaWAN.saveConfig();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("4. Save configuration OK"));     
  }
  else 
  {
    USB.print(F("4. Save configuration error = ")); 
    USB.println(error, DEC);
  }


  ///////////////////////////////////////////////////////////
  // show configuration for all channels available
  ///////////////////////////////////////////////////////////

  USB.println(F("\n----------------------------"));

  for( int i=0; i<16; i++)
  {
    LoRaWAN.getChannelFreq(i);
    LoRaWAN.getChannelDutyCycle(i);
    LoRaWAN.getChannelDRRange(i);
    LoRaWAN.getChannelStatus(i);

    USB.print(F("Channel: "));
    USB.println(i);
    USB.print(F("  Freq: "));
    USB.println(LoRaWAN._freq[i]);
    USB.print(F("  Duty cycle: "));
    USB.println(LoRaWAN._dCycle[i]);
    USB.print(F("  DR min: "));
    USB.println(LoRaWAN._drrMin[i], DEC);
    USB.print(F("  DR max: "));
    USB.println(LoRaWAN._drrMax[i], DEC);
    USB.print(F("  Status: "));
    if (LoRaWAN._status[i] == 1)
    {
      USB.println(F("on"));
    }
    else
    {
      USB.println(F("off"));
    }
    USB.println(F("----------------------------"));
  } 
  

}
void setup_lorawan_power() 
{
    USB.println(F("LoRaWAN example - Power configuration"));

  if (LoRaWAN._version == RN2483_MODULE || LoRaWAN._version == RN2903_IN_MODULE || LoRaWAN._version == RN2903_AS_MODULE)
  {
    USB.println(F("------------------------------------------------------"));
    USB.println(F("    EU         433 MHz     IN         ASIA-PAC / LATAM"));
    USB.println(F("0:  N/A         10 dBm     20 dBm     20 dBm"));
    USB.println(F("1:  14 dBm       7 dBm     18 dBm     18 dBm"));
    USB.println(F("2:  11 dBm       4 dBm     16 dBm     16 dBm"));
    USB.println(F("3:   8 dBm       1 dBm     14 dBm     14 dBm"));
    USB.println(F("4:   5 dBm      -2 dBm     12 dBm     12 dBm"));
    USB.println(F("5:   2 dBm      -5 dBm     10 dBm     10 dBm"));
    USB.println(F("------------------------------------------------------\n"));
  }
  else if (LoRaWAN._version == RN2903_MODULE)
  {
    USB.println(F("------------------------------------------------------"));
    USB.println(F("     US/AU"));
    USB.println(F("5:   20 dBm"));
    USB.println(F("6:   18 dBm"));
    USB.println(F("7:   16 dBm"));
    USB.println(F("8:   14 dBm"));
    USB.println(F("9:   12 dBm"));
    USB.println(F("10:  10 dBm"));
    USB.println(F("------------------------------------------------------\n"));
  }
  

  //////////////////////////////////////////////
  // 2. Set Power level
  //////////////////////////////////////////////

  error = LoRaWAN.setPower(5);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("2. Power level set OK"));     
  }
  else 
  {
    USB.print(F("2. Power level set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 3. Get Device EUI
  //////////////////////////////////////////////

  error = LoRaWAN.getPower();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("3. Power level get OK. "));    
    USB.print(F("Power index:"));
    USB.println(LoRaWAN._powerIndex, DEC);
  }
  else 
  {
    USB.print(F("3. Power level set error = ")); 
    USB.println(error, DEC);
  }


  USB.println(F("------------------------------------"));
  USB.println(F("Keep in mind the power setting cannot"));
  USB.println(F("be saved in the module's memory. Every"));
  USB.println(F("time the module is powered on, the user"));
  USB.println(F("must set the parameter again"));
  USB.println(F("------------------------------------\n"));

}
void setup_lorawan_datarate() 
{
  USB.println(F("LoRaWAN example - Data Rate configuration"));
  USB.println(F("\nData Rate options:"));


  if (LoRaWAN._version == RN2483_MODULE || LoRaWAN._version == RN2903_IN_MODULE || LoRaWAN._version == RN2903_AS_MODULE)
  {
    USB.println(F("------------------------------------------------------"));
    USB.println(F("  0: SF = 12, BW = 125 kHz, BitRate =   250 bps"));
    USB.println(F("  1: SF = 11, BW = 125 kHz, BitRate =   440 bps"));
    USB.println(F("  2: SF = 10, BW = 125 kHz, BitRate =   980 bps"));
    USB.println(F("  3: SF =  9, BW = 125 kHz, BitRate =  1760 bps"));
    USB.println(F("  4: SF =  8, BW = 125 kHz, BitRate =  3125 bps"));
    USB.println(F("  5: SF =  7, BW = 125 kHz, BitRate =  5470 bps"));
    USB.println(F("------------------------------------------------------\n"));
  }
  else if (LoRaWAN._version == RN2903_MODULE)
  {
    USB.println(F("------------------------------------------------------"));
    USB.println(F("  0: SF = 10, BW = 125 kHz, BitRate =   980 bps"));
    USB.println(F("  1: SF = 9,  BW = 125 kHz, BitRate =  1760 bps"));
    USB.println(F("  2: SF = 8,  BW = 125 kHz, BitRate =  3125 bps"));
    USB.println(F("  3: SF = 7,  BW = 125 kHz, BitRate =  5470 bps"));
    USB.println(F("------------------------------------------------------\n"));
  }
  //////////////////////////////////////////////
  // 2. Set Data Rate
  //////////////////////////////////////////////

  error = LoRaWAN.setDataRate(2);

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("2. Data rate set OK"));     
  }
  else 
  {
    USB.print(F("2. Data rate set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 3. Get Data Rate
  //////////////////////////////////////////////

  error = LoRaWAN.getDataRate();

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("3. Data rate get OK. "));    
    USB.print(F("Data rate index:"));
    USB.println(LoRaWAN._dataRate, DEC);
  }
  else 
  {
    USB.print(F("3. Data rate set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 4. Save configuration
  //////////////////////////////////////////////

  error = LoRaWAN.saveConfig();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("4. Save configuration OK"));     
  }
  else 
  {
    USB.print(F("4. Save configuration error = ")); 
    USB.println(error, DEC);
  }

}
void setup_lorawan_ADR() 
{
  USB.println(F("LoRaWAN example - Data Rate configuration"));

   //////////////////////////////////////////////
  // 2. Enable Adaptive Data Rate (ADR)
  //////////////////////////////////////////////

  error = LoRaWAN.setADR("on");

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("2. Adaptive Data Rate enabled OK. "));    
    USB.print(F("ADR:"));
    USB.println(LoRaWAN._adr, DEC);   
  }
  else 
  {
    USB.print(F("2. Enable data rate error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 3. Disable Adaptive Data Rate (ADR)
  //////////////////////////////////////////////

  error = LoRaWAN.setADR("off");

  // Check status
  if( error == 0 ) 
  {
    USB.print(F("3. Adaptive Data Rate disabled OK. "));    
    USB.print(F("ADR:"));
    USB.println(LoRaWAN._adr, DEC);
  }
  else 
  {
    USB.print(F("3. Data rate set error = ")); 
    USB.println(error, DEC);
  }


  //////////////////////////////////////////////
  // 4. Save configuration
  //////////////////////////////////////////////

  error = LoRaWAN.saveConfig();

  // Check status
  if( error == 0 ) 
  {
    USB.println(F("4. Save configuration OK"));     
  }
  else 
  {
    USB.print(F("4. Save configuration error = ")); 
    USB.println(error, DEC);
  }

}
#endif

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Waspmote P&S Smart Cities showiing fasle sensor data

Post by libelium-dev » Wed Nov 27, 2019 11:07 am

Hi,

It seems that there were interferences on the I2C bus.

What API version did you use to upload the code?

Are the gases sensors turned OFF when the BME sensor is read and vice-versa? The way to read the sensors to avoid interferences in the I2C bus will be as follow. The BME sensor and gas sensors shouldn't be ON at the same time

Code: Select all

  // switch off all gas sensors for better performance
  O2gas_sensor.OFF();
  COgas_sensor.OFF();
  CO2gas_sensor.OFF();

  // switch on BME sensor
  // read temperature, humidity and pressure
  // switch off BME sensor
  bme.ON();
  readings[TEMP] = bme.getTemperature();
  readings[HUMI] = bme.getHumidity();
  readings[PRES] = bme.getPressure();
  bme.OFF();

    // switch on gas sensor again
  O2gas_sensor.ON();
  COgas_sensor.ON();
  CO2gas_sensor.ON();
Hope this solves the issue.
Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest