Early Draft Article: Work in progress
Introducton
This article is part of a series on building a weather station, utilising common software with a few different approaches to hardware. The ultimate aim of this project is to support a wide variety of sensors on both a low-power remote microcontroller based weather station, or a more powerful full Linux system utilising a Pi.
The best weather data collection, reporting and publishing software I’ve come across is WeeWX↗ both the Pi and ESP versions of this project cater for. While all these related weather station articles and weather-hardware projects are designed to feed WeeWX, they can be used in any number of weather applications.
Parts List
Parts marked with ⚙️ came from existing items in my parts store and were chosen for that reason.
- ⚙️ ESP32 DevKit 🛒 ($12) ESP D32 Mini 🛒 ($12)
- Sensors
- ⚙️ Waterproof DS18B20 🛒 ($10) External Temperature
- ⚙️ BMP280 🛒 ($13) Temperature, Humidity and Barometric Pressure
- Misol Weather Station Parts
- ⚙️ Misol Windspeed MS-WH-SP-WS 🛒 ($40)
- Wind Direction (MS-WH-SP-WD)
- Rain Guage (WH-SP-RG)
As usual Amazon affiliate links are provided, but all of this can easily be found on AliExpress too.
If you’d like to buy all the entire MISOL kit not as ‘parts’, see the PiWX Weather Station↗ article, you can get the exact same software, data and weather feeds as this article presents in a much more user-friendly ready-to-report way.
ESP32
I also always have a pile of ESP32 or ESP8266 SoC microcontrollers on hand, while the Wemos D1 Mini (right) form factor is my preferred form factor for production projects, the standard DevKit (left) with header pins is easier for prototyping and testing.
The ESP also enables this project to be used both as data source sending ASCII data over UART to the host computer for processing, as I intend to use it, the final code produced will additionally support the ESP WiFi networking stack and MQTT client to publish data to any network.
Windspeed Testing
Now that the radio has been working and cabled for a while, it’s time to take a look at the next device that’s been sitting here begging for me to take a look at for way too long; it’s the anonometer. I picked it up some time ago and didn’t recall any datasheet for it, but managed to identify it as a MS-WH-SP-WD for the Misol Weather Meter, with lots of info and examples available online for it as “spare parts” are available for it from AliExpress.
It simply closes a switch each rotation with each rotation representing a 2.4km/h windspeed, small and plastic:
Connecting the sensor to a ESP is relatively trivial; trim off the supplied RJ11 connector and connect using GPIO12 (supply) and GPIO13 (interrupt) on the ESP32. We use a GPIO for the supply side so that later on we can programatically turn on/off the sensor, but for now we’ll just leave it turned on but utilising the final pin.
For testing purposes we’ll just make sure our cabling works and we can trigger an interrupt function every time it trips it’s switch, here’s some Arduino IDE code for the test:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Arduino.h"
const byte ledPin = 2;
const byte interruptPin = 13;
const byte powerPin = 12;
volatile byte state = LOW;
void setup() {
delay(500);
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLDOWN);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
if(state) { Serial.print("PING\n"); }
state = !state;
}
This isn’t yet doing any timing or math to calculate windspeed; it’s simply a test to ensure everything can work the way we want it to before we move on to the other sensors.