Download Print this page

Waveshare BME280 User Manual

Environmental sensor

Advertisement

Quick Links

BME280 Environmental Sensor
OVERVIEW
The BME280 is as combined digital humidity, pressure and temperature sensor. Its
small dimensions, low power consumption, high precision and stability allow the
implementation in environmental monitor, whether forecast, altitude detection and
IOT application.
FEATURES
Support I2C interface, I2C device address could be set by changing I/O or welds
Supports SPI interface. Default I2C, you can change to SPI by change I/O
Integrated Level convert circuit, compatible with 3.3V/5V
Provide examples and user guide (Raspberry Pi/Arduino/STM32)
SPECIFICATION
Operating voltage:
Interface:
Temperature range:
Humidity range:
Pressure range:
Dimensions:
Holes size:
BME280 Environmental Sensor
5V/3.3V
I2C/SPI
-40~85°C (Resolution 0.1°C, tolerance ±1°C)
0~100%rh (Resolution 0.008%RH, tolerance ±1°C)
300~1100hPa(Resolution 0.18Pa, tolerance ±1hPa)
27mmx20mm
2.0mm

User Manual

Advertisement

loading
Need help?

Need help?

Do you have a question about the BME280 and is the answer not in the manual?

Questions and answers

Summary of Contents for Waveshare BME280

  • Page 1: User Manual

    BME280 Environmental Sensor User Manual OVERVIEW The BME280 is as combined digital humidity, pressure and temperature sensor. Its small dimensions, low power consumption, high precision and stability allow the implementation in environmental monitor, whether forecast, altitude detection and IOT application.
  • Page 2 BME280 Environmental Sensor INTERFACES Arduino STM32 RASPBERRY Description 3.3V/5V 3.3V /5V 3.3V /5V Power Ground I2C Data I2C Clock Address Select (High by default): ADDR NC/GND NC/GND NC/GND High:address is 0x77 Low:address is 0x76 SPI: Arduino STM32 RASPBERRY Description 3.3V /5V 3.3V /5V...
  • Page 3 About how to install WiringPi library, you can visit the page: Libraries installation for RPi for details. EXAMPLE DOWNLOAD Visit Our Wiki and find the page of BME280 Environmental Sensor, download the demo code. Extract it to get the folders as below:...
  • Page 4 BME280 Environmental Sensor Copy Raspberry folder to your Raspberry Pi. You can copy it to the root of the TF card which you use for your Raspberry Pi. CONNECTION Enable I2C or SPI interface first, open configuration page with the command:...
  • Page 5 You can query I2C devices with command: i2cdetect -y 1 If there is 77 printed (76 if you change the address), it means that BME280 has connected to Raspberry Pi normally. Note: Please make sure that there are not other I2C devices which has the same address as BME280.
  • Page 6 BME280 Environmental Sensor RUNNING DEMO CODE 1. Connecting BME280 as above 2. Enter directory of BME280-Environmental-Sensor-Demo-Code (which is included in the folder we copied before): cd BME280-Environmental-Sensor-Demo-Code 3. Open and edit file main.c vim main.c - If you use I2C connection which is default setting, you should set the USEIIC...
  • Page 7 BME280 Environmental Sensor - If you use SPI connection. You should change the USEIIC define to 0 on main.c: 4. Save and exit. Then re-compile the demo code: sudo make clean sudo make 5. Running the demo code: sudo ./bme280 Note: if there are not any data outputted after running the demo code or get wrong data, please check the hardware connection and address used.
  • Page 8 BME280 Environmental Sensor WORKING WITH ARDUINO 1. Open Arduino folder (from the one we download), Copy folder BME280-Arduino- Library to Libraries directory of IDE, which locates on installation directory of Arduino IDE. 2. Open Arduino IDE, Choose File->Examples-> BME280_Libreay->bme280test to open the demo code.
  • Page 9 BME280 Environmental Sensor 5. If you want to get correct altitude data, you should first measure the atmosphere pressure of local sea level and then change the define of SEALEVELPRESSURE_HPA 6. Then compile and download to your Arduino board. 7. Open Serial monitor and set the baud rate to 11520...
  • Page 10 BME280 Environmental Sensor WORKIGN WITH STM32 1. Open STM32 project which is under STM32 directory. 2. Connect BME280 to STM32 board according to Interfaces 3. Default interface is I2C with device address 0x77. If you change to SPI, you need to change the USEIIR define to 0 of main.c:...
  • Page 11 BME280 Environmental Sensor default 115200 8N1: Note: if there are not any data outputted after running the demo code or get wrong data, please check the hardware connection and address used.
  • Page 12 = user_i2c_read; dev.write = user_i2c_write; dev.delay_ms = user_delay_ms; rslt = bme280_init(&dev); bme280_dev is BME280 device structure provided by official library, could be used to initialize and obtain data. For different platform we should realize the functions below: user_i2c_read() user_i2c_write()
  • Page 13 BME280 Environmental Sensor And then transfer function pointers of these functions to bem280_dev structure. The function to read BME280 data is: int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev) int8_t stream_sensor_data_normal_mode(struct bme280_dev *dev) Print function: void print_sensor_data(struct bme280_data *comp_data) The read/write function of I2C and SPI:...
  • Page 14 BME280 Environmental Sensor * |----------------+---------------------|-------------| return rslt; int8_t user_spi_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len) int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */ * The parameter dev_id can be used as a variable to select which Chip...
  • Page 15 BME280 Environmental Sensor * Data on the bus should be like * |------------+---------------------| * | I2C action | Data * |------------+---------------------| * | Start * | Write | (reg_addr) * | Stop * | Start * | Read | (reg_data[0]) * | Read | (..)
  • Page 16 *dev) structure to initialization function Initialize BME280 device. int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev) Step3: Calling int8_t stream_sensor_data_normal_mode(struct bme280_dev *dev) to get data of BME280 sensor and print them to console or PC.