FabAcademy 2017
TUYIHIMBAZE Serge

FabAcademy2017 - Projects





Input Devices
April 26, 2017 - Week#13

For Input Devices project, I have made a project that focuses on eliminating darkness. Whenever a room gets dark due to a fused bulb or any other factors, a light bulb automatically turns ON. It can be used to automatically turn a light ON whenever there isn’t sufficient light in a room. In order to detect the intensity of light or darkness, we use a sensor called an LDR (Light Dependent Resistor). The LDR is a special type of resistor which allows higher voltages to pass through it (low resistance) whenever there is a high intensity of light, and passes a low voltage (high resistance) whenever it is dark. We can take advantage of this LDR property and use it in our Circuit Board.
I did input devices together with the output Devices all at the same board which is also the board I am using for my final project. Here are the pins highlighted for the light sensor as input device.




How Does it Work? This system works by sensing the intensity of light in its environment. The sensor that can be used to detect light is an LDR. You can buy it from any local electronics store or online for a very affordable price. The light sensor detects the light and gives command to microcontroller to turn on the Light.



Here the codes I wrote to command the light sensor:


/*Codes for light sensor.*/
void setup() {
  pinMode(5,OUTPUT);
  Serial.begin(9600);
}
void loop() {
  int ldr = analogRead(A0);
  // print out the value you read:
  Serial.println(ldr);
  if(ldr > 800)
  {
    digitalWrite(5, HIGH);
    Serial.println("Dark Detected");
  }
  else
  {
    digitalWrite(5,LOW);
    Serial.println("Light Detected");
  }
  delay(500);        // delay in between reads for stability
}

The LED's I used are able to provide enough light when it is in the night or when there is no enough light.



Here is a video, watch it!