Introduction: Arduino Light Intensity Lamp in Tinkercad

This is an Arduino light intensity lamp that I've made using Tinkercad. It's not too complicated and I tried to make the steps as easy to follow as I could for anyone who wants to create something similar. I had to make this for my computer engineering class. Essencially what we're making is a lamp that uses light to turn itself on or off, when it gets dark it turns on and when it gets dark it turns off. The main component of this circuit is the relay as it uses electromagnetic coils to turn smaller voltages into higher voltages. The reason why this is important is because the Arduino can only manage to produce 5 volts while the lightbulb used needs 12 volts toturn on.

Supplies

LDR (1)

1 KΩ Resistor (1)

Arduino Microcontroller (1)

Lightbulb (1)

Relay (1)

Power Source (1)

Breadboard (1)

Wires (12)

Step 1: Wiring

Gather your materials and connect wires from the arduino’s ground to the negative power rail on the breadboard and the 5V on the arduino to the positive power rail on the opposite side. Connect the negative power rails by attaching wires at the very ends of the power rails and connect the positive power rails by attaching wires at the very ends of the power rails. Now that all the rails have power, we can provide that power to the main part of the circuit. Place the relay with terminal six on space (20,f) and terminal 12 on space (25,e) then attach a wire of the power supply’s positive port to one of the terminals on the light bulb. Put a wire from the bottom negative rail in column 3 to space (3,a) and put a wire from the bottom positive rail in column 8 to space (8,a). Use a resistor to move the positive current from column 8 to column 4 so the negative and positive currents are next to each other. Place the photoresistor (LDR) so that the negative current goes through terminal one and so the positive current goes through terminal two. Add a wire from analog pin 0 on the Arduino in between the resistor and Terminal two on the photoresistor. This doesn't do anything now but will once we start coding. Attach digital pin 4 from the arduino to space (21,g) so that it can feed into terminal 5 on the relay. Attach a wire from column 21 to space (21,d). Attach a wire to the negative port of the power supply and attach the other side to spot (25,g) on the breadboard. Attach the other end of the bulb to spot (20,d). Once all these steps are completed you're done for the wiring.

Step 2: Coding

The coding takes a lot less steps than the wiring as all you need to do is add functionality to analog pin 0 and digital pin. For void setup make A0 input and make 4 output, pretty simple. For void loop make it so that if the value of analog read is greater than 500, pin 4 will be set to low. Otherwise it should be set to high.