Recap
This page explains how the MyAWOS software components interact with each other.
The system is composed of several scripts running on the Arduino and Raspberry Pi that work together to detect radio clicks, retrieve weather data, generate an audio report, and transmit it over the radio.
Gee wiz! This is a nightmare, where is the image file that I download? Why can't I just buy this thing!
Yup - this is a hack. It's a good hack and cost effective hack, but its a hacked together project.
Why? The parts I used puts this project into the $2,000+ USD range. That is big ask for alot of small airports around the world. The Davis Instruments Weather Station can be replaced with an Ecowitt for $1,000 USD less. The Yaesu radio can be replaced $100 USD less. The list goes on an on. So to make it affordable it has to be modulable for what people have on hand and can afford. If you need help moving some component to your equipment let me know happy to help.
The code is broken in down into multiple layers and components. Its pretty easy to switch things in and out.
For example, you want to replace the relay with a transistor? Want to replace the Arduino with a LM393? Once you know the flow of the application this will be a trivial task.
If you are using the Davis Instruments, the code leverages the weather_link_live python library. A python script weather.py gets data from the API, which in turn gets information from your weather station, and prints out the information in a file called weather.txt. This contains the time in Zulu, wind direction, wind speed, peak wind gusts, altimeter, temperature and dewpoint. Pretty much everything but cloud height, though you can do the math with temperature and dewpoint to get the lapse rate and make an educated estimate.
There is a cron job that runs weather.py and then runs a perl script to parse that data, adeptly named convert_weather_txt_to_wav.pl. This perl script outputs a shell script named generate.sh which makes a wav file called current.wav.
The Arduino listens for the audio coming from the Yaesu 550 Radio on the speaker/tip/red wire.
FILE: arduino_click.ino
You might want to change the parameters based on the radio you are using - you would change A0Value match to fit when the Arduino notices a click. This application/device outputs to the serial port.
FILE: click_listen.py
This runs on the Raspberry Pi and listens to the serial port (USB port) of the arduino. When it gets the correct CLICK message it calls enablePTT.py - which turns on the relay. It then calls aplay, a linux application, that plays an audio file of the current weather - named current.wav. disablePTT.py is then called to turn off the relay.
Step by Step
Step 1: Weather.py gets Weather Information from Weather Station and writes to weather.txt
Step 2: convert_weather_txt_to_wav.pl parses weather.txt and outputs a shell script called generate.sh which makes your audio file called current.wav
Step 3: arduino_click.ino is running on the Arduino for clicks, it writes out the serial/usb port when it gets enough
Step 4: click_listen.py is running on the Raspberry Pi reading the serial/usb port. When it gets the message it enables the relay, plays the audio file and disables the relay.
There is of course the matter of making cron jobs and making click_listen.py a service that starts when the Raspberry Pi starts and a whole host of other little tasks.