Coder Social home page Coder Social logo

thapmu's Introduction

Logo

THAPMU

Docker Pulls
THAPMU stands for Temerature, Humiditity and Air Pressure Measurement Unit.

Story

I wanted to create a small, cheap and easy to make IoT sensor, that works with nearly anything,
to monitor the temerapture and humidity levels of multiple rooms.

Hardware

The custom PCB is a very simple power adapter to power and connect the sensor and the ESP.

Software

It uses ESPHome, MQTT, InfluxDB and a script to connect all this together.
I found a code very similar and nearly perfect for my use.
I only modified it a little to make it a perfect fit.
It uses Grafana to visualize the data, but anything else can be used.

Installation

Docker (recomended)

Follow the Guide on Docker Hub

Manual

Download the thapmu.sh with wget or any other way.

wget https://raw.githubusercontent.com/KGeri201/THAPMU/main/thapmu.sh

And execute it as sudo

sudo ./thapmu.sh

Step by step

Grafana will be added to apt sources.
All the needed packages will be installed

apt-get install -y influxdb influxdb-client mosquitto mosquitto-clients python3 python3-pip grafana-enterprise

All the neded files will be downloaded.

wget -q -O /tmp/requirements.txt https://raw.githubusercontent.com/KGeri201/THAPMU/main/requirements.txt
wget -q -O MQTTInfluxDBBridge.py https://raw.githubusercontent.com/KGeri201/THAPMU/main/MQTTInfluxDBBridge.py
wget -q -O /etc/systemd/system/mqttinfluxdbbridge.service https://raw.githubusercontent.com/KGeri201/THAPMU/main/mqttinfluxdbbridge.service

Additional config will be added to mosquitto

echo "listener 1883" > /etc/mosquitto/conf.d/allow.conf && echo "allow_anonymous true" >> /etc/mosquitto/conf.d/allow.conf

Python libraries will also be installed

pip3 -q install -r /tmp/requirements.txt

Database will be set up, and services will be started

systemctl start mqttinfluxdbbridge
systemctl start grafana-server
systemctl restart influxdb
systemctl start mosquitto

Additionaly you can also enable all the services to start automatically after starting the device

systemctl enable mosquitto
systemctl enable influxdb
systemctl enable grafana-server
systemctl enable mqttinfluxdbbridge

Sensor

Requirements

  • 1 THAPMU board (fully fitted, and ready to use)
  • 1 ESP01 breakout board
  • 1 BME or BMP sensor
  • an extra external serial adapter to flash your ESP
  • an USB-C cable to power the board.

Instructions

ESPHome

  1. Install ESPHome on a server.
  2. Go to http://ip-of-your-server:6052
  3. Add new device.
  4. Load the example_esphome.conf and edit the values to fit your needs.
    Make sure that the right sensor is selected and all the credentials are right.
  5. Flash the code to the ESP following the guide from ESPHome

Legacy

  1. Open the code for the ESP and change the library according to your sensor.
#include <Adafruit_BME280.h>

// Sensor I2C
Adafruit_BME280 sensor;
  1. Fill in your WLAN SSID and password, and the address of the MQTT broker.
    If your MQTT broker needs credentials to authenticate, set them.
    Also add the location and the name of the device.
#define NAME "NAME_OF_THE_DEVICE"
#define LOCATION "LOCATION_OF_THE_DEVICE"
#define WIFI_SSID "REPLACE_WITH_YOUR_SSID"
#define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD"

// Raspberri Pi Mosquitto MQTT Broker
#define MQTT_HOST IPAddress(X, X, X, X)
// For a cloud MQTT broker, type the domain name
//#define MQTT_HOST "example.com"
#define MQTT_PORT 1883
// If your MQTT broker requires authentication, set them below
#define MQTT_USER ""
#define MQTT_PASSWORD ""
  1. Flash the ESP.
  2. Plug the board in somewhere and wait for it to connect to your WLAN and to the Server, which you previously set up (decribed under Installation).
  3. Go to the Grafana site, hosted on your server http://ip-of-your-server:3000 and login with the default credentials.
  4. Under the Configurations add the InfluxDB data source.
    Fill in the name of the database, user and password.
    These you have set during the setup process.
  5. Make a new dashboard with the newly added InfluxDB datasource and choose the measurement.
    There are three topics:
    • THAPMU/LOCATION/NAME/sensor/temperature/state
    • THAPMU/LOCATION/NAME/sensor/humidity/state
    • THAPMU/LOCATION/NAME/sensor/pressure/state
  6. You are up and running.

Credits

HimbeersaftLP
KGeri201

License

Apache License 2.0

Project status

Ready to deploy.

thapmu's People

Contributors

kgeri201 avatar

Stargazers

 avatar Himbeer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.