GithubHelp home page GithubHelp logo

cwalk / pi-temp Goto Github PK

View Code? Open in Web Editor NEW
136.0 26.0 68.0 268 KB

Web server using a Raspberry Pi and DHT22 sensor to graph the humidity and temperature in my apartment over time.

Python 4.17% HTML 6.08% CSS 11.76% JavaScript 77.98%
sensor-data humidity temperature graph raspberry-pi python web-development javascript html5 css3

pi-temp's Introduction

Introduction

Web server using a Raspberry Pi and DHT22 sensor to graph the humidity and temperature in my apartment over time. The data can be accessed over a web browser.

Skills I learned during this project:

  • Setup the minimal Raspbian operating system to the RPi, called Minibian
  • Install and use Python, and the Python virtual environment
  • Install and use Flask, a Python-based web micro-framework
  • Install and use uWSGI as the application server for Flask
  • Install and use Nginx light-weight web server
  • Use Skeleton to make the web UI look better
  • Use the RPi GPIOs as digital input and outputs
  • Use a DHT22 humidity and temperature sensor
  • Install and use the SQLite database to store sensor data
  • Add a cron job to store sensor data every so many minutes
  • Use the Google Chart API to create visual representations of the sensor data
  • Use Javascript/JQuery to add interactivity to web pages
  • Use Plotly for graphical analysis of sensor data

Summary

The lab_app folder contains the code for the project (The html folder, button.py, and blink.py were just for testing purposes).

Inside lab_app you will find the main python server, lab_app.py. This uses a cronjob to take a temperature and humidity reading every so many minutes, and stores it in a sqlite database. The web server has 2 views, lab_temp.html and lab_env_db.html, which I refer to as current view and historic view respectively.

Current

In the current view, the current temperature and humidity taken from the sensor is displayed on the web page. This page updates every 10 seconds, and has a link to the historic view.

Historic

The historic view has a couple features. The first is a to and from date input, which uses a date time picker plugin. Combined with a submit button, this allows you to view the temperature and humidity data within any date time range easily. The next feature are four radio buttons, to easily see the last 3, 6, 12, and 24 hours of data. There are two links, one to the current view, and another to export the data to Plotly. Clicking this link will send you to plotly and show you a graph of Temperature vs Humidity.

The main view are 2 tables combined with Google Charts graphs. The tables both scroll, and the charts display data across the time selected. The times are displayed in your own time zone, as it is determined from your browser.

YouTube

YouTube: https://www.youtube.com/watch?v=hFqNiZ4p0Ss

Circuit Diagram

Circuit Diagram

pi-temp's People

Contributors

cwalk avatar walkc120 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pi-temp's Issues

syntax error

With the release of the 3.0 version of Python, the print function '()' is essential.
Perhaps written in the previous version, without '()'.
I want to know the latest Python code Plz T.T

Installation instructions?

Hi, i was wondering if there is an instruction on how to install the code on raspberry pi and set everything up.
Video did not cover anything for installation.

Thanks.

step by step install

please you can add step by step installation.
i don't know how to use coding so usually i look step by step. if possible you can add installation file.

thanks

Html error

This project is great! I have little problem. When i work on the html files, for example lab_env_db.html, and run it on web browser (with install all programs in the list), i see it like pic part 1, but it should be like in pic part 2. Any help?
92037625_1924719497658294_8241825688772935680_o

SyntaxError: invalid syntax

Mr. Walker I like your project!
You have done an excellent work, but I am trying to make it run and I am having these errors.
I am new in this, I would appreciate any help!
Thank you

Traceback (most recent call last):
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/bin/flask", line 11, in <module>
    sys.exit(main())
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 906, in main
    cli.main(args=args, prog_name=name)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 569, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 779, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 300, in __init__
    self._load_unlocked()
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 324, in _load_unlocked
    self._app = rv = self.loader()
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 381, in load_app
    app = locate_app(self, import_name, name)
  File "/home/pi/Workspace/Pi-Temp/lab_app/env/lib/python3.5/site-packages/flask/cli.py", line 236, in locate_app
    __import__(module_name)
  File "/home/pi/Workspace/Pi-Temp/lab_app/lab_app.py", line 85
    print "rendering lab_env_db.html with: %s, %s, %s" % (timezone, from_date_str, to_date_str)
                                                     ^
SyntaxError: invalid syntax

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.