Skip to content

This MagicMirror² module is designed for a Bosch BME680 sensor and can display temperature/humidity/pressure/IAQ.

License

Notifications You must be signed in to change notification settings

seb-ma/MMM-Bosch-BME680-sensor

Repository files navigation

MMM-Bosch-BME680-sensor

This is a module for the MagicMirror².

It is designed for a Bosch BME680 sensor connected with i²c and retrieves:

  • temperature
  • humidity
  • pressure
  • AQI

It sends notifications that can be handled by other modules and/or have its own display:

sample

Using the module

To use this module, add the following configuration block to the modules array in the config/config.js file:

var config = {
	modules: [
		{
			module: "MMM-Bosch-BME680-sensor",
			config: {
				updateInterval: 30 * 1000, // 1 minute
				animationSpeed: 1000,
				decimalSymbol: ".",
				showAqiAtLevel: 0, // Show Air Quality only if AQI is worst or equals to a level (0 to always displaying, undefined to never displaying)

				mock: false,
				i2cAddress: 0x76,
				offsetTemperature: 0,
				gasLimitLow: 5000, // Bad air quality limit (values from Bosch specs)
				gasLimitHigh: 50000, // Good air quality limit (values from Bosch specs)
			}
		},
	]
}

Nota: gasLimitLow and gasLimitHigh must be adjusted by experimentation.

Installation

cd ~/MagicMirror/modules # Change path to modules directory of your actual MagiMirror² installation
git clone https://github.com/seb-ma/MMM-Bosch-BME680-sensor
cd MMM-Bosch-BME680-sensor

If nodejs version is compliant:

npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev

Else, a full install + rebuild dependency may be needed:

npm install --no-audit --no-fund --no-update-notifier; npm rebuild i2c-bus --update-binary

OS configuration related

To access to sensor values, it is necessary to have i²c drivers activated and permissions to communicate with.

On Raspberry OS:

Activate i²c:

sudo raspi-config

Then, enable i²c:

  • Interfacing options
  • P5 I2C Enable / Disable automatic loading of the I2C kernel module

And add your user in i2c group:

sudo adduser $USER i2c
sudo adduser $USER gpio

This module has dependency node-rpio. Requirements must be followed (see https://github.com/jperkin/node-rpio):

Add the following line to /boot/config.txt and reboot:

dtoverlay=gpio-no-irq

Enable /dev/gpiomem access:

cat >/etc/udev/rules.d/20-gpiomem.rules <<EOF
SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="gpio", MODE="0660"
EOF

Configuration options

To only have notifications sent (no display), don't set position for the module.

Option Description
updateInterval Optional How often does the data needs to be retrieved?

Type: int (milliseconds)
Default: 3000 milliseconds (3 seconds)
3 seconds is needed to have an accurate Air Quality Index (a longer interval will not be accurate for AQI)
animationSpeed Optional Speed of the update animation. (Milliseconds)

Type: int (milliseconds)
Default: 1000 milliseconds (1 second)
decimalSymbol Optional Decimal separator

Type: string ("." or ",")
Default: "."
showAqiAtLevel Optional Show Air Quality only if AQI is worst or equals to a level
Levels are: 0=Good, 1=Moderate, 2=Unhealthy for Sensitive Groups, 3=Unhealthy, 4=Very Unhealthy, 5=Hazardous
(0 to always displaying, undefined to never displaying)

Type: integer
Default: 0
mock Optional true to retrieve false data if no BME680 is plugged

Type: boolean
Default: false
i2cAddress Optional i²c address of BME680 sensor

Type: int (hexadecimal value)
Default: 0x76
offsetTemperature Optional Temperature offset to apply (useful if sensor is near a processor)

Type: float (degree celsius)
Default: 0
gasLimitLow Optional Bad air quality limit

Type: int
Default: 5000 (from Bosch specs)
gasLimitHigh Optional Good air quality limit

Type: int
Default: 50000 (from Bosch specs)

Sent notifications

When data are retrieved, notifications are sent to other modules with payload containing related value:

  • INDOOR_TEMPERATURE
    • payload: value of temperature in celcius
  • INDOOR_HUMIDITY
    • payload: value of humidity in percentage
  • INDOOR_PRESSURE
    • payload: value of pressure in hecto pascal
  • INDOOR_GAS
    • payload: value of gas resistance in ohm
  • INDOOR_AQI_LEVEL
    • payload: level of Air Quality from 0 to 5
    • 0=Good, 1=Moderate, 2=Unhealthy for Sensitive Groups, 3=Unhealthy, 4=Very Unhealthy, 5=Hazardous
  • INDOOR_AQI
    • payload: value of Air Quality in percentage (100% = max healthy)

ExpressApp

API point is available to retrieve data sensor as json response.

About

This MagicMirror² module is designed for a Bosch BME680 sensor and can display temperature/humidity/pressure/IAQ.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published