/AnemIO

Floating weather station for sailing clubs, cottages, and marinas.

Primary LanguagePython

Base Station Information

Setting up and Running the Base Station

The base station (i.e. data collection) software consists of a "radio daemon" and web server, all written in Python. These libraries are meant to run on a Raspberry Pi, and have been conveniently preconfigured as Docker containers. To get started you will need to flash your Raspberry Pi with an appropriate image and ensure Docker is installed on it. After that it will just be a matter of copying the source files to the device, and starting up the containers. Below I have included instructions on how to set everything up using a Rasberry Pi image distribution called Hypriot. You could alternatively use the defacto Raspbian (Lite) image or another OS like Balena. Hypriot is my preference because it is optimized to run Docker containers and is easy to configure in conjunction with their config files and flash tool.

Note: If you don't want to use Hypriot you may start at the official Raspberry Pi image installation guide for instructions on setting up the Pi's basic image and enabling Wifi. Once you can connect to the Pi through SSH, you can follow this guide to manually install Docker https://blog.alexellis.io/getting-started-with-docker-on-raspberry-pi.

If you already have a Pi up and running and know how to setup Docker, you can probably skip these instructions.

Raspberry Pi Hypriot Setup

Flash Pi on Windows with Etcher or Rufus

  1. Head over to the Hypriot downloads page and grab the latest distribution - as of writing I am using 1.12.0.
  2. After downloading, extract the .zip so you can see the .img file which you will be flashing to your device.
  3. Before flashing please copy the template file user-data.yml from the \src\raspi-base\raspi-config-files folder of this repo to a temporary location. You will need to edit this copy of user-data.yml before flashing (mainly to just replace the Wifi SSID / password).
  4. Download and install Balena Etcher (Recommended) or Rufus. Both are easy to use and you will be able to just select the extracted Hypriot .img file and flash it onto your device.
  5. After your device is flashed, you should be able to browse the SD card on your computer (usually F: drive, where you flashed to). Browse this device and edit the existing user-data file with the contents of your modified user-data.yml file from earlier.
  6. Copy the contents \src\raspi-base\raspi-config-files\config.txt to the config.txt file on the SD card.
  7. Get the current date time by running the powershell script (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss").
  8. Copy that date time into fake-hwclock.data on the SD card. You could also just have manually edited this file, but running the script is safer so that you get the proper date time format.
  9. Safely eject your SD card using the system tray tool!
  10. You are now done, and should be able to boot from this SD card by inserting it into your Pi and powering the Pi on.

Flash Pi on Linux/Mac with Hypriot Flash Utility

  1. Head over to the Hypriot downloads page and grab the latest distribution - as of writing I am using 1.12.0.
  2. After downloading, extract the .zip so you can see the .img file which you will be flashing to your device.
  3. Before flashing please copy the template file user-data.yml from the \src\raspi-base\raspi-config-files folder of this repo. You will need to edit this copy of user-data.yml before flashing (mainly to just replace the Wifi SSID / password).
  4. Acquire the Hypriot flash tool. You can install using this script:
curl -LO https://github.com/hypriot/flash/releases/download/2.6.0/flash
sudo chmod +x flash
sudo mv flash /usr/local/bin/flash
  1. Flash your device. With a terminal in the directory that contains your extracted image and modified user-data file:
flash --userdata user-data.yml --device <device_here> hypriotos-rpi-v1.12.0.img
  1. You are now done, and should be able to boot from this SD card by inserting it into your Pi and powering the Pi on.

Access and Complete Device Setup

Now that your device is flashed with your custom boot config, you should be able to access it over the network. You can try ping anemio-pi.local or ping anemio-pi and should see some network loopback if you device is connected. Please note, the intial boot and setup of the device may take a few minutes to complete, so if you just inserted the fresh SD card into the Pi, you may have to wait a few minutes.

Future notes: If you are on Windows (like me) and want to use the Hypriot flash tool - you may be able to use it directly via WSL-2 (Windows Subsystem for Linux). However, you would probably have to follow this guide carefully to properly configure access to the card reader (https://github.com/jovton/USB-Storage-on-WSL2).

Weather Station Information

Arduino Libraries in Use

Tools in Use

Hardware Information

Sensors / Peripherals

Part Name Function / Description Data Sheet Purchase Sources / Prices
AMBI (GA1A1S201WP) Ambient light sensor.
- Wide operating temperature range (-40 - +85 C)
- Gives consistent and sensible output readings (0 is pitch black, maximum sunlight is 1023)
- Won't over saturate in daylight
GA1A1S201WP OPIC Light Detector (Mouser.ca) Modern Device ($3 USD)
BMP280 (BME280) Barometric pressure sensor.
- ±1.0°C accuracy
- ±1 hPa accuracy
- I2C or SPI interface
- Altitude, ±1 meter accuracy
BST-BMP280-DS001 (Bosch.com) Creatron ($7.90 CAD)
Adafruit ($9.95 USD)
Sparkfun - BME280 ($19.95 USD)
LSM303DLHC Compass / accelerometer.
- Compass and accelerometer all in one
- I2C interface
- Triple axis sensing
LSM303DLHC (Adafruit.com) Adafruit ($14.95 USD)
MH-RD / FC-37 / YL-83 Rain sensor.
- Simple interface
- Adjustable sensitivity
No datasheet but info available from Random Nerd Tutorials Creatron ($5.99 CAD)
DHT-22 Temperature / humidity sensing.
- 2.5mA max current use during conversion
- 0-100% humidity readings with 2-5% accuracy
- 40 to 80°C temperature readings ±0.5°C accuracy
- No more than 0.5 Hz sampling rate (once every 2 seconds)
DHT22 Datasheet (Sparkfun.com) Creatron ($13.00 CAD)
Adafruit ($9.95 USD)
Sparkfun ($9.95 USD)
AS5040 Wind direction (magenetic rotary encoder).
- Absolute positioning
- Contact free
- Very long life
- Multi interface
AS5040 Datasheet (Digikey.com) Digikey ($23.83 CAD)
Rev. P wind sensor Wind speed sensor.
- Wind speeds measured: 0-150 MPH
- Ambient temperature compensation
- Accuracy of +/- 3 MPH (estimated)
No Datasheet but info available here Modern Device ($24 USD)
OCR TM Water temperature (thermistor).
- Very inexpensive
- Simple interface (it's basically a resistor).
- Fairly accurate
No datasheet but info available from Adafruit Amazon.ca ($15.99 CAD per 5 units)
RFM69HCW Transceiver radio for data transfer (x2).
- Inexpensive
- Simple to use
- Low power consumption
- Long range (at least 1km, up to 10+ km with proper configuration)
RFM69HCW ( Adafruit.com) Adafruit.com ($9.95 USD each)
Digikey.ca ($14.15 CAD each)

Microcontrollers

Device Name Function / Description Guide Purchase Sources / Prices
Arduino Mega Main controller for data collection.
- Tonnes of IO
- Lots of memory (relative to other microcontrollers)
- Good power handling
Arduino.cc Amazon.ca (clone) ($19.99 CAD)
Arduino.cc (official) ($38.50 USD)
Raspberry Pi Zero W Data receiving, relay, storage, and web server.
- Built in WIFI
- Very powerful
- Inexpensive
Arduino.cc Creatron ($28.00 CAD)
Amazon.com ($18.89 USD)

Misc

Device Name Function / Description Guide Purchase Sources / Prices
SanDisk Ultra 32GB SD card for Raspberry Pi.
- Cheap
- Lots of reliable storage (32 GB)
N/A Amazon.ca ($11.47 CAD)
ACJ D7S Battery power for weather station.
- 12 V
- 7Ah
- Inexpensive
AJCBattery.com Amazon.ca ($25.89 CAD)
NOMA 2.5W Solar power for weather station.
- 2.5W
- Built-in diode
- Using because on sale for $10 CAD / panel
N/A CanadianTire.ca ($34.99 CAD, was on sale for $9.99 CAD)

*Note that alternative SD cards, batteries, and solar panel(s) may be used. SD cards should be at least 4GB if you want to have some data storage capabilities for the Raspberry Pi. A large capacity battery may also be used, if available. The solar panels used on my setup were chosen because they were a good price, but panel(s) with greater power output would be recommended.

<style> .parts-table table tr td:nth-child(1) { vertical-align: text-top; width: 25%; max-width: 100px; } .parts-table table tr td:nth-child(2) { vertical-align: text-top; width: 40%; max-width: 100px; } .parts-table table tr td:nth-child(3) { vertical-align: text-top; width: 15%; overflow: hidden; max-width: 100px; } .parts-table table tr td:nth-child(4) { vertical-align: text-top; width: 20%; overflow: hidden; max-width: 100px; } </style>