
The other half of the college wind turbine idea. It reads where the wind is coming from and turns the turbine to face it. On small turbines a tail fin does this. Bigger machines, or a turbine you want to turn out of a storm on purpose, need a motorised yaw drive, and this is its controller.
The vane is the common 16-position resistor type (the SparkFun / Argent weather meter vane). Each direction connects a different resistor, so with a 10k pull-up every direction gives its own voltage on A0. The firmware works out the 16 expected ADC values from the resistor list and picks the nearest. A reading far from all 16 means a broken or shorted vane, and it's ignored.
Wind direction swings around all the time. If the turbine followed every swing, the yaw motor would wear out in weeks. So:
The power cable runs down the tower, so the nacelle can't spin round forever. Here it may turn between −270° and +270° (one and a half turns each way). For every new wind direction, the controller looks at all the equal angles (for example 300° is also −60°), keeps the ones inside the limit, and picks the closest. Sometimes that means going the long way round, which also untwists the cable. The test runs a sequence of wind changes that would wind the cable up and checks it never goes past ±270°.
| File | What it is |
|---|---|
firmware/wind_vane_yaw/wind_vane_yaw.ino | Firmware |
firmware/build/wind_vane_yaw.hex | Real-time build |
firmware/build/wind_vane_yaw_sim_x10.hex | Averaging and start delay 10x faster, for Proteus |
test/sim_test.c | Simulator test, with a simulated nacelle that turns when the motor runs |
ARDUINO UNO, LM016L, L298 (or L293D), MOTOR-DC, SW-SPST for PARK, and two POT-HG. One stands in for the vane (or use a RES per direction and a rotary switch), the other for the nacelle position.images/wiring.png. Set the Arduino's Program File to firmware/build/wind_vane_yaw_sim_x10.hex.Save it as proteus/wind-vane-yaw.pdsprj and commit it.
Use a 10-turn pot geared to the yaw ring, or better, an absolute magnetic encoder (AS5600 type) with a turns counter. Add limit switches at ±280° that cut the motor in hardware, as a backup for the software limit.