ideadlyfury
Posts: 1
Joined: Tue Apr 24, 2018 8:21 am

COMPLETE BEGINNER with using raspberry pi3 , flask , usb rs485 and r414a01 temperature sensor

Thu Apr 26, 2018 6:37 am

I have to develop a web page to monitor humidity and temperature for my school project. i will have to Capture real data (air temperature and relative humidity) with r414a01 temperature sensor connected to raspberry pi3 using usb rs485 . The reading will be store at sqlite database which i have done . I do not know how to extract the reading use python and store it at sqlite .then make everything appear online through local web server created using python and flask

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: COMPLETE BEGINNER with using raspberry pi3 , flask , usb rs485 and r414a01 temperature sensor

Thu Apr 26, 2018 3:41 pm

ideadlyfury wrote:
Thu Apr 26, 2018 6:37 am
I have to develop a web page to monitor humidity and temperature for my school project. ....then make everything appear online through local web server created using python and flask
you should learn python flask in detail, it is very powerful, and fun, but possibly your time is short.
in the last days i programmed in python3 one shortcut to bring some small stuff online,
and just today i put it in a template you can use.

the strange point about that concept is, the program you play with is a pure python3, has nothing to do with flask and webserver.
but what it does, it sends the line you print on the terminal ( text, sensor data ) also to a file
www/templates/index.html
and manually you can start ( in a other terminal window )
./www/flask_server.py
( what the program ( at the beginning) also creates..)
and that puts/serves that html file to the local LAN
so the flask server is used in the most simple way, to serve a static index.html file.
my trick is just when you run the program again ( kind of offline ) it is overwriting that html file...

my blog at the end find just the web-job template and the code

worst case you can have 3 separate programs running:
-a- your program what reads the sensors and writes it to the database
-b- my template where you change
++ read from database
++ optional some evaluation like min avg max..
++ print to terminal
( i do the rest by copy it to html )
-c- my flask server ( you have to start manually )

Return to “Beginners”