maciejd / rpi-iot-thermometer

Raspberry PI thermometer using DS18B20 sensor with d3.js v4 chart, Flask and SQLAlchemy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rpi-iot-thermometer

Raspberry PI thermometer using DS18B20 sensor with d3.js v4 chart and RESTful API

Hardware

Connect DS18B20 to RPI using 4.7K resistor as seen on below diagram

Wiring

Software

  1. Install W1ThermSensor pip install w1thermsensor
  2. Install Flask pip install Flask
  3. Install SQLAlchemy pip install flask-sqlalchemy
  4. Install SQLite3 pip install sqlite3

Run

  1. Initialize database from schema sqlite3 temp.db < schema.sql
  2. Run probing program in background nohup python measure.py &
  3. Run flask app
  • export FLASK_APP=api.py
  • flask run --host=0.0.0.0

Test

  • You should be able to access REST API at http://127.0.0.1:5000/temp
{
  "measured_at": "Sat, 03 Dec 2016 14:20:51 GMT", 
  "temperature": 1.5
}

About

Raspberry PI thermometer using DS18B20 sensor with d3.js v4 chart, Flask and SQLAlchemy


Languages

Language:HTML 53.3%Language:Python 46.7%