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.
No comments:
Post a Comment