Building a Raspberry Pi weather station with Elixir/Nerves – Part 1
My house is at the top of a hill, and no weather stations are close enough to accurately determine the wind speeds. Being the nerd that I am, knowing the current and historical wind speeds is something I would love to play with. I am most interested in the wind speeds during storms. Being able to use Elixir to build this project makes it even more fun!
I sourced parts from Adafruit and Amazon. The smoke case and power supply that I planned on purchasing were out of stock. Begrudgingly I had to order a different case and use Amazon for the SD card/power supply. Adafruits pricing for SD cards couldn’t compete with Amazon.
- High Temp Waterproof DS18B20 Digital temperature sensor + extras
- Anemometer Wind Speed Sensor w/Analog Voltage Output
- Premium Female/Female Jumper Wires – 20 x 6” (150mm)
- Aluminum Heat Sink for Raspberry Pi 3 – 14 x 14 x 8mm
- Raspberry Pi 3 – Model B – ARMv8 with 1G RAM
- Adafruit Pi Box Plus – Enclosure for RasPi Model B+/Pi 2/ Pi 3
- Adafruit Perma-Proto Half-sized Breadboard PCB – Single – FREE
- SanDisk Ultra 16GB Ultra Micro SDHC UHS-I/Class 10 Card with Adapter (SDSQUNC-016G-GN6MA)
- CanaKit 5V 2.5A Raspberry Pi 3 Power Supply / Adapter / Charger (UL Listed)
The 30_000 foot view is to create a web interface to view live and historical weather information for my back yard. The overall weather station project will consist of multiple actions/projects:
- Data collection from sensors
- Sending data over HTTPS to an API layer for persistence
- Exposing data via HTML / JS to the end user (me)
All code written for this project will be open sourced and published on my Gitlab account. You can follow along using my blog and possible twitch streams. If a package isn’t available on Hex.pm to process the 1-Wire Dallas protocol, one will be created.
To avoid running power to the shed, which is roughly 111’ from the house, solar power is required. During the winter, sun might become rare, thus a decent battery system is also needed.
This project is a bit daunting because I generally avoided hardware projects, but a weather station has been an itch I’ve wanted to scratch for a long time. When I found out about Nerves it was an easy decision, Elixir and hardware was too cool to not play with.
Another challenge will be reading the temperature from the sensor using the 1-Wire Dallas Protocol. More sleuthing needs to be done to find packages which can parse this, or I will create one on my own. My bet is a large chunk of my time will be writing the library for parsing the protocol. As I plan on open sourcing it, tests/dialyxir/docs will all have to be included, adding time. I believe any open source project should have those items mentioned, at least.
Once the parts arrive I will load the OS, and boot the Pi. The sensors will be be connected to the GPIO using female connectors cut in half, and soldered to the wires of the sensors. I hope this works, if you have suggestions feel free to let me know via Twitter or frank AT kumro DOT io. Nerves will be setup and a new project created. Reading from the sensors will be the first few steps. Persisting to an API (which doesn’t exist yet) is the last step as it has unmet deps.
- Wind speed
- Persisting to API