Smart Garden – Arduino Wind Imitator
I have my air flow system running. For whatever reason, I want the breeze it produces to be random and imitate the wind. This seems more natural, and incidentally will cut down significantly the electrical consumption of the blower. Note though, that my blower only draws 23 Watts.
Arduino Nano based Imitator
A quick google search gave me the code I needed to make this happen. All I needed to do was adjust the on/ off timing and the code was good to go. After lots of tweaking, I have settled on 3-6 minutes on and 6-12 minutes off.
/*
Blink_Randomly
*
Modified from the basic Arduino example. Turns an LED on for a random time,
then off for a (most likely) different random time. We use pin 13 because,
depending on your Arduino board, it has either a built-in LED
or a built-in resistor so that you need only an LED.
*
Original at – http://www.arduino.cc/en/Tutorial/Blink
*/
int ledPin = 2; // LED connected to digital pin 1
long randOn = 0; // Initialize a variable for the ON time
long randOff = 0; // Initialize a variable for the OFF time
void setup() // run once, when the sketch starts
{
randomSeed (analogRead (0)); // randomize
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
randOn = random (180000, 360000); // generate ON time
randOff = random (360000, 720000); // generate OFF time
digitalWrite(ledPin, HIGH); // sets the LED on
delay(randOn); // waits for a random time while ON
digitalWrite(ledPin, LOW); // sets the LED off
delay(randOff); // waits for a random time while OFF
}
Instead of putting together a new board for this project I reused an Arduino Nano based setup I made for timing an Aeroponic Sprayer on and off. The components were all the same:
-Arduino Nano
-5v Relay
-5v Transformer (cell phone charger)