This week's assignment is to build and program a smart circuit using an Arduino UNO that reads a signal from an input component to control an action component.
I decided to use the Photo-Resistor LDR Light Sensor Module (as an input) to move the servo motor (output component), as I plan to use a similar idea for my final project and want to gain experience.
TinkerCad
I used Tinkercad to build and test the circuit connections and ensure everything was functional before installation.
Material used in Tinkercad
1 Breadboard
1 Arduino UNO
1 Servo motor
1 PIR sensor (Simulaties LDR Light Sensor)
Materials for electric circuit
1 Breadboard
1 Arduino UNO
1 Servo motor
1 LDR Light Sensor
I used Tinkercad to build and test the circuit connections, ensuring everything was functional.
I connected the 5V from the Arduino to the positive rail on the breadboard.
Then I connected the servo motor's ground to the Arduino's GND and its power to the positive rail on the breadboard, with the signal pin connected to Digital Pin 2.
For the PIR sensor, I used the same connections as the servo, with the signal pin connected to Digital Pin 4 on the Arduino.
Connections
Simulation
For the code, I used Tinkercad code blocks.
I used the (IF-ELSE) block for conditioning. The condition is when the LDR sensor senses light (Pin 4 is HIGH or equals 1), the servo motor (Pin 2) rotates 180 degrees. If not, the servo motor does not move or return to its original position.
Code
I recreated the Tinkercad circuit using hardware components.
*steps:
connected the 5V from the Arduino to the positive rail on the breadboard
connected the servo motor's ground to the Arduino's GND and its power to the positive rail on the breadboard, with the signal pin connected to Digital Pin 2.
For the LDR sensor, I used the same connections as the servo, with the signal pin connected to Digital Pin 4 on the Arduino.
Then I got the text code from Tinkercad, placed it in the Arduino IDE, and uploaded it.
Building the circuit
Connections
Testing the circuit
I wanted to integrate the Temperature sensor (LM35) with the LDR sensor to make the circuit with two inputs, and one output (Servo motor's motion)
Title of Media
Title of Media
Title of Media