KS0405 Keyestudio BMP280 Module (Black and Eco-friendly)

From Keyestudio Wiki
Jump to navigation Jump to search
Keyestudio BMP280 Module(Black and Eco-friendly)


Overview

The keyestudio BMP280 module mainly uses the BMP280 sensor, a temperature and air pressure sensor, which is an absolute air pressure sensor designed for mobile applications.
The sensor module is available in an extremely compact package with small size and low power consumption. It features proven piezoresistive pressure sensor technology with high accuracy and linearity, as well as long-term stability and high EMC robustness. The multiple device working options provide the ultimate flexibility; we can optimize the device in terms of power consumption, resolution and filtering performance.
The module has two modes: I2C communication and SPI communication mode. When using the BMP280 module, users can choose the communication method according to their own needs.


Technical Parameters

  • Operating voltage: DC 5V
  • Air pressure measurement range: 300hPa~1100hPa (elevation +9000~-500m)
  • Air pressure measurement error: ±1hPa (±1m)
  • Air pressure measurement accuracy: 0.18Pa
  • Temperature measurement range: 0℃~ 65℃
  • Temperature measurement error: ±0.5℃, maximum ±1℃
  • Temperature measurement accuracy: 0.1℃


Application field

  • temperature check
  • Atmospheric pressure detection
  • Altitude detection
  • Indoor navigation (floor inspection, elevator inspection)
  • Outdoor navigation, leisure and sports apps
  • Healthcare applications (i.e. spirometry)
  • Vertical speed indication (i.e. ascending/sinking speed)


Hookup Guide


For I2C communication:

KS0405-I2C.jpg


For SPI communication:

Ks0405-1.png


Test Program


For I2C communication:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK 13    //SCL
#define BMP_MISO 12   //SDO
#define BMP_MOSI 11   //SDA
#define BMP_CS 10     //CSB

Adafruit_BMP280 bme; // I2C
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);
  
void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));
  
  if (!bme.begin()) {  
    Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    while (1);
  }
}
  
void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");
    
    Serial.print("Pressure = ");
    Serial.print(bme.readPressure());
    Serial.println(" Pa");

   // Serial.print("Approx altitude = ");
   // Serial.print(bme.readAltitude(1013.25));
   // Serial.println(" m");
    
    Serial.println();
    delay(2000);
}


For SPI communication:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK 13    //SCL
#define BMP_MISO 12   //SDO
#define BMP_MOSI 11   //SDA
#define BMP_CS 10     //CSB

//Adafruit_BMP280 bme; // I2C
Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);
  
void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));
  
  if (!bme.begin()) {  
    Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    while (1);
  }
}
  
void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");
    
    Serial.print("Pressure = ");
    Serial.print(bme.readPressure());
    Serial.println(" Pa");

   // Serial.print("Approx altitude = ");
   // Serial.print(bme.readAltitude(1013.25));
   // Serial.println(" m");
    
    Serial.println();
    delay(2000);
}


Upload the program


Special note:
You can download different version of Arduino IDE from the link here:
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x

Here we use the Arduino 1.6.1 version to test the BMP280 module in the code.
It might fail to compile the test program when using other versions of arduino IDE.
Ks0405-2.png

Downloaded Arduino 1.6.1, unzip the software package to open the arduino application.
Ks0405-3.png

Follow the hookup guide to connect well the module, and open the arduino software.


Note: before open the software, do remember to place the code libraries inside the arduino libraries folder.

Ks0405-2.png

Ks0405-4.png

Open the arduino software, firstly select the proper Board and COM port in “Tools”.
Ks0405-5.png

After that, copy and paste the test code to arduino window. Click to compile and upload the code.
Ks0405-6.png

Done uploading the test code, click to open the monitor Ks0405-7.png and set the baud rate to 9600.
The monitor will show the current temperature and air pressure.
Ks0405-8.png


Schematics Diagram


Ks0405-9.png


Extension


Ks0405-9.jpg


Resources

https://drive.google.com/open?id=1gyzmH7GTabga8h2i-BocPAgUo2UwPVI3