Nov 172022
 

You can built your own weather station using Argent ADS-WS1 or any other devices that capable submiting to aprs-is or cwop network, but it was too expensive for me.
i began my research how to craft APRS WX packet using python and bash script on direwolf. that
was not easy for newbie amateur like me, LOL. Luckily i’ve found aprs-weather-submit created by KC1HBK.
it makes my research easier.

first of all, we need some hardwares Raspi Zero, BME280 sensorand some jumper wires.
Conect all wires from pi zero to bme280 using i2c pin. you can find pinout configuration here:

https://pinout.xyz

or type pinout in ssh shell

don’t forget to activate i2c pin, go ssh shell. issue command sudo raspi-config and go to interface options to activate i2c

Wiring:

  1. BME280 VIN pin connects to GPIO pin 1 (3.3V)
  2. BME280 GND pin connects to GPIO pin 6 (GND)
  3. BME280 SCL pin connects to GPIO pin 5 (SCL)
  4. BME280 SDA pin connects to GPIO pin 3 (SDA)

i’m using python and bme280 library from https://github.com/pimoroni/bme280-python
there’s some example script there, i silghtly modify the script to obtain bme280 values

building aprs-weather-submit.

git clone https://github.com/rhymeswithmogul/aprs-weather-submit.git

cd aprs-weather-submit

follow the instructions at build scripts section here:

https://github.com/rhymeswithmogul/aprs-weather-submit/blob/master/INSTALL.md

./autogen.sh ./configure [--disable-aprs-is] [--enable-debug] 
make 
sudo make install

when i first compiled, i got this error:

modify main.c

vi src/main.c

at line 588

i changed this line from:

(note at %lu)

fprintf(stderr, “Your comment was %lu characters long, but APRS allows %u characters. Your comment was truncated.\n”, strlen(optarg), MAX_COMMENT_LENGTH);

i changed it to %ul

than it compiled propperly.

here is my wx.sh script to generate wx format:

wx.sh

#!/bin/bash
STR=$(/home/pi/bme280_cjb_AA.py)

Temp=$(echo $STR | cut -f 1 -d" ")
Hum=$(echo $STR | cut -f 3 -d" ")
Bar=$(echo $STR | cut -f 2 -d" ")
Alt=$(echo $STR | cut -f 4 -d" ")
#aprs-weather-submit -k YD0BCX-13 -n -06.714692S -e 106.728514 -t $Temp -A $Alt -h $Hum -b $Bar -V 9
STR2=$(aprs-weather-submit -k YD0BCX-13 -n -6.198611 -e 106.87000E -T $Temp -h $Hum -b $Bar -M " WX on Pi Zero + BME280 + DW 1.7")

echo "${STR2:22}"
#echo "$Temp $Hum $Bar $Alt"

/home/pi/bme280_cjb_AA.py

chmod 755 bme280_cjb_AA.py

#!/usr/bin/env python
#Import modules for time and to access sensor
import time
from smbus import SMBus
from bme280 import BME280
#Initialise the BME280
bus = SMBus(1)
bme280 = BME280(i2c_dev=bus)
#Get data and discard to avoid garbage first reading
temperature = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()
altitude = bme280.get_altitude()
time.sleep(1)
#while True:
temperature = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()
altitude = bme280.get_altitude()
if ( temperature and pressure and humidity and altitude ):
print('{:05.2f} {:05.2f} {:05.2f}'.format(temperature, pressure, humidity), round(altitude),  end="")
time.sleep(1)

in wx.sh, there’s command part
echo “${STR2:22}”

this command will remove leading 22 characters(based on my lat long value)
in this case when i’m executing aprs-weather-submit -k YD0BCX-13 -n -6.198611 -e 106.87000E
the result will be:
YD0BCX-13>APRS,TCPIP:@200431z0611.92S/10652.20E_…/…t…aprs-weather-submit/1.6

we need to remove “YD0BCX-13>APRS,TCPIP:” part, that’s what “echo “${STR2:22}”” is for.

if it’s not removed direwolf will also submit those part and make it position beacon failed to aprs-is(YD0BCX-13>APRS,TCPIP*: submit 2 times)

direwolf configuration:

ADEVICE plughw:1,0
#ACHANNELS 1
#CHANNEL 0
MYCALL YOURCALLSIGN
MODEM 1200
IGSERVER rotate.aprs2.net
IGLOGIN YOURCALLSIGN passcode

CBEACON sendto=IG delay=1 every=05:00 infocmd="echo '>WX Station' $(date)"

CBEACON sendto=IG delay=01:10 every=10:00 infocmd="telem-parm.pl YD0BCX-13 Temperature Pressure Humidity Altitude"
CBEACON sendto=IG delay=01:11 every=10:00 infocmd="telem-unit.pl YD0BCX-13 deg.C hPa % masl"
CBEACON sendto=IG delay=01:11 every=10:00 infocmd="telem-eqns.pl YD0BCX-13 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0"
CBEACON sendto=IG delay=01:15 every=10:00 infocmd="telem-data.pl telem-seq.sh /home/pi/bme280_cjb_AA.py"

CBEACON sendto=IG delay=1 every=05:00 infocmd="/home/pi/wx.sh"

IBEACON sendto=IG delay=30 every=30 via=WIDE1-1

LOGDIR /var/log/direwolf
PTT GPIO 21

note on direwolf configuration, i also submiting telemetries data, you can ommit it if you want.
i think that’s it. i’m not good at talking or writing.

if there’s something to ask just drop me a message 😀