Home
Name Modified Size InfoDownloads / Week
version.txt 2021-04-13 104 Bytes
tfa.py 2021-04-13 3.3 kB
transfer.py 2021-04-13 1.7 kB
SensorID.cpp 2021-04-13 1.0 kB
plot.py 2021-04-13 2.4 kB
README.md 2021-04-13 2.4 kB
LICENSE 2021-04-13 35.1 kB
gettemp.cpp 2021-04-13 3.0 kB
getID.sh 2021-04-13 431 Bytes
copyto.py 2021-04-13 825 Bytes
createdevice.cpp 2021-04-13 739 Bytes
bmp180.c 2021-04-13 10.9 kB
bmp180.cpp 2021-04-13 10.6 kB
Totals: 13 Items   72.7 kB 0

Weatherstation with tfa outdoorsensors

This project is based on the project tfrec

I use it on a raspberry 3B+, because its consumes less power than a PC.

First, build the executable and place it in /opt/tfrec or wherever you want. In this project, /opt/tfrec is used as it is a common place to hold extern programs.

First, you have to collect the SensorsIDs by running ./getID.sh. The IDs are received and each ID is written in a file called /tmp/tfa/IDs.txt. Each ID received is compared to the IDs in that file and if is it new (=not found in file) it is written in it. So the file has exactly all the different ID's received.

Run the file ./createdevice to create virtual files for each sensor detected and listed in /tmp/tfa/IDs.txt) Create a file /tmp/tfa/sensors.txt from the file /tmp/tfa/IDs.txt by adding the sensors name right to its ID separated by ':' (11009fc0:garden). Copy this file also to a safe place.

Create a service tfa by writing a file /etc/systemd/system/tfa.service:

[Unit]
Description=tfa Sensors service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=pi
ExecStart=/opt/tfrec/run-tfrec.sh

[Install]
WantedBy=multi.user.target

Copy the tfrec binary to /opt/tfrec/tfrec(We have already done it before)

Create a file run-tfrec.sh:

#!/bin/bash
TFREC_HOME=/opt/tfrec
exec "$TFREC_HOME/tfrec" -W -e /path/to/gettemp
echo "tfrec"

and make it executable.

create a cron job calling bmp180 and tfa.py every 5 minutes:


* * * * * /path/to/bmp180
2,7,12,17,22,27,32,37,42,47,52,57 * * * * /path/to/tfa.py

-> the different times(!=*/5) are necessary, because certain sensors have not sent a signal on 00:00, so the time label refers to the day before -> problems in plot!

Then start the service tfa by typing sudo service tfa start. Verify if it's running by typing sudo service tfa status. Each time, the program receives data, it is written in itsfile (identified by its ID). The same happens with the barometric pressure received by the bmp180 by starting ./bmp180.

You can visualise the data received by calling ./plot.py

Todo:

  • Rewrite the README.md
  • use of configuration files in python
  • Draw a the electrical circuit to use a bmp180 (airpressure and temperature-sensor) using fritzing
  • Explain the use of plots
Source: README.md, updated 2021-04-13