Raspberry PI thermometer using DS18B20 sensor with d3.js v4 chart and RESTful API
Connect DS18B20 to RPI using 4.7K resistor as seen on below diagram
- Install W1ThermSensor
pip install w1thermsensor
- Install Flask
pip install Flask
- Install SQLAlchemy
pip install flask-sqlalchemy
- Install SQLite3
pip install sqlite3
- Initialize database from schema
sqlite3 temp.db < schema.sql
- Run probing program in background
nohup python measure.py &
- Run flask app
export FLASK_APP=api.py
flask run --host=0.0.0.0
- 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
}
- Dashboard should be accessible at http://127.0.0.1:5000/