A complete 2D ultrasonic wind speed and direction measurement system with wireless data transmission and statistical analysis capabilities.
This project implements a sonic anemometer that measures wind speed and direction using ultrasonic transducers. The system consists of three main components:
- Anemometer Device - Arduino-based sensor that calculates wind measurements.
- WiFi Module - ESP32-based wireless transmission system.
- Data Collection & Analysis - Python scripts for data gathering and statistical analysis.
- CAD - CAD Files for initial designs for 3D anemometer, and completed 2D anemometer. Along with the designs and laser-cut drawings for the model.
[Ultrasonic Signal Board] → [Arduino Uno] → [Serial] → [ESP32] → [MQTT] → [Python Data Collector]
↓
[7-Segment Display]
- Arduino Uno
- 3x Ultrasonic RX transducers (North, East, West)
- 1x Ultrasonic TX transducer
- 4-digit 7-segment display (common cathode)
- Various electronic components
- PCB
- ESP32 development board (ESP32-S3-DevKitC-1)
- Serial connection to anemometer Arduino
- 9V Wall Wart with power pigtails
- Enclosure/mounting hardware (see CAD folder)
- PlatformIO (recommended) or Arduino IDE
- Python 3.7+ with packages:
paho-mqttpandasnumpystatsmodelsscipy
NOTE: Please see Instructable for help in assembly.
- Build the anemometer circuit following the pin configurations in
anemometer/src/main.cpp - Connect ultrasonic transducers
- Wire the 7-segment display to digital pins 2-13
- Connect Arduino to ESP32 via serial (9600 baud)
- Install PlatformIO in VS Code
- Clone this repository
- Install Python dependencies:
pip install paho-mqtt pandas numpy statsmodels scipy
- Create
arduino_secrets.hinWiFi_Module/include/with your credentials:#define SECRET_SSID "your_wifi_ssid" #define SECRET_PASS "your_wifi_password" #define SECRET_MQTTUSER "your_mqtt_username" #define SECRET_MQTTPASS "your_mqtt_password"
- Upload
anemometercode to Arduino Micro/Uno - Upload
WiFi_Modulecode to ESP32
- Run the MQTT collector:
cd data_collector python mqtt_collector.py - Follow prompts to collect 200 readings
- Use
merger.pyto combine multiple CSV files - Run
analysis.pyfor statistical analysis
The anemometer requires calibration in three conditions:
- Still air (calm conditions)
- Known north wind (9 m/s reference)
- Known east wind (9 m/s reference)
Update the calibration values in anemometer/src/main.cpp:
const Wind_t calm = {547, 581}; // Still air readings
const Wind_t north = {850, 226}; // North wind readings
const Wind_t east = {720, 712}; // East wind readingsThe system outputs JSON-formatted wind data:
{"speed": 5.50, "direction": 126}Where:
speed: Wind speed in m/sdirection: Wind direction in degrees (0-360°, meteorological convention)
├── anemometer/ # Arduino code for wind calculations
│ ├── src/main.cpp # Main anemometer logic
│ ├── lib/sevSeg/ # 7-segment display library
│ └── platformio.ini # Build configuration
├── WiFi_Module/ # ESP32 WiFi transmission code
│ ├── src/main.cpp # MQTT publishing logic
│ └── platformio.ini # ESP32 build configuration
├── data_collector/ # Python data collection tools
│ ├── mqtt_collector.py # MQTT data collection script
│ ├── merger.py # CSV file merger utility
│ └── analysis.py # Statistical analysis tools
└── CAD/ # 3D models and mechanical designs
├── Device # STL files to print 2D Anemometer
└── Exhibit # Mix of STL and DXF files to make scaled
Each folder contains its own README with specific setup instructions:
- Anemometer README - Arduino setup and calibration
- WiFi Module README - ESP32 configuration and MQTT setup
- Data Collector README - Python tools and analysis
No MQTT data received:
- Check WiFi credentials in
arduino_secrets.h - Verify MQTT broker connectivity
- Ensure serial connection between Arduino and ESP32
Incorrect wind measurements:
- Recalibrate sensors in known conditions
- Check transducer positioning (East/West alignment)
- Verify analog pin connections
7-segment display not working:
- Check pin connections match code configuration
- Verify common cathode display type
- Test with simple digit display first
- Fork the repository
- Create a feature branch
- Make your changes
- Test with hardware setup
- Submit a pull request
This project is open source. See individual files for specific licensing information.
This project uses:
- PlatformIO for embedded development
- PubSubClient library for MQTT communication
- ArduinoJson for data formatting
- Python scientific stack for data analysis
- Claude Sonnet 4 was used in the following capacities on the Python scripts:
- Merging CSV files
- Cleaning up the output of scripts
- Conducting ANOVA tests
For detailed component-specific instructions, see the README files in each subfolder.