Skip to content

jjpd19/BME280-Environmental-Sensor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BME280-Environmental-Sensor from seengreat:www.seengreat.com

Ⅰ Instruction

1.1、Product Overview

This product is a high-precision Environmental sensor, the BME280 sensor to achieve temperature, humidity and barometric pressure monitoring, the chip temperature sensing in -40~+85 °C, humidity sensing in 0 to 100%, barometric pressure sensing in 300 to 1100hPa. PH2.0 6PIN wire is used to connect the module to the development board for environmental detection, Arduino and Raspberry Pi C and python and STM32 versions of demo codes are available, demo codes enable real-time monitoring of temperature, humidity and barometric pressure.

1.2、Product parameters

Size 30mm(Length)*18mm(Width)
sensor chip BME280
Signal interface I2C/SPI
Supply voltage 3.3V/5V
Temperature sensing -40~85°C (resolution 0.01°C, accuracy ±1°C)
Humidity sensing 0~100%RH (resolution 0.008%RH, accuracy ±3%RH)
Barometric Pressure sensing 300~1100hPa (resolution 0.18Pa, accuracy ±1hPa)

1.3、Product dimensions

30mm(Length)*18mm(Width)

Ⅱ Usage

2.1、Hardware interface configuration instructions

2.1.1、BME280 sensor wiring instructions

PIN I2C SPI
VCC Power supply positive (3.3V/5V) Power supply positive (3.3V/5V)
GND Power supply ground Power supply ground
SCK clock line clock input
MOSI data line data input
MISO/ADDR NC data output
CS NC SPI chip selection pin (active at low level)

2.2、Raspberry Pi Demo Codes Usage

2.2.1、Wiring instructions

The demo codes in the Raspberry Pi motherboard uses the wiringpi number pin definition and the definition of the wiring with the Raspberry Pi motherboard is shown in the table below.

BME280 I2C SPI BCM Number wiringPi Number
VCC 3.3V/5V 3.3V/5V 3.3V/5V 3.3V/5V
GND GND GND GND GND
SCK SCL SCK 11 14
MOSI SDA MOSI 10 12
MISO/ADDR NC MISO 9 13
CS NC GPIO.6 25 6

Table2-2 Pin definition of the module wiring to the Raspberry Pi
The program defaults to I2C wiring mode and changes #define USE_IIC 1 in the main.c program from 1 to 0 when SPI is required.

2.2.2、Wiringpi library installation

sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb # Version 4B upgrade of Raspberry Pi
sudo dpkg -i wiringpi-latest.deb
gpio -v # If version 2.52 appears, the installation is successful
#For the Bullseye branch system, use the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
#Running gpio - v will result in version 2.70. If it does not appear, it indicates an installation error
If the error prompt "ImportError: No module named 'wiringpi'" appears when running the python version of the sample program, run the following command.
#For Python 2. x version
pip install wiringpi
#For Python version 3. X
pip3 install wiringpi
Note: If the installation fails, you can try the following compilation and installation:
git clone --recursive https://github.com/WiringPi/WiringPi-Python.git
Note: The -- recursive option can automatically pull the submodule, otherwise you need to download it manually.
Enter the WiringPi Python folder you just downloaded, enter the following command, compile and install:
#For Python 2. x version
sudo python setup.py install 
#For Python version 3. X
sudo python3 setup.py install
If error occurs:

At this time, enter the command sudo apt install swig to install swig. After that, compile and install sudo python3 setup.py install. If a message similar to the following appears, the installation is successful.

2.2.3、Open SPI interface

sudo raspi-config
Enable I2C interface:
Interfacing Options > I2C> Yes
Enable SPI interface:
Interfacing Options > SPI > Yes
Restart the device.
sudo reboot
Run the command to check whether I2C and SPI are started.
lsmod
If i2c_bcm2835 and spi_bcm2835 are displayed, it means I2C, the SPI module is started.
Install the i2c-tools tool to confirm
sudo apt-get install i2c-tools
View connected I2C devices
i2cdetect -y 1
The connection between BME280 and Raspberry Pi is successful. ADDR is connected to high level by default, and the address is 0X77. If ADDR is connected to low power level, the address is 0X76.
Open the directory demo codes\raspberry-pi, copy the c folder to the Raspberry Pi, open the Raspberry Pi terminal into the C folder, and then run the following command.
sudo make clean
sudo make
sudo ./main
Real-time temperature, humidity, and barometric pressure information can be seen at the Raspberry Pi terminal.
If SPI driven: Wire the BME280 module according to the SPI bus wiring method in the interface description, change the USEIIC macro definition in the main.c file to 0, and then recompile and run the program.

2.3 Arduino Demo Codes Usage

2.3.1、Wiring instructions

The wiring between the BME280 and the Arduino development board is shown in the table below:

BME280 I2C SPI
VCC 3.3V/5V 3.3V/5V
GND GND GND
SCK SCL D13
MOSI SDA D11
MISO/ADDR NC D12
CS NC D10

Table2-3 Pin definition of the module wiring to the Arduino
The program defaults to I2C wiring mode, change #define USE_IIC 1 from 1 to 0 when SPI is required, and then recompile and run the program.

2.3.2、Installation of libraries

Open the directory demo codes\Arduino\bme280, open the bme280.ino file with Arduino software, and install the Adafruit Unified Sensor library and Adafruit's BME280 library. To install libraries, navigate to Sketch > Include Library > Manage Libraries and wait for the library manager to download the library index and update the list of installed libraries.

Thank you for choosing the products of Shengui Technology Co.,Ltd. For more details about this product, please visit: www.seengreat.com

About

Código oficial seengreat.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 87.8%
  • HTML 8.5%
  • Makefile 2.4%
  • Assembly 1.2%
  • C++ 0.1%