Smart Env Pro reading 9370-P temp/humid/press sensor?

simonc
Posts: 4
Joined: Wed Sep 28, 2016 10:52 am

Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by simonc » Wed Sep 28, 2016 11:15 am

Hi,
Could you point me at example code for reading from my 9370-P sensor as plugged into socket E of my Waspmote Smart Environment Pro? - there doesn't seem to be what I am looking for amongst your examples since they all utilise gas sensors, and I do not have any gas sensors to plug in, only the 9370-P.

Many thanks,
Simon

simonc
Posts: 4
Joined: Wed Sep 28, 2016 10:52 am

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by simonc » Wed Sep 28, 2016 1:09 pm

Having read through the core library code associated with the gas sensor examples for the environment pro, I tried the following to use the BME280 directly, which as I understand it should be the chip that is in the connected 9370-P sensor attached to the E socket (which looks like internally is referred to as socket number 2) - however I get an error with the Checking ID part of the BME library code, so no luck... please can someone from Libelium help? - I have pushed this as far as I can now I think:

#include <WaspSensorGas_Pro.h>
#define BME280_DEBUG 1

//Variable to store the read temperature value
float temperatureVal;
// Variable to store the read humidity value
float humidityVal;
//Variable to store the read atmospheric pressure value
float pressureVal;

void setup()
{
//Turn on the USB and print a start message
USB.ON();
USB.println(F("start"));
delay(100);
}

void loop()
{
// Turn on the BME
int8_t ok = BME.ON();
USB.print(F("BME status="));
USB.println(ok);

// Read the sensor
temperatureVal = BME.getTemperature(BME280_OVERSAMP_1X, 0);
humidityVal = BME.getHumidity(BME280_OVERSAMP_1X);
pressureVal = BME.getPressure(BME280_OVERSAMP_1X, 0);

// Turn off the BME
if ((WaspRegister & REG_3V3) == 0)
{
#if BME280_DEBUG>0
USB.println(F("GP.3V3 to OFF"));
#endif
PWR.setSensorPower(SENS_3V3, SENS_OFF);
}

// Print the result through the USB
USB.print(F("Temperature: "));
USB.print(temperatureVal);
USB.println(F(" ºC"));
USB.print(F("Humidity: "));
USB.print(humidityVal);
USB.println(F(" %RH"));
USB.print(F("Pressure: "));
USB.print(pressureVal);
USB.println(F(" kPa"));

Utils.blinkLEDs(1000);
delay(1000);
}

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

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by libelium-dev » Wed Sep 28, 2016 1:19 pm

Hi Simon,

Here it is the example code to use the BME sensor alone, there is not this example at our site due to normally you don't use this sensor alone. You can fin more information about the functions regarding the BME280 library. Hope this help.

Code: Select all

#include "BME280.h"

float temp;
float pressure;
float humidity;

long time_temp, time_press, time_hum;


void setup() {
  // put your setup code here, to run once:
  pinMode(ANA0, OUTPUT);
  
  digitalWrite(ANA0, HIGH);
  
  PWR.setSensorPower(SENS_3V3, SENS_ON);

  BME.ON();

  BME.showCalibration();
}


void loop() {
  // put your main code here, to run repeatedly:

  temp = BME.getTemperature(BME280_OVERSAMP_16X, 0);

  pressure = BME.getPressure(BME280_OVERSAMP_16X, 0);

  humidity = BME.getHumidity(BME280_OVERSAMP_16X);


  USB.print(temp);
  USB.print(F(" C\t"));
  USB.print(pressure);
  USB.print(F(" Pa\t"));
  USB.print(humidity);
  USB.println(F(" %RH\t\t"));	

  delay(1000);

}

simonc
Posts: 4
Joined: Wed Sep 28, 2016 10:52 am

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by simonc » Wed Sep 28, 2016 1:29 pm

libelium-dev wrote:Hi Simon,

