ESP32 driven small weather station with focus on parameters usually not captured, including particle density for Air Quality and UV-Index
Regular weather stations that can be purchased cover temperature, rel. humidity, pressure, wind direction, and speed, perhaps rainfall. But parameters like particle count or AQI and UV-Index are harder to find or more expensive, yet these parameters are important for health. If somebody is interested, wind direction and speed are not too hard to add, but the main focus is on the less common parameters. The Weather Station is recording all results on an SD card as well as sending the data via Wi-Fi and a REST API to a Weather Station App. The SD card is meant as a backup in case Wi-Fi or servers are not available, whereas the data transmitted via Wi-Fi is for viewing the current data in a more convenient way (not opening the station every time). There are more energy-efficient ways of transferring the data from the station, but the idea was to have a station, that doesn't require a receiver to distribute further or process the data indoors. Also, the goal was to run it on battery and solar power, to allow it to be placed in any location, without having to connect it to a wired power source.
- Stevenson Screen
- La Crosse Sensor Weather Shield
- 1"x0.75mm Fused Silica Disc: https://amazon.com
- Case
- Hammond 1591MSGY
- Controller (Driver)
- Adafruit ESP32 Feather
- Adafruit FeatherWing - RTC + SD Add-on
- SanDisk 4GB microSD card
- Sensors
- Adafruit BME680 - Pressure/Temperature/Humidity/Gas
- Adafruit SI1145 - UV/VIS/IR
- Plantower PMS5003 - Particle PM2.5
- Power
- Adafruit USB / DC / Solar Lithium Ion/Polymer charger
- Waveshare Solar Panel (6V 5W)
- 5V DC-DC Converter Step Up Power Supply e.g. AliExpress
- 3 AA LiPO batteries in a simple battery case with an On/Off switch
- Adafruit LiPO battery has been replaced with a simple battery holder for 3 AA batteries. In my case I, use the LiPO which seems to work better under cold conditions. The existing wiring can remain the same.
- Adafruit Huzzah32 ESP32 Feather has been replaced with EzSBC's ESP32-based Feather Breakout and Development Board which has the same functionality and pinout as the Adafruit board, but a much lower deep sleep current.
- The PMS5003 was replaced by a PMS7003 since it stopped working.
- Switch from the Arduino-IDE to PlatformIO.
The FeatherWing - RTC + SD Add-on is stacked on top of the ESP32 Feather.
ESP32 | Function | SI1145 | BME680 | PMS5003 | 5V DC/DC | LiPo Charger |
---|---|---|---|---|---|---|
SCL | Clock | SCL | SCK | - | - | - |
SDA | Data | SDA | SDI | - | - | - |
TX | Transmit | - | - | RX | - | - |
RX | Receive | - | - | TX | - | - |
GND | Ground | GND | GND | GND | GND | - |
3.3V | 3.3 Volt | VIN | VIN | - | 3.3V | - |
VIN | 5 Volt | - | - | 5.0V | 5.0V | - |
JTS BAT | Battery Connector | - | - | - | - | GND / B+ |
The Battery is connected to the JTS connector of the LiPo Charger.
- Sensors
- SD
- MicroSD: https://www.adafruit.com/product/254
- RTC
- Other
- ArduinoJson - Powerful JSON parser for Arduino
- WiFi - Arduino IDE
- HTTPClient - Arduino IDE
- WiFiClientSecure - Arduino IDE
- math - Arduino IDE
To update settings for the weather station, simply copy the content below into a file named settings.json
. Remove the comments and add a copy of the file to the root folder of the SD card in your weather station. When restarted, it will update the settings and remove the file from the SD card.
{
// WiFi credentials
"ssid": "<Your SSID>",
"password": "<Your WiFi Password>",
// Server
"apikey": "<Your API Key>",
"server": "<API Endpoint>",
"protocol": "<REST|MQTT>", // Right now only REST is implemented
// Station Location
"longitude": 0.0,
"latitude": 0.0,
"altitude": 0.0, // altitude of your location in meters
// Time and NTP Server
"ntpServer": "pool.ntp.org", // URL address
"timezoneStr": "UTC0", // Timezone Definition
"gmtOffset_sec": 0, // Timezone offset of your location in seconds
// Measurement interval in Minutes
"sleepDuration": 5
}
* Source: Timzone Definitions
All sensors are located inside the Stevenson Screen. All other components including the Microcontroller, charging circuitry, and battery are in a separate box. To connect sensors and the Microcontroller, an Ethernet cable is used.
Sensor | Parameters Measured | Parameters Derived | Location |
---|---|---|---|
SI1145 | Ultraviolet Light (UV) a.u. Visible Light a.u. Infrared Light (IR) a.u. |
UV-Index |
On top of the Stevenson Screen is a small hole drilled with the sensor breakout board glued right underneath. The hole is covered by a thin slice of silica glass to protect the sensor and minimize the reduction of UV transmission at the same time. |
BME680 | Temperature ℃ rel. Humidity % Pressure hPa Air Quality kΩ |
Dew Point Heat Index Pressure (PSML) hPa |
The sensor breakout board is glued close to the bottom of the encasing. The battery is located on the opposite side to prevent it from skewing the temperature measurements as little as possible when charging. |
PMS7003 | PM 1 μg/m³ PM 2.5 μg/m³ PM 10 μg/m³ >0.3 μm/0.1L >0.5 μm/0.1L >1.0 μm/0.1L >2.5 μm/0.1L >5.0 μm/0.1L >10.0 μm/0.1L |
Air Quality Index |
The particle sensor is on top of the box holding the Micro-Controller, charging circuitry and battery. |
The UV-Index is calculated using the UV value from the SI1145 sensor in the equation below as provided by the sensors data sheet.
Source: Sensor Documentation
The Dew Point (℃) is calculated on the device based on the following equation. More details in to code's comments.
Source: http://bmcnoldy.rsmas.miami.edu/Humidity.html
- Alduchov, O. A., and R. E. Eskridge, 1996: Improved Magnus Form Approximation of Saturation Vapor Pressure J. Appl. Meteor., 35, 601–609.
- August, E. F., 1828: Ueber die Berechnung der Expansivkraft des Wasserdunstes. Ann. Phys. Chem., 13, 122–137.
- Magnus, G., 1844: Versuche über die Spannkräfte des Wasserdampfs. Ann. Phys. Chem., 61, 225–247.
The Heat Index is calculated using the following equations. All temperature values within the equation are in Fahrenheit (℉). In the last step the value is converted into Celsius (℃) when returned by the device.
In case the Heat Index is above 80 ℉ or 26.67 ℃ one of the following equations is applied to calculate the Heat Index.
When the rel. humidity is smaller than 13 % and if the temperature is bigger than 80 ℉ or 26.67 ℃ and smaller than 112 ℉ or 44.44 ℃ the following equation needs to be applied.
When the rel. humidity is higher than 85 % and the Temperature is between 80 ℉ and 87 ℉ the following equation applies.
The last step is converting the Heat Index from Fahrenheit to Celsius.
Source: https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
The Air Quality Index is calculated using the PM 2.5 value by default. If the AQI for PM 10 is higher than for PM 2.5, it is taken as the AQI.
PM 2.5 | AQI (high) | AQI (low) | Conc (heigh) | Conc (low) |
---|---|---|---|---|
0 - 12.1 | 50.0 | 0.0 | 12.0 | 0.0 |
12.1 - 35.5 | 100.0 | 51.0 | 35.4 | 12.1 |
35.5 - 55.5 | 150.0 | 101.0 | 35.4 | 35.5 |
55.5 - 150.5 | 200.0 | 151.0 | 150.4 | 55.5 |
150.5 - 250.5 | 300.0 | 201.0 | 250.4 | 150.5 |
250.5 - 350.5 | 400.0 | 301.0 | 350.4 | 250.5 |
350.5 - 500.5 | 500.0 | 401.0 | 500.4 | 350.5 |
PM 10 | AQI (high) | AQI (low) | Conc (heigh) | Conc (low) |
---|---|---|---|---|
0 - 55.0 | 50.0 | 0.0 | 54.0 | 0.0 |
55.0 - 155.0 | 100.0 | 51.0 | 154.0 | 55.0 |
155.0 - 255.0 | 150.0 | 101.0 | 254.0 | 155.0 |
255.0 - 355.0 | 200.0 | 151.0 | 354.0 | 255.0 |
355.0 - 425.0 | 300.0 | 201.0 | 424.0 | 355.0 |
425.0 - 505.0 | 400.0 | 301.0 | 504.0 | 425.0 |
505.0 - 605.0 | 500.0 | 401.0 | 604.0 | 505.0 |
Source: https://www.airnow.gov/aqi/aqi-calculator-concentration
Most weather reports provide the ambient pressure normalized to sea level (PSML). It is calculated on the device using the following equation.
Source: https://forums.adafruit.com/viewtopic.php?t=105831
None of the sensors used in the weather station have been calibrated other than the calibrations that were done at the factory. All measurements were compared to the closest local weather station and seem to be in good agreement. The data from the BME680 is pretty much spot on. The UV index by the SI1145 seems to be on the lower end but at the same time is very hard to compare in the winter, since the amount of UV light is low to begin with and the azimuth is low as well. The next summer will show how the measurements work and if the glass is absorbing too much UV. The particle measurements from the PMS5003 are comparable to the results from the closest station, but can deviate more, since very local sources of particles, like a neighbor's BBQ can change the result. Further the official AQI (Air Quality Index) is taking other pollutants into account, that the Weather Station is not equipped for, like Ozone (O₃), which can be the main contributor to the AQI, thus underestimating the AQI.
The data is recorded in 5-minute intervals, putting the ESP into sleep mode in between measurements to save power. The biggest power consumption is by the particle sensor's fan. It is running for a minimum duration of 30 seconds before each measurement. So far the solar panel is able to recharge the battery in about 2-3 hours (November), but the winter will show if it can keep the battery sufficiently charged, especially under cloudy conditions, snow, and low temperatures.