Light Intensity Lamp

by 652392 in Circuits > Arduino

207 Views, 1 Favorites, 0 Comments

Light Intensity Lamp

Bodacious Robo (3).png

In this instructable, we will be creating an automatic light intensity lamp in tinkercad. The idea of this circuit is to have the light turn on every time it gets dark. The circuit will be instructed as shown above using various components that will be listed below. The original lesson of this can be found by clicking here.

Now lets get started!

Swanky Tumelo-Jaban.png

Before we start building the circuit, there are some components that we will need. All components below can be easily found on tinkercad They include...

  • Aduino Uno R3
  • Solderless Breadboard
  • DC Power Supply
  • Light Bulb
  • Relay SPDT
  • 1000ohm resistor
  • Photoresistor

Connecting Ground and Power

Bodacious Robo.png

Before we can start to implement the other components into the circuit, we need to connect the ground and power to the breadboard. The red wire should be connected to the 5V power pin of the Arduino Uno, while the black wire can be placed into the GND power or digital pin on the Arduino.

Setting Up the Photoresistor

Bodacious Robo (1).png

Now that we've connected ground and power, let's connect the photoresistor. First. connect the photoresistor to the ground and then use the 1Kohm resistor to connect in to power. Next, connect the photo resistor to one of the analog pins on the Arduino as shown above with the yellow wire.

Connecting the Light Source

Bodacious Robo (2).png

The final step for setting up the circuit would be to connect the lightbulb. We will be using the relay, lightbulb and power supply. First, start by placing the relay on the breadboard and connect it to ground. After, connect a wire from one of the digital pins in the Arduino, to the relay as shown with the blue wire. Next, connect terminal 1 of the lightbulb to the relay as shown with the green wire above. After than connection is made, connect both the terminal 2 of the light bulb, and the relay to the power supply represented as the orange wires above. Now the circuit is complete.

void setup()
{

pinMode(A0, INPUT);

pinMode(2, OUTPUT);

}

void loop()

{

if (analogRead(A0) > 500) {

digitalWrite(2, LOW);}

else { digitalWrite(2, HIGH);}

}

This is the code that can be used to make the lightbulb only turn on when its dark. To explain, the pin modes represent the two wires that that are connected to the photoresistor which is "A0" and the relay which is "2" connected in the circuit. Secondly, the void loop follows a if/then statement, which allows the lightbulb to do two things depending on the value of the photoresistor. We are stating IF the photoresistor is less than 500, the light will be powered, which is value, is when the resistor is darker. Vise versa, If the photoresistor is over 100 or brighter, then the Arduino will not provide power to the relay.

Now we have a light sensitive lamp that will only turn on when it is dark. Hopefully you were successful in creating this circuit along with this intrsuctable. Thank you for reading.