Project tutorial

Digital Windmill "Digindmill"

I made ​​a digital windmill "Digindmill" revolved by breath.

  • 6,325 views
  • 0 comments
  • 22 respects

Components and supplies

Apps and online services

About this project

LED's light revolve when a certain degree of amplitude picked up the sound of breathis detected with a microphone.

Feathers are made of Polypropylene sheet.

Handle is toy hammer's.

Using Arduino Nano Clone.

blog: http://homemadegarbage.0t0.jp/digindmill

Code

Digindmill_03.inoArduino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

const int analogInPin = A1;  
int sensorValue = 0;
int amp = 0;
int rotDelay = 500;

int fin = 0;

//LED setting for 8 feathers of a windmill
#define NUMPIXELS      5
Adafruit_NeoPixel pixel0 = Adafruit_NeoPixel(NUMPIXELS, 2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel1 = Adafruit_NeoPixel(NUMPIXELS, 3, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel2 = Adafruit_NeoPixel(NUMPIXELS, 4, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel3 = Adafruit_NeoPixel(NUMPIXELS, 5, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel4 = Adafruit_NeoPixel(NUMPIXELS, 6, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel5 = Adafruit_NeoPixel(NUMPIXELS, 7, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel6 = Adafruit_NeoPixel(NUMPIXELS, 8, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixel7 = Adafruit_NeoPixel(NUMPIXELS, 9, NEO_GRB + NEO_KHZ800);

Adafruit_NeoPixel pixels[8] = {pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7};


uint32_t finColors[8];


void setup() {
  Serial.begin(9600);

  #if defined (__AVR_ATtiny85__)
    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif
  for(int i = 0; i < 8; i++ ){
    pixels[i].begin();
    pixels[i].setBrightness(20);
  }

  //color setting
  finColors[0] = pixels[0].Color(255,0,0);
  finColors[1] = pixels[0].Color(150,150,150);
  finColors[2] = pixels[0].Color(85,0,170);
  finColors[3] = pixels[0].Color(120,155,0);
  finColors[4] = pixels[0].Color(0,0,255);
  finColors[5] = pixels[0].Color(170,0,85);
  finColors[6] = pixels[0].Color(0,255,0);
  finColors[7] = pixels[0].Color(0,170,170);
}

void loop() {
  //Averaging of mic out
  for(int i = 0; i < 10; i++){
    sensorValue =+ analogRead(analogInPin);
  }
  Serial.print(sensorValue/10);
  
  //Bias elimination of mic out
  amp = abs(sensorValue/10 - 30);
  Serial.print(" ");
  Serial.print(amp);
  
  //Rotational speed derivation from mic out
  rotDelay = map(amp, 10, 60, 150, 0);
  if(rotDelay < 0){
    rotDelay = 0;
  }
  Serial.print(" ");
  Serial.println(rotDelay);
  
  for(int j = 0; j < 8; j++){
    int k = j + fin;
    if(k >= 8){
      k = k - 8;
    }
    for (int i = 0; i < 5; i++){
      pixels[j].setPixelColor(i, finColors[k]);
    }
  }
    
  for(int i = 0; i < 8; i++ ){
    pixels[i].show();
  }
  delay(15);

  //Windmill rotation
  if(amp > 10){
    delay(rotDelay);
    fin++;
    if(fin >= 8){
      fin = fin - 8;
    }
  }
  
  for(int i = 0; i < 8; i++ ){
    pixels[i].clear();
    pixels[i].show();
  }
  delay(1);
}

Schematics

Block Diagram
Digindmill

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 455,004 views
  • 42 comments
  • 239 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 285,543 views
  • 95 comments
  • 672 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 229,428 views
  • 38 comments
  • 237 respects

OpenCat

Project in progress by Team Petoi

  • 196,032 views
  • 154 comments
  • 1,363 respects
Add projectSign up / Login