Benutzer-Werkzeuge

Webseiten-Werkzeuge


usecaseqthtemp

Inhaltsverzeichnis

It might be interesting to get also weather data from the own repeater QTH (parallel to the great APRS-WX rubric 1080). This page describes the periodically sending of a temperature file to DAPNET, generated with a raspberry pi and a temper1f sensor.

Please take this proposal as blueprint for own purposes, therefor the process is kept simple without any if-loops and so on. Useless use of cat intended ;-)

Be aware, that you have to change user and paths to your own system, also root privileges are necessary.

Preparations

First you have to install pi-star-dapnetapi on your raspberry: https://github.com/AndyTaylorTweet/Pi-Star_Binaries_sbin/blob/master/pistar-dapnetapi

Short summary: Copy the script text from the homepage to a local file pistar-dapnetapi.sh and change the permissions with chmod +x pistar-dapnetapi.sh to executable.

Then create a file /etc/dapnetapi.key and add the following content:

[DAPNETAPI] 
USER=oe7bsh 
PASS=irgendwasgeheimesvonhampagerde
TRXAREA=oe-all

Note: Use you hampager.de-credentials for User and Pass and choose a small fitting TXAREA (https://hampager.de/dokuwiki/doku.php?id=transmittergroupgeneral).

For sending messages to the DAPNET we use an additional script from https://einstein.amsterdam/?page_id=2136: Copy the text for msg-pipe.sh into a local file msg-pipe.sh and change the permissions with chmod +x msg-pipe.sh to executable again.

You have to change the placeholder „yourcall“ to your call sign (messages will be sent to this account).

Hardware

We use as sensor a Temper1F, which is attached via USB.

The device is recognized as TEMPer1F_V1.3:

sysop@oe7xxrpi2 ~ $ dmesg
[    2.022900] usb 1-1.2: new low-speed USB device number 4 using dwc_otg
[    2.145985] usb 1-1.2: New USB device found, idVendor=0c45, idProduct=7401
[    2.148555] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.153940] usb 1-1.2: Product: TEMPer1F_V1.3
[    2.156229] usb 1-1.2: Manufacturer: RDing

We need some packages for the reading of the TEMPer1F_V1.3:

apt-get install libusb-dev
git clone https://github.com/petervojtek/usb-thermometer.git
cd usb-thermometer/
cp 99-tempsensor.rules /etc/udev/rules.d/
make
cp pcsensor /usr/local/bin/

Now we can read the sensor with „pcsensor“:

sysop@oe7xxrpi2 ~ $ pcsensor
2018/11/03 11:43:16 Temperature 48.20F 9.00C

Scripting

We can now use pcsensor to create a file with the temperature data (we use temprofan.sh, again chmod +x temprofan.sh afterwards).

#!/bin/bash
cd /home/sysop/dapnet/
 #delete old data
rm smsrofan.txt
rm smsrofan2.txt
#fetch new data
echo „Temp Rofan“ >> /home/sysop/smsrofan.txt
/home/sysop/usb-thermometer/pcsensor -cm | head -n1 >> /home/sysop/smsrofan.txt
cat smsrofan.txt | xargs >> smsrofan2.txt
#transfer to the dapnet-api
cat /home/sysop/dapnet/smsrofan2.txt | /home/sysop/dapnet/msg-pipe.sh

We can now execute the script with ./temprofan.sh and our pager should get the message:

Finally we schedule the data TX to our pager (with crontab –e).

Three cron examples:

every day at 7:05: 5 7 * * * /home/sysop/dapnet/temprofan.sh
at 5 past between 7 and 20: 5 7-20 * * * /home/sysop/dapnet/temprofan.sh
at 5 past at 7, 12 und 20: 5 7,12,20 * * * /home/sysop/dapnet/temprofan.sh

(Note: The last line should be enough, three weather infos each day).

usecaseqthtemp.txt · Zuletzt geändert: 2018/11/03 14:42 von oe7bsh