Here it is the example code to use the BME sensor alone, there is not this example at our site due to normally you don't use this sensor alone. You can fin more information about the functions regarding the BME280 library. Hope this help.
Brilliant, thanks for this, I was nearly there getting the BME chip turned on correctly, just not quite.
I'll give it a whirl, and report back...

simonc
Posts: 4
Joined: Wed Sep 28, 2016 10:52 am

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by simonc » Wed Sep 28, 2016 2:17 pm

simonc wrote:
libelium-dev wrote:Hi Simon,

Here it is the example code to use the BME sensor alone, there is not this example at our site due to normally you don't use this sensor alone. You can fin more information about the functions regarding the BME280 library. Hope this help.
Brilliant, thanks for this, I was nearly there getting the BME chip turned on correctly, just not quite.
I'll give it a whirl, and report back...
Just to confirm that with the extra couple of lines in setup():
pinMode(ANA0, OUTPUT);
digitalWrite(ANA0, HIGH);
PWR.setSensorPower(SENS_3V3, SENS_ON);
does the job and I can read the triple of temp, humid, and pressure successfully - thanks again!

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

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by libelium-dev » Wed Sep 28, 2016 3:57 pm

You're welcome!

mhahn2016
Posts: 13
Joined: Wed Nov 23, 2016 8:51 pm

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by mhahn2016 » Wed Nov 23, 2016 9:06 pm

libelium-dev wrote:Hi Simon,

Here it is the example code to use the BME sensor alone, there is not this example at our site due to normally you don't use this sensor alone. You can fin more information about the functions regarding the BME280 library. Hope this help.

Code: Select all

#include "BME280.h"

float temp;
float pressure;
float humidity;

long time_temp, time_press, time_hum;


void setup() {
  // put your setup code here, to run once:
  pinMode(ANA0, OUTPUT);
  
  digitalWrite(ANA0, HIGH);
  
  PWR.setSensorPower(SENS_3V3, SENS_ON);

  BME.ON();

  BME.showCalibration();
}


void loop() {
  // put your main code here, to run repeatedly:

  temp = BME.getTemperature(BME280_OVERSAMP_16X, 0);

  pressure = BME.getPressure(BME280_OVERSAMP_16X, 0);

  humidity = BME.getHumidity(BME280_OVERSAMP_16X);


  USB.print(temp);
  USB.print(F(" C\t"));
  USB.print(pressure);
  USB.print(F(" Pa\t"));
  USB.print(humidity);
  USB.println(F(" %RH\t\t"));	

  delay(1000);

}

Hi,

Just getting started with Plug 'n Sense PRO and have this temp,humidity,pressure sensor (9370-P) along with CO, O3, NO2, SO2 and Particle Matter ALL v12. I have found code examples for sampling the Gas boards. From this discussion I am assuming that the logic shown here is what I need to add in order to read Temp, Humidity and Pressure along with the other Gases.

Thanks for your hep,

Mark

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

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by libelium-dev » Thu Nov 24, 2016 8:29 am

Hi Mark,

The code above is to read ONLY the BME sensor, on the examples codes of the gases sensors the code part to read the BME sensor is already included.

Regards

mhahn2016
Posts: 13
Joined: Wed Nov 23, 2016 8:51 pm

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by mhahn2016 » Mon Nov 28, 2016 8:57 pm

libelium-dev wrote:Hi Mark,

The code above is to read ONLY the BME sensor, on the examples codes of the gases sensors the code part to read the BME sensor is already included.

Regards

Thanks for your response.

Just to be clear .. is the BME sensor the same as the 9370-P THP sensor? Or are these two different things? My interest as noted is in the 9370-P and as long as these are the same things then I am good.

Thanks for your patience and your help.

Mark

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

Re: Smart Env Pro reading 9370-P temp/humid/press sensor?

Post by libelium-dev » Tue Nov 29, 2016 8:33 am

Hi,

Yes, with BME sensor we refer to the temperature+humidity+pressure sensor (9370-P in the catalog).

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest