Here is a datalogger I have built with an old PCB from a project. The PCB itself has different sensors such as NTC, flow sensors, resistors and leds. I have used the NTCs sensors to retrieve the values every minute and send to a Server.
For this I have used Django and Charisma django, a port from a html template I have made (for more information visit this post).
I placed a sensor outside my window, two inside the room and one inside the radiator. The microcontroller use ADC interrupts to poll the temperature and send it over serialport to a WiFi module. This WiFi module send the data to the server.
I have ported charisma admin template from usman to django. Check the live version here.
To install use
pip install django-charisma
Collect static and add urls:
python manage.py collectstatic
You can modify the boxes and create/include in every page as follow:
{% extends 'charisma_django/base.html' %}
{% block content %}
{% include 'charisma_django/breadcrumb.html' %}
{% include 'charisma_django/boxes/four_blocks.html' %}
<div class="row">
{% include 'charisma_django/boxes/introduccion.html' with colmdwidth='12' %}
</div>
<div class="row">
{% include 'charisma_django/boxes/buttons1.html' with colmdid='buttons1' %}
{% include 'charisma_django/boxes/buttons2.html' with colmdid='buttons2' %}
{% include 'charisma_django/boxes/weekly_stats.html' with colmdid='weeklystats' %}
</div>
<div class="row">
{% include 'charisma_django/boxes/member_activity.html' with colmdid='memberactivity' %}
{% include 'charisma_django/boxes/tabs.html' with colmdid='tabs' %}
{% include 'charisma_django/boxes/keep_in_touch.html' with colmdid='keepintouch' %}
</div>
{% endblock %}
I have created a datalogger with this template and old PCB from a project. Check it out here.
If you have some doubts do not hesitate to contact me at grrodre@gmail.com
Nginx will act as a proxy server and virtualenv will keep different Django’s instances separated.
Create a folder for the web. I will use /opt/DjangoWeb1/ and install there the virtualenv.
mkdir /opt/DjangoWeb1/
cd /opt/DjangoWeb1/
virtualenv venbdjango1
Log with postgres user and launch psql.
su postgres
psql
Create database for Django with postgresql.
CREATE DATABASE djangoweb1;
CREATE USER djangouser1 WITH PASSWORD 'djangopassword1';
ALTER ROLE djangouser1 SET client_encoding TO 'utf8';
ALTER ROLE djangouser1 SET default_transaction_isolation TO 'read committed';
ALTER ROLE djangouser1 SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE djangoweb1 TO djangouser1;
Activate the virtual enviroment and install Django, gunicorn and support for postgresql.