All Projects → balenalabs → Balena Sense

balenalabs / Balena Sense

Licence: apache-2.0
Take readings from a BME680 sensor or Sense-HAT on a Pi or Pi Zero, store with InfluxDB and view with Grafana

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Balena Sense

Openauto
AndroidAuto headunit emulator
Stars: ✭ 1,926 (+775.45%)
Mutual labels:  raspberry-pi, raspberrypi
Spypi
An (un-)ethical hacking-station based on Raspberry Pi and Python
Stars: ✭ 167 (-24.09%)
Mutual labels:  raspberry-pi, raspberrypi
Pishrink
Make your pi images smaller!
Stars: ✭ 2,255 (+925%)
Mutual labels:  raspberry-pi, raspberrypi
Gumcp
Web Control Panel for Raspberry Pi
Stars: ✭ 124 (-43.64%)
Mutual labels:  raspberry-pi, raspberrypi
Piwheels
Python package repository providing wheels (pre-built binaries) for Raspberry Pi
Stars: ✭ 180 (-18.18%)
Mutual labels:  raspberry-pi, raspberrypi
Rpi Magicmirror Eink
MagicMirror on 7.5 ePaper Waveshare Display with a Raspberry Pi
Stars: ✭ 136 (-38.18%)
Mutual labels:  raspberry-pi, raspberrypi
Aasdk
Library to build AndroidAuto headunit emulator
Stars: ✭ 167 (-24.09%)
Mutual labels:  raspberry-pi, raspberrypi
Rpi Tempruntime
基于树莓派3B,DHT11/DHT22,LCD1602的一个实时温度湿度检测系统
Stars: ✭ 109 (-50.45%)
Mutual labels:  raspberry-pi, raspberrypi
Mpu6050
A Python module for accessing the MPU-6050 digital accelerometer and gyroscope on a Raspberry Pi.
Stars: ✭ 176 (-20%)
Mutual labels:  raspberry-pi, raspberrypi
Omxiv
OpenMax image viewer for the Raspberry Pi
Stars: ✭ 175 (-20.45%)
Mutual labels:  raspberry-pi, raspberrypi
Glslviewer
Console-based GLSL Sandbox for 2D/3D shaders shaders
Stars: ✭ 2,834 (+1188.18%)
Mutual labels:  raspberry-pi, raspberrypi
Briarids
An All-In-One home intrusion detection system (IDS) solution for the Raspberry PI.
Stars: ✭ 187 (-15%)
Mutual labels:  raspberry-pi, raspberrypi
Crankshaft
Crankshaft: A turnkey GNU/Linux solution that transforms a Raspberry Pi to an Android Auto head unit.
Stars: ✭ 1,703 (+674.09%)
Mutual labels:  raspberry-pi, raspberrypi
Piadvanced
This started as a custom install for my pihole!
Stars: ✭ 144 (-34.55%)
Mutual labels:  raspberry-pi, raspberrypi
Yahm
Yet Another Homematic Management - Skripte zur Einrichtung der Homematic CCU Oberfläche in einem LXC Container unter Debian Jessie auf ARM CPU (z.B.: Raspberry Pi & Co)
Stars: ✭ 113 (-48.64%)
Mutual labels:  raspberry-pi, raspberrypi
E paper weather display
Raspberry Pi weather display using Waveshare e-paper display and Open Weather Map API
Stars: ✭ 159 (-27.73%)
Mutual labels:  raspberry-pi, raspberrypi
Core
Ultibo Core
Stars: ✭ 102 (-53.64%)
Mutual labels:  raspberry-pi, raspberrypi
Create
Software for the HifiBerry/BeoCreate Re-Create project for upcycling vintage loudspeakers
Stars: ✭ 103 (-53.18%)
Mutual labels:  raspberry-pi, raspberrypi
Debian Pi Aarch64
This is the first 64-bit system in the world to support all Raspberry Pi 64-bit hardware!!! (Include: PI400,4B,3B+,3B,3A+,Zero2W)
Stars: ✭ 2,505 (+1038.64%)
Mutual labels:  raspberry-pi, raspberrypi
Rpi gpio
Ruby conversion of RPi.GPIO Python module
Stars: ✭ 185 (-15.91%)
Mutual labels:  raspberry-pi, raspberrypi

balena-sense

A Raspberry Pi balenaCloud starter project taking readings from a either a Bosch BME680 sensor, a Sense-HAT, or a 1-wire temperature sensor (such as a Dallas DS18B20), storing using InfluxDB and reporting using Grafana.

The Bosch BME680 is recommended as it includes sensors for temperature, humidity, pressure and gas content and is available on a breakout board from a few different places for around $10-$20.

As an alternative, if you have one already, you can use the Raspberry Pi Sense-HAT. This however does not include a sensor for gas content and so if you use this the air quality readout is derived from humidity and temperature target values.

If you have neither a BME680 nor a Sense-HAT, or if you only need temperature readings, you can use a so-called 1-wire sensor, such as the DS18B20. Air quality metrics are not available with these sensors.

The sensor provides a reading for Indoor Air Quality (IAQ) which is a range from 0 to 500 where lower is better, and displays it with a web interface provided by Grafana.

Hardware required

