Introduction: Arduino Light Intensity Lamp

Here is how to create a light Intensity lamp using the Arduino. This demonstration is done through TinkerCad but don't hesitate to transfer this virtual circuit into physical hardware components. This is definitely a great project for beginners and for people learning to use different hardware components on the Arduino.

Step 1: What You Will Need

Here are the supplies that you would need to create this circuit.

1. Arduino

2. Lightbulb

3. Bread Board

4. LDR

5. Arduino Relay

6. 1 Kilo Ohm Resistor

7. Jumper Wires

8. Power Supply

Step 2: Basic Component Assembly

You want to begin by assembling the circuit. Whether if its on TinkerCad or on a physical Arduino, you want to begin making sure that the breadboard is connected to 5V on the Arduino and to ground (both sides of the breadboard).

Relay

  • Begin by taking your Arduino Relay and placing it on the bridge of the breadboard. Connect terminal 8 to ground
  • Connect Terminal five to Digital Pin 4 on the Arduino

LDR

  • Connect the first leg of the terminal to ground
  • Connect the second leg of the terminal to a 1 kilo ohm resistor which then connects to power
  • Also connect the second leg of the terminal to Analog Pin A0

Step 3: Further Component Assembly

Now we will assemble the light bulb and the power supply.

Light Bulb

  • Take the first leg of the terminal on the light bulb and connect it to terminal 7 on the relay using jumper wires
  • Take the second leg of the terminal on the light bulb and power on the power supply (make sure you are NOT connecting it to the power supply on the Arduino)

Power Supply

  • Connect the negative wire of the power supply to terminal 1 on the relay
  • (you have already connected the positive wire to the Light Bulb)

Step 4: The Code

If you're using TinkerCad or if you're physically using an Arduino you can use the same code. Just make sure you select 'Text' on TinkerCad to do so. What the code allows us to do is turn the light bulb on or off. How this happens is if the analog pin reads more than 500, then digital pin 4 will be LOW, and if it reads less than that value, then digital pin 4 will be HIGH.

Here is the code:

void setup()
{ pinMode(A0, INPUT); Serial.begin(9600);

pinMode(4, OUTPUT); }

void loop() { Serial.println(digitalRead(A0)); if (analogRead(A0) > 500) { digitalWrite(4, LOW); } else { digitalWrite(4, HIGH); } delay(10); // Delay a little bit to improve simulation performance }