1 / 2
Wind Turbine — image 1
1 / 2

Wind Turbine

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

Model information

License
Creative Commons — Attribution

This miniature wind turbine shows the power and limitations of this renewable energy source. In the sample code, you'll see how much voltage this mini turbine produces, and the estimated rotations per minute (rpm) of the turbine.

 

This design is part of my journey to 52 projects in 2025. I document this process on YouTube and you can see the video here:

 

Here is the sample code (uses an LCD screen):

#include <LiquidCrystal.h>

// === TURBINE VARIABLES === const int motorPin = A0; int analogValue; float motorSpeed; // Motor speed in RPM const float Kv = 6666.67; float Voltage; float MaxSpeed = 0;

// === LCD SETUP === const int rs = 12; const int en = 11; const int d4 = 5; const int d5 = 4; const int d6 = 3; const int d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// === BUTTON SETUP === const int buttonPin = 6; int buttonState = 0; bool is_pressed = false; int buttonlevel = 0;

// === AVERAGE CALCULATION === const int NUM_READINGS = 50; float readings[NUM_READINGS]; int readIndex = 0; int count = 0; float total = 0; float average = 0;

void computeAvg(float newReading) { total -= readings[readIndex]; readings[readIndex] = newReading; total += readings[readIndex]; readIndex = (readIndex + 1) % NUM_READINGS;

if (count < NUM_READINGS) count++; average = total / count; }

void setup() { Serial.begin(9600); lcd.begin(16, 2); pinMode(buttonPin, INPUT);

// Initialize readings array for (int i = 0; i < NUM_READINGS; i++) { readings[i] = 0; } }

void loop() { analogValue = analogRead(motorPin); buttonState = digitalRead(buttonPin);

// Convert analog to voltage Voltage = (analogValue * 5.0) / 1023.0;

// Convert voltage to RPM motorSpeed = Voltage * Kv;

// Track max speed if (motorSpeed > MaxSpeed) { MaxSpeed = motorSpeed; }

// Update moving average computeAvg(motorSpeed);

// Handle button press if (buttonState == HIGH && is_pressed == false) { buttonlevel = (buttonlevel + 1) % 4; // 4 modes: 0–3 is_pressed = true; delay(200); // Debounce } else if (buttonState == LOW) { is_pressed = false; }

// Display different information based on buttonlevel lcd.clear(); switch (buttonlevel) { case 0: lcd.print("Max Speed:"); lcd.setCursor(0, 1); lcd.print(MaxSpeed, 1); lcd.print(" RPM"); break;

case 1:
  lcd.print("Current Voltage:");
  lcd.setCursor(0, 1);
  lcd.print(Voltage, 2);
  lcd.print(" V");
  break;

case 2:
  lcd.print("Current Speed:");
  lcd.setCursor(0, 1);
  lcd.print(motorSpeed, 1);
  lcd.print(" RPM");
  break;

case 3:
  lcd.print("Avg Speed:");
  lcd.setCursor(0, 1);
  lcd.print(average, 1);
  lcd.print(" RPM");
  break;

}

// Optional serial monitoring Serial.print("Voltage: "); Serial.print(Voltage, 2); Serial.print(" V | Speed: "); Serial.print(motorSpeed, 1); Serial.print(" RPM | Avg: "); Serial.print(average, 1); Serial.print(" RPM | Max: "); Serial.println(MaxSpeed, 1);

delay(100); }

 

Tags