AstroWeatherStation#
AstroWeatherStation is an open-source weather station that aims at providing a low-cost (~100€) alternative to commercial ones. It also offers full flexibility to how your data are stored and accessed, as well as the possibility to add whatever sensor you want.
To leave a telescope outside permanently (under a dome, or with a waterproof telescope), one needs a weather station to observe the environmental conditions. This allows the telescope to be put in a safe mode if they are dangerous (e.g. rain or dew), or simply to know if observation is possible (absence of clouds).
Features#
AstroWeatherStation hosts multiple different sensors:
- DHT22: Temperature and humidity sensor
- MH-RD: Rain sensor
- MLX90640 110deg: IR Thermal camera (for cloud detection)
- TSL2591: Luminosity sensor (for start/end of observation at dawn/dusk and darkness of night measurement)
It uses the Grove ecosystem to easily connect sensors without any soldering. Sensors that don't use this ecosystem (like the TSL2591 and the MH-RD sensors) can still be connected by using the appropriate adapter cables. AstroWeatherStation uses an ESP32 controller with the Grove Shield and the Grove I2C hub which provides plenty of ports to connect sensors (digital, analog, I2C, UART).
Hardware#
| Component | Quantity | Price | Description |
|---|---|---|---|
| XIAO ESP32-C6 board | 1 | 5.30€ | Controller |
| Grove Shield | 1 | 3.90€ | Shield for the ESP32 board |
| Grove I2C Hub | 1 | 1.50€ | Additional I2C ports |
| DHT22 sensor | 1 | 7.00€ | Temperature & humidity sensor |
| MLX90640 110deg | 1 | 43.00€ | IR Thermal camera |
| MH-RD sensor | 1 | 1.90€ | Rain sensor |
| TSL2591 sensor | 1 | 7.50€ | Luminosity sensor |
| CHD7310WH enclosure | 1 | 25.40€ | Waterproof enclosure |
| Grove cable | 3 | 1.70€ | Sensor connection |
| Grove-Jumper cable | 1 | 3.00€ | MH-RD sensor connection |
| Grove-Qwiic cable | 1 | 2.00€ | TSL2591 sensor connection |
| USB-C cable | 1 | 2.80€ | Power cable |
| Stevenson screen | 4 | 3D printed | Rain-proof ventilation for inside sensors |
| MLX90640 support | 1 | 3D printed | Support for the MLX90640 thermal camera |
| TSL2591 support | 1 | 3D printed | Support for the TSL2591 sensor |
| Base plate | 1 | Laser cut | Base plate to hold the electronics |
Code#
ESP32#
The weather station is controlled by an ESP32 board (XIAO ESP32-C6 model). The code, written in MicroPython, for it can be found in this folder. It hosts:
boot.py: The booting code which connects the weather station to a WiFi network. If no known network is found, it will host its own WiFi network where you will be able to setup the connection.main.py: The main code that reads the sensor values and upload their values to theindex.htmlpage.index.html: The raw HTML page that shows the sensor values of the weather station. It is formatted to be used by the WeatherWatcher INDI library, but it can be easily used with an other standard.- Libraries:
mlx90640.py,tsl2591.py,wifimgr.py - Test code for individual sensors:
test_dht22.py,test_mhrd.py,test_mlx90640.py,test_tsl2591.py
RaspberryPi#
The weather station publishes its sensor values to an HTML page on the WiFi network to which it is connected. The log_astroweatherstation.py program recovers the sensor values from this page and sends them to an InfluxDB database to store them. From there, they can be plotted in Grafana for example. This code also saves the IR thermal camera data as an image and in a log file for post-processing.
-
To install InfluxDB and Grafana on a RaspberryPi, follow this tutorial.
-
To run the logging code on your RaspberryPi every minute to log the weather station data, you can use the
crontab -ecommand and add the following line, where<PATH-TO-FILE>should be changed with the absolute path to the Python file:*/1 * * * * /usr/bin/python3 <PATH-TO-FILE>/log_astroweatherstation.py &
References#
wifimgr.pyby Tayfun ULU: WiFi manager library (MIT License)tsl2591.pyby MCHobby: MicroPython library for TSL2591 luminosity sensor (MIT License)- Auto-gain for
tsl2591.pyby Aurélien Genin (MIT License) mlx90640.pyby Michael Sulyak: MicroPython library for MLX90640 IR thermal camera (MIT License)