Ingo Lohs
Published © LGPL

Kniwwelino Controls a BME280 via I2C

Using the Arduino IDE, a short sketch is enough to query a BME280 sensor with the Kniwellino to get temp/humidity and more details.

BeginnerShowcase (no instructions)1 hour805

Things used in this project

Hardware components

Kniwwelino
Kniwwelino
×1
SparkFun Atmospheric Sensor Breakout - BME280
SparkFun Atmospheric Sensor Breakout - BME280
or cheap alternative via I2C
×1
Jumper wires (generic)
Jumper wires (generic)
4 pieces
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
optional for mobility use
×1

Story

Read more

Schematics

Kniwwelino works with BME280 via I2C

Code

Kniwwelino works with BME280 via I2C

C/C++
/***************************************************

  Kniwwelino BME280

  Ingo Lohs, v1.0

  Example sketch for using an Bosch BME280 Sensor connected via I2C.

****************************************************/

#include <Kniwwelino.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme; // I2C

void setup() {
  Kniwwelino.begin(true, true); // Wifi=true, Fastboot=true
 
    bool status;
    status = bme.begin(); // 0x76
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }
    delay(1000); // let sensor boot up
}

void loop() {

    if (Kniwwelino.MATRIXtextDone()) {
          Kniwwelino.MATRIXwriteOnce(String(bme.readTemperature()) + "C" + " -:-:- " + bme.readHumidity() + "%" + " -:-:- " + (bme.readPressure() / 100.0F) + "hPa" + " -:-:- " + Kniwwelino.getTime()); // time+date   
    }
    Kniwwelino.sleep(2000);
}

http://github.com/LIST-LUXEMBOURG/KniwwelinoLib

Credits

Ingo Lohs
182 projects • 198 followers
I am well over 50 years and come from the middle of Germany.
Contact

Comments

Please log in or sign up to comment.