Incorrect lux value and pressure unit shown in AWS message topic

Questions about the Waspmote v15 and its modules
Post Reply
ckit
Posts: 32
Joined: Thu Nov 07, 2019 6:18 am
Company: Deakin University

Incorrect lux value and pressure unit shown in AWS message topic

Post by ckit » Mon Dec 09, 2019 11:41 am

I have Waspmote Smart City Pro Plug & Sense sending data to Libelium Bridge and then to AWS. My configuration is as follows:
Socket A - Noise Level Sensor
Socket B - Carbon Dioxide (CO2)
Socket C - Carbon Monoxide (CO)
Socket D - Particle Matter (PM1/PM2.5/PM10) - Dust
Socket E - Temperature + Humidity + Pressure
Socket F – Luxes (Luminosity Probe)

I am using a modified version of the following example code to send collected data to Bridge over WiFi.
http://www.libelium.com/development/was ... ud-bridge/

Facing two issues with lux and pressure values sent to AWS in addition to the issue I am facing with noise sensor (https://www.libelium.com/forum/viewtopi ... 0&start=20)

Issue 1: the unit of pressure is shown as %RH in AWS IoT message topic.
BME – Pressure 101425.1015625 %RH

Code: Select all

void getTemperaturePressureHumidity()
{

  // switch off gas sensor for better performance
  co.OFF();

  // 1. Turn on the sensor
  ///////////////////////////////////////////
  bme.ON();

  // 2. Read sensors
  ///////////////////////////////////////////
  temperature = bme.getTemperature();
  humidity = bme.getHumidity();
  pressure = bme.getPressure();
  
  // And print the values via USB
  USB.println(F("***************************************"));
  USB.print(F("Temperature: "));
  USB.printFloat(temperature, 2);
  USB.println(F(" Celsius degrees"));
  USB.print(F("RH: "));
  USB.printFloat(humidity, 2);
  USB.println(F(" %"));
  USB.print(F("Pressure: "));
  USB.printFloat(pressure, 2);
  USB.println(F(" Pa"));

  // 3. Turn off the sensor
  ///////////////////////////////////////////
  bme.OFF();

  // switch on gas sensor again
  co.ON();
  
}
Issue 2: lux reading is incorrectly displayed in AWS IoT message topic.
Luxes-1.0509738482436E-43luxes

Observations:
The lux reading is correctly displayed in the serial monitor. This could be something to do with the following function.

Code: Select all

    frame.addSensor(SENSOR_CITIES_PRO_LUXES, luminosity);
where;

Code: Select all

uint32_t  luminosity;
 
void getLuminos()
{
  // 1. Turn on the sensor
  ///////////////////////////////////////////
  luxes.ON();
 
  // 2. Read the luminosity sensor
  ///////////////////////////////////////////
  luminosity = luxes.getLuminosity();
 
  // And print the value via USB
  USB.println(F("***************************************"));
  USB.print(F("Luminosity: "));
  USB.print(luminosity);
  USB.println(F(" luxes"));
 
  // 3. Power off sensor
  ///////////////////////////////////////////
  luxes.OFF();
}
What could be the possible fix for these?

Cheers
CK

ckit
Posts: 32
Joined: Thu Nov 07, 2019 6:18 am
Company: Deakin University

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by ckit » Tue Dec 10, 2019 6:19 am

Hi Team,

I did few experiments using the following code and my findings can be found below.

Code:

Code: Select all

// Put your libraries here (#include ...)
#include <WaspWIFI_PRO.h>
#include <WaspFrame.h>
#include <WaspSensorCities_PRO.h>

// choose socket (SELECT USER'S SOCKET)
///////////////////////////////////////
uint8_t socket = SOCKET0;
///////////////////////////////////////

luxesCitiesSensor   luxes(SOCKET_F);

// SERVER settings
////////////////////////////////////////////////////////////////////////
const char flash_http_format[] PROGMEM = "GET %s?frame=%s HTTP/1.1\r\nHost: %s\r\nContent-Length: 0\r\n";
const char flash_http_host[]   PROGMEM = "hw.libelium.com";
const char flash_http_path[]   PROGMEM = "/hw/ps";
const char flash_http_rport[]  PROGMEM = "443";
const char* const flash_http_table[]  PROGMEM = {flash_http_format, flash_http_host, flash_http_path, flash_http_rport};
////////////////////////////////////////////////////////////////////////


// buffer of memory to create the request
char data[1500];

uint32_t  luminosity;   // Stores the luminosity in Luxes

// define certificate for SSL
////////////////////////////////////////////////////////////////////////
const char certificate[] PROGMEM =
  "-----BEGIN CERTIFICATE-----\r"\
  "MIID3DCCAsSgAwIBAgIJAMrHeK4tOUN7MA0GCSqGSIb3DQEBCwUAMIGBMQswCQYD\r"\
  "VQQGEwJFUzERMA8GA1UECAwIWmFyYWdvemExETAPBgNVBAcMCFphcmFnb3phMTIw\r"\
  "MAYDVQQKDClMaWJlbGl1bSBDb211bmljYWNpb25lcyBEaXN0cmlidWlkYXMgUy5M\r"\
  "LjEYMBYGA1UEAwwPaHcubGliZWxpdW0uY29tMCAXDTE4MTAwMzA4NDkyOVoYDzIx\r"\
  "MTgwOTA5MDg0OTI5WjCBgTELMAkGA1UEBhMCRVMxETAPBgNVBAgMCFphcmFnb3ph\r"\
  "MREwDwYDVQQHDAhaYXJhZ296YTEyMDAGA1UECgwpTGliZWxpdW0gQ29tdW5pY2Fj\r"\
  "aW9uZXMgRGlzdHJpYnVpZGFzIFMuTC4xGDAWBgNVBAMMD2h3LmxpYmVsaXVtLmNv\r"\
  "bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMo3Fif9BlMOUmGRJxSq\r"\
  "JUYZUpPbJULBpegbxGLpiie4fTvEfml7csj8EhHch5ItWi+Zq6m8VfOJ7kAO1vxv\r"\
  "UYmprH+GfJXnQzBPROrazRu5fDk9C5NjTTu7PqNvmD3RLEnAWvY+k/B7qjqfXr5V\r"\
  "IWoQScIOgn2y/Qf2QGYf710uswPPOEMRZQ1oo9EE8zy9gsplQ8ym1xmENPavdv/x\r"\
  "5Fccyj3O0Gd6pXtTVZq0n5w/7qFEG55sRFJXnXXdxzgsRSdUk8wPpgZi7r05o2YP\r"\
  "YXHnoX0CcrfyPZE7wlijYIokzHxUZLvO0UnL8ZWzu+s4ULPANaQN03TTIO8zoXns\r"\
  "CwsCAwEAAaNTMFEwHQYDVR0OBBYEFE/Yuv3pY1LdcfuD5pre9qFNhynjMB8GA1Ud\r"\
  "IwQYMBaAFE/Yuv3pY1LdcfuD5pre9qFNhynjMA8GA1UdEwEB/wQFMAMBAf8wDQYJ\r"\
  "KoZIhvcNAQELBQADggEBACR4VyHIyeo9wJZfEAY/riv2y9kKorRIKU5uaKMMGFS0\r"\
  "tBV4/8sBJT16oc/PMAfpY7ot8Y6L5wxTaSXL4MsZM1QWD/DWehRGzDrjJPvZEEpW\r"\
  "x1moImbaCRr9THGV/Wg0gtbm5L8HCq0WWFaNKq4lZMUC1YkFDrKq2a23hoWEhihb\r"\
  "RxDudy0QehgqOIv+m0wLCfCcDqywCeuFXRaijDEj1wMW+1JVW1CPxwTiU+APeNMe\r"\
  "T4ebvxqEPrENm6LYCujZR8t+T/zlssqDiev218zRJWikMO+OOkMa08uWHx3gq1Pe\r"\
  "/CkY3qjmAgVx6yvbvo6mDkUK8MlzQCisbK/CLdOgefk=\r"\
  "-----END CERTIFICATE-----";
const char* const certificate_table[]  PROGMEM = {certificate};
////////////////////////////////////////////////////////////////////////


// Define Token for user authentication
////////////////////////////////////////////////////////////////////////
const char TOKEN_HEADER[] PROGMEM = "Authorization: Bearer ";
const char TOKEN_1024[] PROGMEM = "token removed";
const char TOKEN_END[] PROGMEM = "\r\n\r\n";
const char* const token_table[] PROGMEM = {TOKEN_HEADER, TOKEN_1024, TOKEN_END};
////////////////////////////////////////////////////////////////////////

uint8_t error;
uint8_t status;
uint32_t previous;
uint16_t socket_handle = 0;

void setup()
{
  USB.println(F("Start program"));
  USB.println(F("***************************************"));
  USB.println(F("Once the module is set with one or more"));
  USB.println(F("AP settings, it attempts to join the AP"));
  USB.println(F("automatically once it is powered on"));
  USB.println(F("Refer to example 'WIFI_PRO_01' to configure"));
  USB.println(F("the WiFi module with proper settings"));
  USB.println(F("***************************************"));

  //////////////////////////////////////////////////
  // 1. Switch ON
  //////////////////////////////////////////////////
  error = WIFI_PRO.ON(socket);

  if ( error == 0 )
  {
    USB.println(F("1. WiFi switched ON"));
  }
  else
  {
    USB.println(F("1. WiFi did not initialize correctly"));
  }

  //////////////////////////////////////////////////
  // 2. Set Trusted CA
  //////////////////////////////////////////////////

  error = wifiSetCertificate();

  if (error == 0)
  {
    USB.println(F("2. Trusted CA set OK"));
  }
  else
  {
    USB.println(F("2. Error calling 'setCA' function"));
    WIFI_PRO.printErrorCode();
  }


  //////////////////////////////////////////////////
  // 3. Switch OFF
  //////////////////////////////////////////////////
  USB.println(F("3. WiFi switched OFF"));
  WIFI_PRO.OFF(socket);
  
  USB.println();
  USB.println(F("************* SETUP done **************"));
  USB.println();
}

void loop()
{
  USB.println();
  USB.println(F("************** New LOOP ***************"));
  //////////////////////////////////////////////////
  // 1. Switch ON
  //////////////////////////////////////////////////
  error = WIFI_PRO.ON(socket);

  if ( error == 0 )
  {
    USB.println(F("1. WiFi switched ON"));
  }
  else
  {
    USB.println(F("1. WiFi did not initialize correctly"));
  }


  //////////////////////////////////////////////////
  // 2. Check if connected
  //////////////////////////////////////////////////

  // get actual time
  previous = millis();

  // check connectivity
  status =  WIFI_PRO.isConnected();

  // check if module is connected
  if ( status == true )
  {
    USB.print(F("2. WiFi is connected OK"));
    USB.print(F(" Time(ms):"));
    USB.println(millis() - previous);

    // get IP address
    error = WIFI_PRO.getIP();

    if (error == 0)
    {
      USB.print(F("IP address: "));
      USB.println( WIFI_PRO._ip );
    }
    else
    {
      USB.println(F("getIP error"));
    }

    luxes.ON();

    // 2. Read the luminosity sensor
    ///////////////////////////////////////////
    luminosity = luxes.getLuminosity();
  
    // And print the value via USB
    USB.println(F("***************************************"));
    USB.print(F("Luminosity: "));
    USB.print(a);
    USB.println(F(" luxes"));
  
    // 3. Power off sensor
    ///////////////////////////////////////////
    luxes.OFF();

    ////////////////////////////////////////////////
    // 3. Send data
    ////////////////////////////////////////////////
    RTC.ON();
    RTC.getTime();

    // set identifier
    frame.setID("Node01");
    // Create new frame 
    frame.createFrame(BINARY);
    
    int res = frame.addSensor(SENSOR_CITIES_PRO_LUXES, luminosity); 
    USB.println(res);
    
    // show frame contents
    USB.println(F("3. Frame created:"));
    frame.showFrame();

    // send data via TCP secure socket
    sendFrame();
    
  }
  else
  {
    USB.print(F("2. WiFi is connected ERROR"));
    USB.print(F(" Time(ms):"));
    USB.println(millis() - previous);
  }


  //////////////////////////////////////////////////
  // 4. Switch OFF
  //////////////////////////////////////////////////
  USB.println(F("4. WiFi switched OFF\n"));
  WIFI_PRO.OFF(socket);


  USB.println(F("DeepSleep for 10 seconds...\n"));
  PWR.deepSleep("00:00:01:00", RTC_OFFSET, RTC_ALM1_MODE2, ALL_OFF);
  USB.println();
  USB.println();

}

/***********************************************************************
   This function configures SSL certificate into the WiFi module
***********************************************************************/
uint8_t wifiSetCertificate()
{
  char certificate[1500];
  memset(certificate, 0x00, sizeof(certificate));

  // read certificate from flash memory
  strcat_P(certificate, (char*)pgm_read_word(&(certificate_table[0])));

  // set CA certificate for HTTPS
  if (strlen(certificate) > 1500)
  {
    USB.println(F("WiFi CA certificate length is greater than 1500 bytes"));
  }

  return WIFI_PRO.setCA(certificate);
}

/***********************************************************************
    Generate HTTP request
***********************************************************************/
void genHttpRequestFrame(char *pointer, uint16_t size)
{
  // get the http format from flash
  char http_format[100];
  char host[60];
  char path[60];
  memset(http_format, 0x00, sizeof(http_format));
  memset(host, 0x00, sizeof(host));
  memset(path, 0x00, sizeof(path));
  strcpy_P(http_format, (char*)pgm_read_word(&(flash_http_table[0])));
  strcpy_P(host, (char*)pgm_read_word(&(flash_http_table[1])));
  strcpy_P(path, (char*)pgm_read_word(&(flash_http_table[2])));

  // define 'frame_string' buffer
  char frame_string[frame.length * 2 + 1];
  memset(frame_string, 0x00, sizeof(frame_string));

  // convert frame from bytes to ASCII representation
  for (uint16_t i = 0; i < frame.length; i++)
  {
    Utils.hex2str(&frame.buffer[i], &frame_string[i * 2], 1);
  }

  // generate http get request
  snprintf( pointer, size - 1, http_format, path, frame_string, host);  

}


/***********************************************************************
    Add Token to HTTP request
***********************************************************************/
void addToken(char *pointer, uint16_t size)
{
  // concatenate last header to HTTP request
  strcat_P(pointer, (char*)pgm_read_word(&(token_table[0])));
  strcat_P(pointer, (char*)pgm_read_word(&(token_table[1])));
  strcat_P(pointer, (char*)pgm_read_word(&(token_table[2])));
  
  USB.println();
  USB.println();
  USB.println(F("HTTP request:"));
  USB.println(F("-------------------------------"));
  USB.println(pointer);
  USB.println(F("-------------------------------"));
  USB.println();
}

/***********************************************************************
   send current frame contents via WiFi
 ***********************************************************************/
void sendFrame()
{
  char resource[1200];
  char host[60];
  char rport[20];
  memset(host, 0x00, sizeof(host));
  memset(rport, 0x00, sizeof(rport));
  strcpy_P(host, (char*)pgm_read_word(&(flash_http_table[1])));
  strcpy_P(rport, (char*)pgm_read_word(&(flash_http_table[3])));

  // check connectivity
  status =  WIFI_PRO.isConnected();

  // Check if module is connected
  if (status == true)
  {
    USB.println(F("WiFi is connected OK"));

    // get IP address
    error = WIFI_PRO.getIP();

    if (error == 0)
    {
      USB.print(F("WiFi module IP address: "));
      USB.println( WIFI_PRO._ip );
    }
    else
    {
      USB.println(F("WiFi module error getting IP address"));
    }

    // set TCP client
    error = WIFI_PRO.setTCPclient( host, rport, NULL);

    // check response
    if (error == 0)
    {
      // get socket handle (from 0 to 9)
      socket_handle = WIFI_PRO._socket_handle;

      USB.print(F("WiFi module set up a TCP socket in handle: "));
      USB.println(socket_handle, DEC);
    }
    else
    {
      USB.print(F("WiFi module return error in TCP connection "));
      WIFI_PRO.printErrorCode();
      status = false;
    }

    if (status == true)
    {
      // SSL hand shake
      error = WIFI_PRO.sslHandshake(socket_handle);

      if (error == 0)
      {
        USB.println(F("WiFi module SSL handshake OK"));
      }
      else
      {
        USB.println(F("WiFi module SSL handshake error"));
        WIFI_PRO.printErrorCode();
      }


      // generate http get request
      genHttpRequestFrame(resource, sizeof(resource));
      addToken(resource, sizeof(resource));

      error = WIFI_PRO.send( socket_handle, resource);

      if (error == 0)
      {
        USB.println(F("WiFi module sent data OK"));
      }
      else
      {
        USB.print(F("WiFi module returned error sending data "));
        WIFI_PRO.printErrorCode();
      }
    }

    // Wait for answer from server
    error = WIFI_PRO.receive(socket_handle, 10000);

    // check answer
    if (error == 0)
    {
      USB.println(F("WiFi module Server response:"));
      USB.println(F("-------------------------------"));
      USB.println(WIFI_PRO._buffer, WIFI_PRO._length);
      USB.println(F("-------------------------------"));
    }


    // Close socket
    error = WIFI_PRO.closeSocket(socket_handle);

    // check response
    if (error == 0)
    {
      USB.println(F("WiFi module close socket OK"));
    }
    else
    {
      USB.print(F("WiFi module returned error closing the connection "));
      WIFI_PRO.printErrorCode();
    }
  }
  else
  {
    USB.println(F("WiFi is not connected to network"));
  }
}
Output:

Code: Select all

J#
Start program
***************************************
Once the module is set with one or more
AP settings, it attempts to join the AP
automatically once it is powered on
Refer to example 'WIFI_PRO_01' to configure
the WiFi module with proper settings
***************************************
1. WiFi switched ON
[WIFI] status 1
-----END CERTIFICATE-----I/OK
2. Trusted CA set OK
3. WiFi switched OFF

************* SETUP done **************


************** New LOOP ***************
1. WiFi switched ON
2. WiFi is connected OK Time(ms):3942
IP address: 10.72.23.175
***************************************
Luminosity: 85 luxes
U
85
26
3. Frame created:
===============================
Current BINARY Frame:
Length: 26
Frame Type:  6
frame (HEX): 3C3D3E0615271CBC32C8913E874E6F6465303123004E55000000
frame (STR): <=>'�2ȑ>�Node01#NU
===============================
WiFi is connected OK
WiFi module IP address: 10.72.23.175
WiFi module set up a TCP socket in handle: 0
WiFi module SSL handshake OK


HTTP request:
-------------------------------
GET /hw/ps?frame=3C3D3E0615271CBC32C8913E874E6F6465303123004E55000000 HTTP/1.1
Host: hw.libelium.com
Content-Length: 0
Authorization: Bearer eyJqdGkiOiIyNTM3MmZkMWE5OWU3YzFkNjliZmU5MDdkNDQyNTM2NzAzODhlM2QzMDk3NDY5ODZmNzM1MDQwYTFmYjZlMzNkYzY4NzFjZTM2NjI1OTg2NSIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJhdWQiOjUsImp0aSI6IjI1MzcyZmQxYTk5ZTdjMWQ2OWJmZTkwN2Q0NDI1MzY3MDM4OGUzZDMwOTc0Njk4NmY3MzUwNDBhMWZiNmUzM2RjNjg3MWNlMzY2MjU5ODY1IiwiaWF0IjoxNTc0ODExODc0LCJuYmYiOjE1NzQ4MTE4NzQsImV4cCI6NDc2MjEwNzg3NCwic3ViIjoxNjQyLCJzY29wZXMiOltdLCJtZXNoLmd3X2lkIjoiW21lc2guZnJlZV0gKDc0NCkgY2hhbmRhbmEua2l0aGFsYWdhbWFoaXR1Z2VAZGVha2luLmVkdS5hdSIsIm1lc2guZ3dfcG9sIjoiNWJlZWIzODk1MWFmNzkyOWYzMDAwMDAzIn0.RBzm6vAmV0QzhLqnZP4H6BeQZdrwD5cGandN2OSF3khI6VIod9qQOcdGwliGo-ruTPeLFMOpzIJJrlZJCNJdfHdkjOku72Y3FOWRVPRdc-52XpcDH0fpU14z4AWGpT7W7-6VhkpcnBPnLMKnBIUd-HcofCjVsZYl2CpKDygfd1E


-------------------------------

WiFi module sent data OK
WiFi module Server response:
-------------------------------
HTTP/1.1 200 OK
Cache-Control: no-cache, private
Connection: close
Content-Length: 13
Content-Type: text/html; charset=UTF-8
Date: Tue, 10 Dec 2019 03:58:36 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Authorization
X-Ratelimit-Limit: 50000
X-Ratelimit-Remaining: 49975
X-Ratelimit-Reset: 1576035927

Data received
-------------------------------
WiFi module close socket OK
4. WiFi switched OFF

DeepSleep for 10 seconds...




************** New LOOP ***************
1. WiFi switched ON
2. WiFi is connected OK Time(ms):3943
IP address: 10.72.23.175
***************************************
Luminosity: 84 luxes
T
84
26
3. Frame created:
===============================
Current BINARY Frame:
Length: 26
Frame Type:  6
frame (HEX): 3C3D3E0615271CBC32C8913E874E6F6465303123014E54000000
frame (STR): <=>'�2ȑ>�Node01#NT
===============================
WiFi is connected OK
WiFi module IP address: 10.72.23.175
WiFi module set up a TCP socket in handle: 0
WiFi module SSL handshake OK


HTTP request:
-------------------------------
GET /hw/ps?frame=3C3D3E0615271CBC32C8913E874E6F6465303123014E54000000 HTTP/1.1
Host: hw.libelium.com
Content-Length: 0
Authorization: Bearer eyJqdGkiOiIyNTM3MmZkMWE5OWU3YzFkNjliZmU5MDdkNDQyNTM2NzAzODhlM2QzMDk3NDY5ODZmNzM1MDQwYTFmYjZlMzNkYzY4NzFjZTM2NjI1OTg2NSIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJhdWQiOjUsImp0aSI6IjI1MzcyZmQxYTk5ZTdjMWQ2OWJmZTkwN2Q0NDI1MzY3MDM4OGUzZDMwOTc0Njk4NmY3MzUwNDBhMWZiNmUzM2RjNjg3MWNlMzY2MjU5ODY1IiwiaWF0IjoxNTc0ODExODc0LCJuYmYiOjE1NzQ4MTE4NzQsImV4cCI6NDc2MjEwNzg3NCwic3ViIjoxNjQyLCJzY29wZXMiOltdLCJtZXNoLmd3X2lkIjoiW21lc2guZnJlZV0gKDc0NCkgY2hhbmRhbmEua2l0aGFsYWdhbWFoaXR1Z2VAZGVha2luLmVkdS5hdSIsIm1lc2guZ3dfcG9sIjoiNWJlZWIzODk1MWFmNzkyOWYzMDAwMDAzIn0.RBzm6vAmV0QzhLqnZP4H6BeQZdrwD5cGandN2OSF3khI6VIod9qQOcdGwliGo-ruTPeLFMOpzIJJrlZJCNJdfHdkjOku72Y3FOWRVPRdc-52XpcDH0fpU14z4AWGpT7W7-6VhkpcnBPnLMKnBIUd-HcofCjVsZYl2CpKDygfd1E


-------------------------------

WiFi module sent data OK
WiFi module Server response:
-------------------------------
HTTP/1.1 200 OK
Cache-Control: no-cache, private
Connection: close
Content-Length: 13
Content-Type: text/html; charset=UTF-8
Date: Tue, 10 Dec 2019 03:59:50 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Authorization
X-Ratelimit-Limit: 50000
X-Ratelimit-Remaining: 49974
X-Ratelimit-Reset: 1576035927

Data received
-------------------------------
WiFi module close socket OK
4. WiFi switched OFF

DeepSleep for 10 seconds...




************** New LOOP ***************
1. WiFi switched ON
2. WiFi is connected OK Time(ms):17677
IP address: 10.72.23.175
***************************************
Luminosity: 84 luxes
T
84
26
3. Frame created:
===============================
Current BINARY Frame:
Length: 26
Frame Type:  6
frame (HEX): 3C3D3E0615271CBC32C8913E874E6F6465303123024E54000000
frame (STR): <=>'�2ȑ>�Node01#NT
===============================
WiFi is connected OK
WiFi module IP address: 10.72.23.175
WiFi module set up a TCP socket in handle: 0
WiFi module SSL handshake OK


HTTP request:
-------------------------------
GET /hw/ps?frame=3C3D3E0615271CBC32C8913E874E6F6465303123024E54000000 HTTP/1.1
Host: hw.libelium.com
Content-Length: 0
Authorization: Bearer eyJqdGkiOiIyNTM3MmZkMWE5OWU3YzFkNjliZmU5MDdkNDQyNTM2NzAzODhlM2QzMDk3NDY5ODZmNzM1MDQwYTFmYjZlMzNkYzY4NzFjZTM2NjI1OTg2NSIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJhdWQiOjUsImp0aSI6IjI1MzcyZmQxYTk5ZTdjMWQ2OWJmZTkwN2Q0NDI1MzY3MDM4OGUzZDMwOTc0Njk4NmY3MzUwNDBhMWZiNmUzM2RjNjg3MWNlMzY2MjU5ODY1IiwiaWF0IjoxNTc0ODExODc0LCJuYmYiOjE1NzQ4MTE4NzQsImV4cCI6NDc2MjEwNzg3NCwic3ViIjoxNjQyLCJzY29wZXMiOltdLCJtZXNoLmd3X2lkIjoiW21lc2guZnJlZV0gKDc0NCkgY2hhbmRhbmEua2l0aGFsYWdhbWFoaXR1Z2VAZGVha2luLmVkdS5hdSIsIm1lc2guZ3dfcG9sIjoiNWJlZWIzODk1MWFmNzkyOWYzMDAwMDAzIn0.RBzm6vAmV0QzhLqnZP4H6BeQZdrwD5cGandN2OSF3khI6VIod9qQOcdGwliGo-ruTPeLFMOpzIJJrlZJCNJdfHdkjOku72Y3FOWRVPRdc-52XpcDH0fpU14z4AWGpT7W7-6VhkpcnBPnLMKnBIUd-HcofCjVsZYl2CpKDygfd1E


-------------------------------

WiFi module sent data OK
WiFi module Server response:
-------------------------------
HTTP/1.1 200 OK
Cache-Control: no-cache, private
Connection: close
Content-Length: 13
Content-Type: text/html; charset=UTF-8
Date: Tue, 10 Dec 2019 04:01:17 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Authorization
X-Ratelimit-Limit: 50000
X-Ratelimit-Remaining: 49973
X-Ratelimit-Reset: 1576035927

Data received
-------------------------------
WiFi module close socket OK
4. WiFi switched OFF

DeepSleep for 10 seconds...

Libelium Cloud Bridge - CONFIGURED CONNECTORS -> DATA MONITOR shows:

Code: Select all

Device #271CBC32C8913E87
Serial: 271CBC32C8913E87
Last value: 10/12/2019, 15:01:19

Sensor: Luxes-
Value: 1.1770907100328E-43 luxes
Timestamp: 10/12/2019, 15:01:19

Sensor: Luxes-
Value: 1.1770907100328E-43 luxes
Timestamp: 10/12/2019, 14:59:50

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

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by libelium-dev » Tue Dec 10, 2019 12:40 pm

Hi,

It seems that the Bridge isn't parsed the frame properly. We are going to inform the Bridge developers to check the issue. We will let you know once it is solved.

Regards

ckit
Posts: 32
Joined: Thu Nov 07, 2019 6:18 am
Company: Deakin University

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by ckit » Wed Dec 11, 2019 10:54 am

Hi Team,

Thanks for your reply. I continued my testing today as well. See my findings below.

Issue 1: the unit of pressure is shown as %RH in AWS IoT message topic.
BME – Pressure 101425.1015625 %RH

Update: No longer happens. Pressure unit is shown as Pa now.

Issue 2: still exists.

I analysed the frame contents to get an idea of how temperature and lux is represented in the payload and found that binary representation of lux value and float of temperature is set in the frame. However, the ingestion process of Bridge interprets both lux and temp as floats.

Frame contents:
3C3D3E 06 1A 271CBC32C8913E87 4E6F6465303123 05 4E 53000000 4A CDCCBA41

Frame definition: : page 8 of http://www.libelium.com/downloads/docum ... _guide.pdf

serial id - 271CBC32C8913E87
waspmote id - 4E6F6465303123

type - 4E (smart city pro lux)
value - 53000000 -> 0x00000053 = 84

type - 4A (smart city pro temp)
value - CDCCBA41 -> 0x41BACCCD = 23.35

Note that temperature is passed as a float and lux as uint32_t in the addSensor(). Hope this helps.

Cheers
CK

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

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by libelium-dev » Wed Dec 11, 2019 12:48 pm

Hi,

Our colleagues have just updated the Bridge to be able to show the luminosity values correctly. Please try again and let us know if the problem is solved.

Apologies for the inconvenience.
Regards

ckit
Posts: 32
Joined: Thu Nov 07, 2019 6:18 am
Company: Deakin University

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by ckit » Thu Dec 12, 2019 6:51 am

Lux readings are correctly displayed in the Bridge and AWS this morning. My thanks to Bridge dev team and Libelium support team. Well done guys.

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

Re: Incorrect lux value and pressure unit shown in AWS message topic

Post by libelium-dev » Thu Dec 12, 2019 9:08 am

You're welcome! :)

Don't hesitate to ask if you have any doubt.
Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest