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.
- Head over to the Hypriot downloads page and grab the latest distribution - as of writing I am using 1.12.0.
- After downloading, extract the .zip so you can see the .img file which you will be flashing to your device.
- 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 ofuser-data.yml
before flashing (mainly to just replace the Wifi SSID / password). - 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.
- 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.
- Copy the contents
\src\raspi-base\raspi-config-files\config.txt
to the config.txt file on the SD card. - Get the current date time by running the powershell script
(Get-Date).ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss")
. - 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.
- Safely eject your SD card using the system tray tool!
- 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.
- Head over to the Hypriot downloads page and grab the latest distribution - as of writing I am using 1.12.0.
- After downloading, extract the .zip so you can see the .img file which you will be flashing to your device.
- 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 ofuser-data.yml
before flashing (mainly to just replace the Wifi SSID / password). - 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
- 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
- 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.
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).
- Wire (built in I2C library) - See Arduino Reference Site
- BME280 and BMP280 Digital Pressure Sensor Library (Version 0.0.2) - by Gregor Christandl - Source Code Here
- Adafruit Unified Sensor Library (Version 1.0.3) - by Adafruit - Source Code Here
- Adafruit DHT-sensor-library (Version 1.3.7) - by Adafruit - Source Code Here
- SerialDebug (Version 0.9.2) - by Joao Lopes - Source Code Here
- SerialDebugApp for helping read output from SerialDebug library.
- Visual Micro for working with Arduino in Visual Studio.
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) |
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) |
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>