Weather click
Weather click

Description of product

Weather click carries BME280 integrated environmental unit from Bosch. It’s a sensor that detects humidity, pressure, and temperature, specifically designed for low current consumption and long-term stability. The click is designed to work on a 3.3V power supply. It communicates with the target microcontroller over SPI or I2C interface.
 


 

BME280 features

The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles.

The BME280 IC has high accuracy and reliability for all three sensors. The humidity sensor has a response time of just one second and it’s accurate up to ±3% RH. The pressure sensor has sensitivity error of ±0.25% which is equivalent to 1m at 400m height change). The humidity and pressure sensors can operate independently from each other. Finally, the temperature sensor has a high resolution (up to 20 bit, when IIR filter is enabled) and low noise. The chip has three operating modes: sleep, forced, and normal.

Specifications

TypeEnvironmental combo
ApplicationsContext awareness, home automation control, personalized weather stations, sport and fitness tools and so on
On-board modulesBosch BME280
Key FeaturesThree sensors in one: pressure, humidity, temperature. Humidity sensor response time: 1 sec. Multiple operating modes: sleep, force, normal
Key BenefitsLong term stability. Humidity and pressure sensors can operate independently. Fast response time
InterfaceI2C,SPI
Input Voltage3.3V
CompatibilitymikroBUS
Click board sizeS (28.6 x 25.4 mm)

Pinout diagram

This table shows how the pinout on RS485 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

NotesPinMikrobus logo.pngPinNotes
NC1ANPWM16NC
NC2RSTINT15NC
Chip selectCS3CSTX14NC
SPI clockSCK4SCKRX13NC
SPI Master Input Slave OutputMISO5MISOSCL12SCLI2C Clock
SPI Master Output Slave InputMOSI6MOSISDA11SDAI2C Data
Power supply+3.3V73.3V5V10NC
GroundGND8GNDGND9GNDGround

Jumpers and settings

DesignatorNameDefault PositionDefault OptionDescription
JP1, JP2, JP3 and JP5Interface SelectionRightI2CJumpers for selection between I2C or SPI communications
JP4ADDRLeftBit 0I2C Address bit = 0

Programming

Code examples Weather click, written for MikroElektronika hardware and compilers are available on Libstock.

Code snippet

The following code snippet shows the library functions for weather click, that are responsible for returning temperature and humidity.
01 /****************************************************************************************************/
02 /* Returns temperature in DegC, resolution is 0.01 DegC. Output value of “5123” equals 51.23 DegC.  */
03 /***************************************************************************************************/
04 
05 static long BME280_Compensate_T() {
06   long temp1, temp2, T;
07 
08  temp1 = ((((adc_T>>3) -((long)cal_param.dig_T1<<1))) * ((long)cal_param.dig_T2)) >> 11;
09   temp2 = (((((adc_T>>4) - ((long)cal_param.dig_T1)) * ((adc_T>>4) - ((long)cal_param.dig_T1))) >> 12) * ((long)cal_param.dig_T3)) >> 14;
10   t_fine = temp1 + temp2;
11   T = (t_fine * 5 + 128) >> 8;
12   return T;
13 }
14 
15 /************************************************************************************************************/
16 /* Returns humidity in %RH as unsigned 32 bit integer in Q22.10 format (22 integer and 10 fractional bits). */
17 /* Output value of “47445” represents 47445/1024 = 46.333 %RH */
18 /************************************************************************************************************/
19 
20 static unsigned long BME280_Compensate_H() {
21   long h1;
22   h1 = (t_fine - ((long)76800));
23   h1 = (((((adc_H << 14) - (((long)cal_param.dig_H4) << 20) - (((long)cal_param.dig_H5) * h1)) +
24     ((long)16384)) >> 15) * (((((((h1 * ((long)cal_param.dig_H6)) >> 10) * (((h1 *
25     ((long)cal_param.dig_H3)) >> 11) + ((long)32768))) >> 10) + ((long)2097152)) *
26     ((long)cal_param.dig_H2) + 8192) >> 14));
27   h1 = (h1 - (((((h1 >> 15) * (h1 >> 15)) >> 7) * ((long)cal_param.dig_H1)) >> 4));
28   h1 = (h1 < 0 ? 0 : h1);
29   h1 = (h1 > 419430400 ? 419430400 : h1);
30   return (unsigned long)(h1>>12);
31 }

Downloads