Let it snow!

“Oh the weather outside is frightful
But the fire is so delightful
And since we’ve no place to go
Get the Arduino, Arduino, Arduino!”

(And 17 LEDs)

snow_hero

You’ll need:

  • 17 mixed LEDs in the white and blue tones
  • 1 light sensor
  • Arduino UNO
  • Breadboard + wires
  • Paper

1) LEDs and code
More sensors today! It’s getting cold outside, so let’s see if we can get a warning when the temperature drops down We are going to use Adafruit temperature sensor tutorial, for the base and modify it accordingly.
I’ve got blue, clear blue and white LEDs, that will start lighting up at different stages, depending on how cold it gets.
For now, I’m just placing the LEDs in a straight line, we’ll rearrange them once the code has been tested and adjusted.

snowflake_line

Here’s our code (the temperature values have been picked for testing purpose, according to the output on the Serial monitor, but for a nicer effect, they should be further apart and a bit lower).

int sensorPin = A0; 
                        
int darkBluePin = 9;
int lightBluePin = 10;
int whitePin = 11;
                        
 int reading =0;                        

void setup()
{
  
  pinMode(darkBluePin, OUTPUT);
  pinMode(lightBluePin, OUTPUT);
  pinMode(whitePin, OUTPUT);
  Serial.begin(9600); 
}
 
void loop()                    
{
 //getting the voltage reading from the temperature sensor
 reading = analogRead(sensorPin);  
 
 float voltage = reading * 5.0;
 voltage /= 1024.0; 

 

 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree with 500 mV offset
//to degrees ((voltage - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degrees C");

if(temperatureC >26.0 && temperatureC 24.0 && temperatureC 0.0 && temperatureC <= 24.0) {
  digitalWrite(darkBluePin, HIGH);
  digitalWrite(lightBluePin, HIGH);
  digitalWrite(whitePin, HIGH);
} else {
  digitalWrite(darkBluePin, LOW);
  digitalWrite(lightBluePin, LOW);
  digitalWrite(whitePin, LOW); 
}
 
 delay(1000);                                     
}

2) Shaping the snowflake
snowflake_arrangement
Once you’ve tested the code and made the adjustments according to your room temperature, cut out a snowflake in paper (I am going to use the shape on the left), and the dots represent the positions of my various LEDs; all I have to do is re-arrange the LEDs from a straight line to this snowflake pattern. And the result:
snowflake

The tricky bit now is the wiring, you’ve got to delicately lift the paper template and wire the LEDs per colour, as they were previously.

That’s one big snowflake! For more snow, check out this collection of macro photographed snowflakes, it is pretty amazing!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s