Here’s the shopping list for this project. Depending if you’d like to crack out the soldering iron or not will dictate what sensor board you can use; some are plug and play, some require a little soldering.

  • Raspberry Pi 2Bv1.2/3B/3B+/3A+/Zero
  • 8GB (or larger) Micro-SD Card (we recommend Sandisk Extreme Pro SD cards)
  • Power supply & micro-USB cable
  • Bosch BME680 sensor with breakout board (see below for places to find one) or...
  • Optional: Sense HAT (optional replacement for the BME680, but does not include an air quality sensor)
  • Optional: 1-wire temperature sensor (temperature only)
  • Optional: Pimoroni Enviro+ Air Quality (only supports Temp, Humidity, Pressure, Light (Lux), NH3, Oxidising and Reducing Gases currently)
  • Optional: Male-to-female Dupont cables (optional)

You can get hold of the Bosch BME680 sensor on a breakout board from a variety of vendors too, all at varying costs. If you’d like to do everything without a soldering iron, take a look at Pimoroni, who offer a BME680 breakout board compatible with their breakout garden HAT so that everything plugs together with no soldering required. If you don't want to do any soldering and are happy to sacrifice the air quality reading, you can also use the Sense HAT, with the added bonus that you'll get a smiley face showing on the LED matrix! However, if you're buying hardware specifically for this project, get one of the BME680 options below, don't buy a Sense-HAT just for this! If you only need temperature readings, you can find DS18B20 1-wire sensors readily available on eBay (and much cheaper than the BME680 or Sense-HAT), with minimal soldering required.

If you’re happy to do a little soldering, that opens up a few more options:

Software required

Running this project is as simple as deploying it to a balenaCloud application.

One-click deploy to balenaCloud:

Configuration

Sensor offsets

If required, this project supports offsetting of the measured values before they are recorded in the database.

To offset temperature, add a balenaCloud environment variable called BALENASENSE_TEMP_OFFSET, and add an offset in degrees C.

To offset humidity, add a balenaCloud environment variable called BALENASENSE_HUM_OFFSET and add a value in % RH.

To adjust the pressure sensor and compensate for altitude, add a balenaCloud environment variable called BALENASENSE_ALTITUDE and set it to your altitude above sea level in meters.

Using 1-wire sensors

To use 1-wire sensors such as the DS18B20 on the Raspberry Pi, you'll need to enable the 1-wire GPIO interface by adding the w1-gpio device tree overlay. Information on the 1-wire interface is available at pinout.xyz, but in the case of BalenaOS, you can do this easily in the Device Configuration section of the BalenaCloud dashboard by adding a custom configuration variable called RESIN_HOST_CONFIG_dtoverlay, with value w1-gpio.

More information about device tree overlays and other advanced boot settings for the Raspberry Pi is available in the BalenaOS docs and BalenaCloud management reference section.

Hardware setup

The Pi Hut guide to using a DS18B20 sensor with a Raspberry Pi shows how to wire these sensors up. Don't forget you'll need a pullup resistor between the Vin and data lines.

Multiple 1-wire sensors on one device

1-wire devices each have a unique ID; if you have more than one sensor attached to your Raspberry Pi, it is possible to select which one to use by setting the BALENASENSE_1WIRE_SENSOR_ID device variable in BalenaCloud. If no ID is given, the first sensor found will be used.

For more information about how to find the ID for 1-wire devices, the Pi Hut guide referenced above, or this Raspberry Pi tutorial are useful.

Data outputs

Versions of balenaSense after v1.5 introduce Telegraf to capture the data from the sensor which permits the feed of data to other sources in addition to the internal InfluxDB instance.

Feeding to InfluxDB cloud 2.0

Configure the following environment variables within the balenaCloud dashboard to enable the feed to the InfluxDB Cloud 2.0 service:

  • INFLUX_BUCKET - the name of the bucket you created
  • INFLUX_ORG - your login email address used for InfluxDB cloud
  • INFLUX_TOKEN - the read/write token for your bucket
Feeding to an external InfluxDB instance

Configure the following environment variables within the balenaCloud dashboard to enable a feed to an external InfluxDB instance:

  • INFLUXDB_EXTERNAL_URL - the HTTP URL to your InfluxDB instance
  • INFLUXDB_EXTERNAL_USERNAME - the username for authentication to your InfluxDB instance
  • INFLUXDB_EXTERNAL_PASSWORD - the password for authentication to your InfluxDB instance
Output to MQTT

Versions of balenaSense after v1.7 have an integrated MQTT broker available on port 1883. You can configure Telegraf to output the sensor data using MQTT by setting the TELEGRAF_MQTT_URL_PORT environment variable as follows:

  • INTERNAL - Telegraf will send the sensor data to the internal MQTT broker, which other devices on your network can subscribe to and obtain the data
  • ip:port - Set to the IP address and port (for instance 192.168.1.100:1883) of an MQTT broker on your network and Telegraf will publish the data to that address (Do not prepend with "mqtt://")
  • empty - Set the variable to an empty value or delete it to prevent Telegraf from publishing the sensor data via MQTT (this is the default state)

The MQTT topic will be published in the format balena-sense/(hostname)/balena-sense and the data will be in JSON format. The default hostname is the first seven characters of the unique device UUID, available on the dashboard. Note that if you change the hostname, the topic will still use the first seven characters of the device UUID.

Multiple sensors

If you're feeding to one of the above services and have multiple sensors, you can add the BALENASENSE_ID variable to each of your devices. This will then be passed to the output database along with the measurements, allowing you to filter and plot metrics from each device individually.

Setup guides

A full guide covering the initial setup of this project is available on our blog.

We published an additional blog covering the setup of a fleet of balenaSense devices to feed to a central database on our blog here.

Become a balena poweruser

Want to learn more about what makes balena work? Try one of our masterclasses. Each lesson is a self-contained, deeply detailed walkthrough on core skills you need to be successful with your next edge project.

Check them out at our docs. Also, reach out to us on the Forums if you need help.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].