/bme280-app

FruitOS application for reading BME280 sensor data and publishing it as HTTP GET response

Primary LanguagePythonCreative Commons Attribution Share Alike 4.0 InternationalCC-BY-SA-4.0

Fruit Application for BME280

This FruitOS application reads a BME280 environment sensor through I2C, and returns the sensor data in JSON as a response of HTTP GET request.

Requirements

  • Raspberry Pi 1, 2 or 3
  • BME280 sensor, connected to Raspberry Pi's I2C GPIO
  • FruitOS
  • (optional) fruit-cli

To run through console:

docker run --device /dev/i2c-1 -p 8000:80 -ti herry13/fruit-bme280

The above assumes that the I2C device-tree and kernel module have been loaded, and the BME280 sensor is connected to I2C port 1 (0x76).

To run through fruit-cli:

fruit-cli run-container --node mynode -p 8000:80 \
    --kernel-module i2c-dev --device-tree i2c_arm=on --device /dev/i2c-1 \
    bme280 herry13/fruit-bme280

To deploy the container, fruit-cli is using fruit-agent, which ensures that the I2C device-tree (i2c_arm) and kernel module (i2c-dev) have been loaded before starting the container. This works under condition that the BME280 sensor is connected to I2C port 1 (0x76).

See LICENSE.