An indoor temperature and humidity monitoring project.
View App
·
Demo Video
·
Report Bug
·
Request Feature
Table of Contents
This is a hobby project in which sensor data is being published to a heroku database and can be visualized using a dash web app. This project can be repurposed to visualize any type of numeric data from sensors.
To get started with this project you will need:
- Arduino UNO
- DHT11 Sensor
- Install python requirements
pip3 install -r requirements.txt
- Install Heroku
Build the circuit according to the schematic.
After completing the hardware part upload temperature_monitor.ino to the arduino.
First we need to create a heroku app. Ensure you have installed heroku by running heroku -v
. To create an app follow these steps:
- Login to heroku.
heroku login
- Create a heroku app.
heroku create app-name
- Once the app is created, we have to add the Heroku Postgresql add-on.
heroku addons:create heroku-postgresql:hobby-dev
- After adding the add-on, we have to create a table on the app database.
heroku pg:psql -a app-name
CREATE TABLE dht_data (
reading_id serial not null,
created_on timestamptz not null,
temperature numeric(4,2) not null,
humidity numeric(4,2) not null
);
This wil create a table named 'dht_data' with columns created_on, logged_on, temperature and humidity. We can now push data to our database from our temperature logger script.
To setup the logger to push data to our database, create a file database.ini in the logger folder and fill it with with the database details. Template for database.ini file -
[postgresql]
dbname=
host=
port=
user=
password=
sslmode=require
You can get the details by running
heroku pg:credentials:url -a app-name.
Once your are done with this you can adjust the timezone, time between readings and arduino port number in the temperature_logger.py file. You can get your time zone name from here. Example -
TIMEZONE = "Asia/Calcutta"
TIME_BETWEEN_READINGS = timedelta(minutes=1)
DEVICE_PATH = '/dev/ttyACM0'
If you want other durations you can use this
timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
To log sensor data:
- Check the
DEVICE_PATH
is set correcly intemperature_logger.py
- Run
python3 temperature_logger.py
(Be sure to run it from the /logger folder)
We are only deploying the App folder of the project on Heorku. To do this, we make use of the subtree command in git. Run this to push the App to heroku
git subtree --prefix App push heroku main
Once the app is deployed, it will print a url like http://temperature-monitor.herokuapp.com which you can visit to view the app.
Running locally is required to test changes before deploying the app. Here is how to do it.
cd
toApp
folder and copy Heroku config vars to local .env file.
heroku config:get DATABASE_URL -s >> .env
- Run the app.
heroku local
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Ammaar Solkar - asketch8@gmail.com
Project Link: https://github.com/ammaar8/temperature-monitor