In this tutorial we will make a connected anemometer with a wind vane based on a ESP8266 WiFi module. If you have a 3D printer, you just need to print mechanical components of this projects with your printer. You can find all STL files on github.
For the anemometer, we will use a hall effect sensor. The hall effect sensor allow to count the turn of the anemometer propeller. To find to wind direction, we will make an optical encoder based on led and phototransistors. For the Arduino part, i used an ESP8266 module. I like the Wemos d1 mini because it is really small and cheap (about 5€).
BOM : what do you need for the project
For this project, you will need :
- 1x ESP8266 WiFi Module. All design are ready for the Wemos d1 mini module. If you choose the module, you probably need to update the design. Chose a ESP-12E or ESP-12F module.
- 1x hall effect sensor. I used a us1881, really cheap and easy to buy
- 2x neodymium magnets diam.6mm x 3mm
- 5x led. Yellow color is better, but you can use red, blue or green too
- 5x phototransistors. I used Vishay TEPT4400, cheap and easy to buy on internet
- 1x prototyping board (cuted 46mm x 42mm)
- Some 22AWG wire
- 4x ball bearing 5mm x 10mm x 5mm (or 4mm)
- Nuts and screws
- 10x M4 nuts
- 4x M5 nuts
- 1x M6 nut
- 1x M6x30 screw
- 3x M3*20 screws
- 3x M3 nuts
The cost of this project (with 3D printed parts) is about 30€.
The circuit is composed by two functions:
- The first function is the angular encoder. We need 5 led and 5 phototransistors. The phototransistor is like a switch. Each time a phototransistor detect the light of the led, the state of the bit associated change (LOW or HIGH). We need a 10 kΩ resistor for each phototransistor between +5V and the smallest pin. Connect the longest pin to GND.
- The second function is the turn counter. The us1881 hall effect sensor is composed by 3 pins (angled corners in front of you).
- Left pin <=> +5V
- Middle pin <=> GND
- Right pin <=> signal
- Connect a 10 kΩ between right and left pins
Do not sold directly the Wemos d1 mini on the circuit to be able to remove it. Some time, it’s not possible to upload the Arduino program. You need to remove the Wemos before.
Follow the wiring diagram for making the circuit.
I use Autodesk Fusion 360 to design this project. Fusion 360 is free for students and teachers (3 years). You will find Fusion 360 and STEP files on GitHub here.
|Support of the us1881 hall effect sensor|
|Connecting plate (anemometer and wind vane housing)
Connect the wind vane and anemometer housing
Hall for phototransistors
|Central ball bearing housing|
|Wind vane housing|
|Encoding disk (gray code)|
You will need about 62 meters of PLA and about 11 hours to produce all 3D parts.
ESP8266 / Arduino code
Download and open the Arduino code into your IDE. Modify the following variables before downloading the program. If you don’t publish data on a MQTT broker, comment all pubsub lines. Modify the pins adresses of the phototransistors if needed.
#define wifi_ssid “SSID”
#define wifi_password “PASSWORD”
#define mqtt_server “IP_MQTT_BROKER”
#define mqtt_user “guest”
#define mqtt_password “guest”
|Wind vane assembly|
|Wind vane encoder assembly|
|Insert the us1881 sensor|
|ESP8266 assembly into anemometer housing|
If like me you don’t have a laboratory wind tunnel, you need to use your care to make the calibration of the anemometer. Make several records at different speeds to find the relation between car speed and number of turns of the propeller.
If you don’t modify 3D parts of the propeller, you don’t need to calibrate the anemometer. be careful if you use your car for calibration like me !
This anemometer can :
- Measure wind speed from 8km/h (about 2m/s)
- Up to 100 km/h
- Use this relation to calculate wind speed. WindSpeed = (NumberOfTurns + 6,174 ) / 8,367
Wind vane calibration
In this version, i don’t develop any calibration code for the wind vane. Simply use your smartphone to find the index of the wind direction and update the program.
I hope you enjoyed this tutorial. This is the first version we can improve :
- Firstly, the design to make it weather resistant.
- Replace the optical encoder by a magnetic sensor uses less power than LED and easier to program and possible to use with a battery.
Feel free to leave me your comments or questions in the comments.
Soon for a new project!