This article is for developers interested in the Internet of Things. I'll describe an Arduino project with automated lights that turn ON/OFF with a weather change as per the light intensity in LDR.
Requirements
- Arduino Uno
- Arduino Software
- One LED light “5MM”
- 300 Ohm resister (2)
- Jumper wire only five (Male to Male)
- Bread broad
- LDR (Light Dependent Resistor)
Steps to follow,
Step 1
First, connect the Arduino with the laptop or computer. Light blinks in the Arduino board.
Step 2
If you don’t have Arduino software take a look at this website
https://www.arduino.cc/en/Main/Software
Then after the installation process is complete, this page will appear on your screen
Step 3
Then Click TOOL- Select BOARD - Then press ARDUINO/GENUINO UNO R3
Again Select TOOL - Select a PORT- COM3 ARDUINO UNO
Step 4
I have given a source code you can use this or you can use your own source code.
Source Code
- constintledPin = 13;
- constintldrPin = A0;
- void setup() {
- Serial.begin(9600);
- pinMode(ledPin, OUTPUT);
- pinMode(ldrPin, INPUT);
- }
- void loop() {
- intldrStatus = analogRead(ldrPin);
- if (ldrStatus <= 200) -- - {
- digitalWrite(ledPin, HIGH);
- Serial.println("LDR is DARK, LED and BUZZER is ON");
- }
- else {
- digitalWrite(ledPin, LOW);
- Serial.println("---------------");
- }
- }
Step 5
Then click the verify button, to verify the program coding.
Automatic lights on and off Circuit diagram using LDR with the weather change.
Then click this button to upload.
When lights in my room are on the light in the bread broad is also off
These are the comments found in the dashboard of Arduino Software when Light in the breadboard is Off
When Room Lights are OFF, LDR sensor resistance becomes very high and with the help of our program Lights in the Breadboard turns ON.
These are the comments found in the dashboard of the Arduino Software when the light in the breadboard is On.
Weather change LDR resistance changes. The LED glows when light intensity is less and turns OFF when light intensity is high. This program is very simple to handle.
An Arduino project with Automated lights ON/OFF with Weather change is hence created and executed.
Very exciting articles are coming up next.