- Christophe Burki
- Samuel Dolt
If you have a DS18B20 temperature sensor, you can connect it, using this schematic
sudo raspi-config
Go to "9 Advanced Options" then "AA 1-Wire" then "YES"
sudo reboot
This projet use the Rust Programming Language on a Raspberry Pi 3.
To install Rust 1.14.0, run the following command:
curl https://sh.rustup.rs -sSf | sh
rustup default 1.14.0
Get the source code somewhere with Git:
sudo apt install git
git clone git@github.com:BFH-E1D-2015-2016/meteo-backend.git
cd meteo-backend
Using cargo (Rust Package Manager), it's super easy to build and run a project:
cargo run
Goto "http://RASP_IP:8080/static/hello.html" (Replace RASP_IP by the IP addresse of the Raspberry PI).
You can see a chart of all measurement from the sensors
Linux know how 1-Wire sensors works, to get a temperature, we just read a file in /sys/bus/w1/devices.
Our propgram use 3 thread:
- One to read the temperature every x secondes and to store it in a SQLite Database
- One to read the database and create a CSV file with all the database
- One to serve a static website. When someone go to the "hello.html" page, the browser download the CSV files and compute a graph using a javascript library