Introduction: Sunshine Alert Meter

Many people nowadays do not get enough sunlight during the day due tot the strong preference to be in front of the computer as opposed to playing outside. What better time to be outside than summertime!

This is a sunshine alert sensor which alerts people when there's good weather outside, a perfect time to play, hangout, or get exercise. This project uses a buzzer to alert he user when the sunshine alert meter has been filled, i.e. great outdoor weather. It also has an LED ring meter that fills up as the light brightness increases.

Step 1: BoM

  • Arduino 101 or Arduino Uno
  • 6 5mm LEDs
  • 6 100Ω resistors
  • Light dependent resistor or photoresistor
  • 10kΩ resistor
  • Buzzer
  • Breadboard
  • Male-to-male jumper wires
  • Female-to-male jumper wires
  • 6V battery holder
  • 6 AA batteries

Tools

  • Tape

Step 2: LEDs Pattern Design

  • Design you're own LED pattern to symbolize low sunshine levels over high sunshine levels. I opted for a circular shape to resemble the sun.
  • Connect all the anodes of each of the LEDs to a 100Ω resistor.
  • Then, connect the other end of these resistors to pins 3 to 8 in consecutive order from the LED you designate to be the first one to light up.
  • Connect all the cathodes of each of the LEDs to ground . The easiest way to achieve this will vary depending on the pattern you choose to design. If you were to design a meter-like design then connecting all the cathodes to the ground rail is easiest. In my case, connect the cathodes of LED pair then connecting them to the ground rail is easiest.

Step 3: Hardware Hookup

LDR (light-dependent-resistor)

  • Connect one of the LDR pins to the 3.3V pin on the Arduino
  • Connect the other pin to a 10kΩ resistor, then connect it in series to ground.
  • Connect this same pin to the analog A0 pin on the Arduino.

Buzzer

  • Connect one of the pins to pin 9 on the Arduino.
  • Connect the remaining pin to ground.

Step 4: Calibration

We need to calibrate the low light level and high light (i.e. sunshine) level based on the value being read by the light dependent resistor. The LDR will give a value from 0 to 1023, but we do not want the full range since it's very difficult to get 0 nor 1023.

By experimenting on it, I found a level from 500-950 works great! It would depend on where you are to, whether you are in Sunny California or Gloomy London.

Use the following code to read your lighting levels, covering the light-dependent resisitor to make it darker, or even using a flashlight. This will output the light readings to Serial Monitor:

void setup() {<br>  Serial.begin(9600);
}
void loop() {
  Serial.println(analogRead(A0)); //print light readings serially
}

Step 5: Coding

const int led1 = 3;
const int led2 = 4;
const int led3 = 5;
const int led4 = 6;
const int led5 = 7;
const int led6 = 8;
const int buzz = 9;
void setup() {
  pinMode (led1, OUTPUT);
  pinMode (led2, OUTPUT);
  pinMode (led3, OUTPUT);
  pinMode (led4, OUTPUT);
  pinMode (led5, OUTPUT);
  pinMode (led6, OUTPUT);
  pinMode (buzz, OUTPUT);
}
void loop() {
  int light = analogRead(A0);
  light = map (light, 500, 800, 0, 6);
  if (light >= 1)
    digitalWrite (led1, HIGH);
  if (light >= 2)
    digitalWrite (led2, HIGH);
  if (light >= 3)
    digitalWrite (led3, HIGH);
  if (light >= 4)
    digitalWrite (led4, HIGH);
  if (light >= 5)
    digitalWrite (led5, HIGH);
  if (light >= 6)
    {digitalWrite (led6, HIGH);
    tone(buzz,5000);
    delay(100);
    noTone (buzz);}
  delay (50);
  offAll();
  noTone(buzz);
}
void offAll (){
  digitalWrite (led1, LOW);
  digitalWrite (led2, LOW);
  digitalWrite (led3, LOW);
  digitalWrite (led4, LOW);
  digitalWrite (led5, LOW);
  digitalWrite (led6, LOW);  
 
}

Step 6: Testing

Before we mount the circuit we want to test it out and make sure it works.

  • Plug it in to the computer and upload the code. Move your hand up and down on the LDR to see if the LEDs react based on the lighting changes. This only works if you are below a light source so you're shadow covers it. If that's not the case, use a flashlight.

Step 7: Mounting the Sunshine Alert Meter

  • Remove the screen from your window and hang the light dependent resistor outside with a female-to-male jumper wire. Shut your window close, with the jumper wire snaked through it.
  • Re-place the window screen.
  • Mount the Arduino board and breadboard beside the window with clear tape or double sided tape.
  • Since we don't want it to be connected to a computer 24/7, tape a 6V battery above the Arduino.
  • Plug in the two wires from the LDR's jumper wire to the two holes the breadboard it used to be at when we tested it.
  • Plug in the batteries to run it.

Step 8: Done!

When the ring is fully lit and the buzzer is beeping, get out and play in this nice weather, while the summer lasts!

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017