Skip to content

This repo contains code for a weekend project for using my fri3d badge as an mqtt-connected dht22 sensor that sends data to an orange pi 5 with Orange Pi Os which runs a combination of node red with an mqtt broker and prometheus exporter, prometheus and grafana in docker containers.

License

Notifications You must be signed in to change notification settings

francisduvivier/fri3dbadge2020-dht22-to-grafana

Repository files navigation

Weekend Project: Fri3d Badge 2020 + DHT22 Humidity Sensor + Orange Pi 5 => Grafana Dashboard

This repo contains code for a weekend project for using my fri3d badge as an mqtt-connected dht22 sensor that sends data to an Orange Pi 5 with Orange Pi Os which runs a combination of Node-RED with an MQTT Broker and a Prometheus exporter, Prometheus and Grafana in Docker containers.

Result pictures

Grafana Dashboard running from Docker containers on Orange Pi 5 Badge showing DHT22 readings
Front Of Fri3d badge showing humidity, temperature and wifi and mqtt connection Front Of Fri3d badge showing humidity, temperature and wifi and mqtt connection

Notes about Flashing the Fri3d badge

Bootloader mode needs to be activated

In order to flash the Fri3d badge, you should know that the esp32 first needs to be put into bootloader mode.

What works for me to do this is:

  • I took out the battery
  • turned the on-off switch to on (display switch doesn't matter),
  • held the boot button on the badge while plugging in the usb cable in
  • then pressed the reset button and release the boot button.

Probably it can be simpler than these steps though, but this works as well.

Arduino IDE setup for development and flashing

To get the Arduino Ide working for reading and showing DHT values on the Fri3d Badge, the following steps were done:

  • Add the ESP32 board manager url
  • install the ESP boards
  • Install Adafruit GFX Library
  • Install Adafruit's DHT Sensor Library
  • Install Display library: https://github.com/adafruit/Adafruit-ST7735-Library
  • Then select ESP32 Dev Module as the board
  • Then select the upload port
  • Then flash after putting the device in bootloader mode. Then for the mqtt, ota, wifi and async event code I added some more libraries:
  • knolleary/PubSubClient@^2.8
  • aasim-a/AsyncTimer@^2.4.0
  • ArduinoOTA

Note that to make this work on linux mint I had to change some group stuff for being able to access the dev/ttyUSB0 as non-root. Following https://askubuntu.com/questions/133235/how-do-i-allow-non-root-access-to-ttyusb0, I did:

  • sudo usermod -a -G dialout $USER
  • reboot on my linux mint development pc

Notes regarding Web Flashing options

Arduino Web Editor

  • Conclusion: not really usable for development! See below
  • Flashing and arduino development is possible from web with the Arduino Web Editor : https://create.arduino.cc/editor. Notes here:
    • Has a limit on the amount of times you can compile in the free version
    • Requires a plugin to be installed
    • In my case, on linux mint, I also needed to install an extra package
    • Board to select is ESP32 Dev Module
    • The web interface runs stuff on the host pc via the plugin, and also allows to load zipped library files in the cloud compilation environment, so we can zip and load the Fri3d Badge 2020 Arduino Library zip. https://github.com/Fri3dCamp/Badge2020_arduino/archive/refs/heads/main.zip library.

Fried Flasher

  • For the Fri3d firmware zip files, you can use https://fri3d-flasher.vercel.app/#/
  • This might be useful if you want to go back to original firmware, or just wanna try that flashing works.

Notes regarding Orange Pi OS

Orange Pi OS looks to be an armbian arm64 fork with some tweaks for adding their UI and some extra software. Notably:

  • You can easily install some media server software and a pi hole from the orangepi-config tool
  • Docker and docker-compose is already preinstalled and working well
  • armbian in the commands are renamed to orangepi, so eg orangepi-config instead of armbian-config, but also orangepimonitor instead of armbianmonitor etc.

Default username and password is root: orangepi. default hostname is orangepi5

About Orange Pi Docker setup

to start the required Docker containers, we need to create some directories for Node-RED, Prometheus and Grafana data with correct access rights for Docker and then starting the containers with docker-compose. You can do this by running:

  • ./go.sh

Hardware

Back of Badge Picture with soldered wires

Back of Fri3d badge showing soldered wires for dht22 connection

TODO

  • Clean up Arduino Code
  • Make it more efficient to add and extra device or an extra sensor
  • Improve documentation regarding Node-RED and Grafana configuration after deployment
  • Include Node-Red Config in Docker image or mounted files in deployment
  • Include Grafana Config in new Docker image or mounted files in deployment
  • Add Wiring diagram
  • Make project Simulatable in WokWi (de display is an issue here)
  • Test Arduino OTA updates

Useful related links:

Fri3d Badge

Node-RED + Plugins + Docker + Prometheus + Grafana

Orange Pi 5 with Orange Pi OS

My Node-RED docker image for this:

Web Arduino And ESP32 simulator: project used for trying out text centering code:

DHT22 Temperature and Humidity sensor

About

This repo contains code for a weekend project for using my fri3d badge as an mqtt-connected dht22 sensor that sends data to an orange pi 5 with Orange Pi Os which runs a combination of node red with an mqtt broker and prometheus exporter, prometheus and grafana in docker containers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published