• nithya7rns

Smart Street Light Project using Arduino UNO, LDR and LED

Updated: Dec 31, 2020

Smart street lights are no more a myth. When we are capable of designing circuits at home and interfacing them with software to control their functions, on a larger scale there are developments happening that can make our lives better and decrease the use of non-renewable resources that we use daily.


All ideas and plans get executed at home or the workplace in the beginning. It's time to learn how to develop or design a smart system and control the devices. So, let's begin with the hardware requirement.


Hardware Requirements


  1. Arduino UNO Board.

Develop a stronger concept in Arduino through this article:- What is Arduino?


Arduino UNO

#Arduino board is a microcontroller that is used to accept inputs from sensors connected and provide an output action on the desired device connected to it. The sensor inputs can be from light-detecting sensors, motion sensors (Ultrasonic or IR), temperature sensors, etc. The output from this device can be received through other output devices such as LED, Buzzer, Serial monitor, etc.


Buy Arduino UNO from here.

2. Resistors


1.5k Ohm Resistor

Resistors are passive devices that restrict the flow of current or divide the voltage through the circuit. The input power passes through these resistors and then to the sensors to avoid damage.

Buy Resistors from here.


3. Jumper Wires



Jumper Wires

These are the main components that are used to establish the connections between different devices of the circuit.


Buy Jumper Wires from here.


4. LDR (Light-Dependent Resistor)


LDR

LDR is a #photoresistor that works on the principle of #photoconductivity. The surface of the LDR is made with a layer of semiconducting material that is responsible for measuring the light intensity. The principle states that when light falls on the surface of the semiconducting material, the electrons receive energy, and movement is caused inside the material.

When those electrons reach the valence band, electron-hole pairs are formed. This in turn reduces the resistance of the material and the corresponding voltage is given as the output of the device.

Buy LDR from here.


5. Bulb


Bulb

Electric bulbs, otherwise called incandescent bulbs are electrical components that emit light when a certain amount of power is given to them. Usually, bulbs are manufactured in a wide range of sizes based on the input power capacity. Ex. 1.5V, 13 Watts, etc.


Buy an Electric Bulb from here.


6. Power supply


Power supply

DC Power supply is used for electricals components like the electrical bulb. Alternatively, Power supply modules can be used to connect electrical components. In this circuit, we will be using the DC power supply component in the simulation software.


Buy DC Power Supply from here.


7. NPN Transistor


NPN Transistor

It is a low-power amplifying #transistor. A common NPN Bipolar Junction transistor (#BJT). This transistor is usually used for Switching purposes as we have used in our circuit. When no current flows through the base, a very small amount of current flows through the emitter and collector. this means the base current allows the transistor to switch off. This is the switching function of the transistor.


Buy Transistors from here.


NOTE: The description of the electrical components is given for reference. We don't need the physical components for this project. The circuit simulation is done in the TinkerCad software.

Software Requirements


TinkerCad circuit simulation software.

TinkerCad Logo

It is an online simulation software used for circuit design. It has all the electrical components required to built circuits and runs them.


Visit the TinkerCad website.


Circuit Connections


Circuit Diagram

The circuit connections are as follows.


Terminal one of the #LDR is connected to the 5V supply pin of the Arduino board. the second terminal of the LDR is connected to the analog pin of the LDR (A5) which is the input. The same terminal is also connected to the Ground terminal of Arduino through the resistor.


The positive terminal of the power supply is connected to one of the terminals of the Bulb. The negative terminal of the power supply is connected to the ground terminal of the Arduino Board. The second terminal of the bulb is connected to the #Emitter pin of the Transistor.


The #collector terminal of the #Transistor is then connected to the ground terminal of the power supply device. Finally, the base terminal of the transistor is connected to any of the Digital pins (D3) of the Arduino Board through the resistor.


Code


The code for this circuit is simple to understand.


int ldr=A5;
int ldr_value;
int light=3;

Declaration of variables is the first step. Here, the integer variable "ldr" is assigned with the value of the PIN of the Arduino Board connected to it. Another variable, "ldr_value" is declared which will be storing the input values from the LDR sensor. The variable "light" is initialized with the value 3.

void setup()
{
pinMode(light, OUTPUT);
pinMode(ldr, INPUT);
}

setup( ) function is going to assign the pin modes for the variables declared. The light variable will be the one connected to Bulb. Hence it is assigned as an output. The LDR is the sensor and will take input values and hence it is assigned as Input.

void loop()
{
ldr_value=analogRead(ldr);

The loop( ) function is going to execute the lines of code repeatedly. First, the "ldr_value" is going to get values from the sensor which is received from the analogRead( ) function.

if (ldr_value>512)
digitalWrite(light, LOW);
else
digitalWrite(light, HIGH);
}

The "if" and "else" conditions are written to check the value of the input from the LDR sensor. If the value from the input exceeds the value 512, the Bulb remains OFF. If the value exceeds the value of 512, the Light bulb is switched ON.


COMPLETE CODE


int ldr=A5;
int ldr_value;
int light=3;
void setup()
{
pinMode(light, OUTPUT);
pinMode(ldr, INPUT);
}
void loop()
{
ldr_value=analogRead(ldr);
if (ldr_value>512)
digitalWrite(light, LOW);
else
digitalWrite(light, HIGH);
}

NOTE: The default code present in the TinkerCad window needs to be removed and the program code needs to be written. Download the document and copy-paste the code in Tinkercad to simulate the circuit.

Code for Smart Street Light
.docx
Download DOCX • 11KB

Working


Circuit connection with Output

Let us first learn how to work on TinkerCad #simulation software. Once on the #TinkerCad page, select circuits, and search for the components required. The components are to be dragged and brought to the circuiting screen. The connection needs to be made by selecting the jumper wires. Corresponding colors for the wires can be selected.

Learn more about TinkerCad in detail.

Now let us understand how the circuit works.


LDR is the photoresistor, a sensor that has semiconducting material on its surface. When light strikes on the surface of the LDR, the electrons present in the valence bond of the material are excited to the conduction band. This in turn will generate a voltage that will be given as output based on the input light #intensity.


When the LDR gives output to the analog pin A5 of Arduino, the value is stored by the board itself. (It has a Flash memory). The transistor acts as a switch in this circuit. It will control the Light bulb based on the sensor output value. The #collector is connected to the Ground.


The base terminal of the Transistor is connected to the digital pin of Arduino through which the bulb will be controlled. That means, whenever there is a change done to the pin 3, there is a change in the status of the bulb as the emitter of the transistor goes further to connect to the second terminal of the light bulb.


Hence to summarise the working, the LDR sensor receives input based on the input light intensity. Those #voltage values are displayed on the power supply device panel. The transistor acts as a switch that is connected to the Arduino board through which it will control the bulb.


Watch the below-given project video for the practical explanation of designing the circuit and to know how the simulation #software works.

Project Video By - Navya Tatiparthi

Simulation software plays a major role in the building of large circuits as they help analyze the working of the circuit before it can be built practically. It helps us create a #virtual design of the circuit we want to build and avoid damages to the circuit if in case we don't know, beforehand about the correct circuit connections.


For more projects through TinkerCad click here.

Simulation software can help us build more effective and efficient projects as it provides validation for the circuit we will be building using the actual components. Smart Light system lays down a basic idea for developing more smart and automated systems. #Design your own circuit, run the code in the software, automate other devices like motors, etc. to build smart systems, and validate your project.


SEE ALSO:

  • Facebook
  • YouTube
  • Instagram
  • LinkedIn
LearnElectronics
Contact Us
© Copyright - LearnElectronics 2020.