Temperature Pressure Humidity¶
The TPH-board is a new sensor board for measuring the Temperature, Pressure and the Humidity. This board has the Sensirion SHT21 humidity sensor and the Bosch Sensortec BMP180 pressure sensor (Barometer) (both capable of measuring temperature).
Both the SHT21 and the BMP180 are connected through the I2C/TWI with the easy Grove-header. Pull-up resistors are available on the TPH-board, but if undesired you can disconnect them through the cut-trace on the back.
TPH-board specifications:¶
- Size: 26 * 19 mm
- 3 volt compatible
- Grove compatible
- Sensirion SHT21 humidity sensor
- Bosch Sensortec BMP180 pressure sensor
- Double temperature sensor (SHT21 & BMP180)
- Operating temp: range (-40 -> +85 )degrees Celsius
- I2C pull-up resistors with cut-trace
Example¶
Below we included some sample code that can be applied best in use with our boards such as the Autonomo, Mbili or the Tatu. With this sketch you are able to create string of data from the temperature, humidity and pressure sensors on the board.
Autonomo Wiring¶
Code¶
#include <Wire.h>
#include <Sodaq_BMP085.h>
#include <Sodaq_SHT2x.h>
// MBili / Tatu
//#define debugSerial Serial
// Autonomo
#define debugSerial SerialUSB
//TPH BMP sensor
Sodaq_BMP085 bmp;
void setup() {
// put your setup code here, to run once:
debugSerial.begin(57600);
setupTPH();
}
void loop() {
// put your main code here, to run repeatedly:
debugSerial.println("Sending payload: TempSHT21T, TempBMP, PressureBMP, HumiditySHT21T");
String reading = takeTPHReading();
debugSerial.println(reading);
}
void setupTPH()
{
//Initialize the wire protocol for the TPH sensors
Wire.begin();
//Initialize the TPH BMP sensor
bmp.begin();
}
String takeTPHReading()
{
//Create a String type data record in csv format
//TempSHT21, TempBMP, PressureBMP, HumiditySHT21
String data = String(SHT2x.GetTemperature()) + ", ";
//BMPTemp is commented out, the data will be to long if you also send batt volt.
data += String(bmp.readTemperature()) + ", ";
data += String(bmp.readPressure() / 100) + ", ";
data += String(SHT2x.GetHumidity());
return data;
}