Introduction: Interfacing a Wind Sensor to LEDs

Goals:

Using Arduino, interface a wind/breath sensor to LEDs. Via Arduino, you can program the LEDs to respond to different levels of wind from the sensor, control the brightness of individual LEDs, and program a unique overall pattern of response from the LEDs which can be tailored to individual environments, a desired overall effect as well as the number of LEDs involved.  

Step 1:

Circuitry Parts Needed:

Arduino Uno
Sparkfun Arduino Shield
Modern Device Wind Sensor, Part # MD0550
Stranded wire, 8 220 Ohm resistors, 8 LEDs
9V battery


Software:

Arduino 1.5.4


Step 2: Circuitry



Step 3:

prototyping on a solderless breadboard


Step 4:

Upload this code to an Arduino sketch: 

Code:


int ledPin[] = {2,3,4,5,6,9,10,11};

void setup() {

  Serial.begin(9600);
// set all pins to output
for (int x = 0; x < 6; x++) {
   pinMode (ledPin[x], OUTPUT); }
}

  void loop()
{
  int sensorValue = analogRead(0);
  Serial.println(sensorValue, DEC);

//delay(500);
  for (int i = 0; i < 6; i++)
analogWrite(ledPin[i], LOW);

    if (sensorValue > 600 && sensorValue < 800){ analogWrite(ledPin[0], 200); }
    if (sensorValue > 480 && sensorValue < 750){ analogWrite(ledPin[1], 160); }
    if (sensorValue > 480 && sensorValue < 650){ analogWrite(ledPin[2], 180); }
    if (sensorValue > 550 && sensorValue < 750){ analogWrite(ledPin[3], 130); }
    if (sensorValue > 550 && sensorValue < 750){ analogWrite(ledPin[4], 180); }
    if (sensorValue > 600 && sensorValue < 850){ analogWrite(ledPin[5], 160); }
    if (sensorValue > 600 && sensorValue < 900){ analogWrite(ledPin[6], 100); }
    if (sensorValue > 550 && sensorValue < 900){ analogWrite(ledPin[7], 200); }

}

Step 5:

Directions:

Working on the Arduino shield, connect 8 LEDs to pins 2, 3, 4, 5, 6, 9, 10, and 11, in parallel with 220 Ohm resistors, and ground all resistors.
Connect the sensor to the Arduino board using the Analog Input pins: V+ on the sensor to 5V on Arduino; Out of sensor to A0 on Arduino, and GND to GND
Upload the sketch to the Arduino board


Notes:

*The sensor's readings on the serial monitor read an average of 200-300 under normal room conditions. So, each pin needs to be programmed to respond to values that correspond to a rise in wind being sensed in it's specific environment.  From there, you can program each pin to respond to a value of your choosing and create a desired effect that way.