Sunday, September 27, 2020

Weather Station - Finale

For several months I've been exploring various ways of gathering and displaying all of my environmental sensor data.  Well I'm now ready to wrap this project up.  The final two pieces are a wind speed monitor and a rain gauge.  I chose an ESP32 module for processing the incoming data and hooked it up to a .96" OLED display.  The image below shows the completed unit w/o the clear top installed.  The pushbutton on the left allows me to switch between metric and English units of measure.  An external, four channel analog to digital converter sits to the right of the ESP32.

I purchased the anemometer from Adafruit (anemometer).  It outputs a voltage that's proportional to the wind speed and connects to one of the  analog inputs of the ESP32.  However, after several attempts I finally gave up on using the internal ADC.  I didn't know at the time but it turns out that problems with this feature were well documented on the internet so I decided to go with an external ADC (ADS1115) instead.  This seemed to solve all of my problems and I'm happy with the results.

The rain gauge came from a source off of eBay and is mechanical in operation.  As water enters the unit it causes a collector to fill with water.  When the collector is full it tips over (tilts) and empties its contents.  Each tilt forces a reed switch to momentarily close via a magnet attached to the collector arm.  This switch closure is easily monitored by a GPIO pin on my Raspberry Pi.  The number of tilts are counted and converted to an equivalent depth.  The ESP32 then polls the RPi every 15 minutes to get an updated rain fall amount via an MQTT connection.

Since OLEDs are known to have a limited lifespan, I decided to shut off the entire display at midnight and then re-enable everything at 8:00am.  The ESP32 "knows" the time because it periodically retrieves the actual time via an NTP (network time protocol) server.  I also chose to leave the sensor display readings blank if there was no wind or rainfall to report, just to keep the display uncluttered.

All in all, a pretty fun little project.