I will start implementing my final Project idea. One of the main features of my project is to use the servo motors to make the solar cell face the sunlight. So , I will make a circuit that receives a signal from light sensor (Input) and upon this signal the servo motor will move (Output).
Software: Tinker CAD
1 Breadboard
1 Servo Motor
1 220 ohm resistor (Tinkercad only)
Jumpers
LDR Module
Arduino UNO
Software: Arduino IDE
I started by placing all the components I needed, such as the Servo Motor (Output), resistor, and LDR (Input). I then connected the circuit as shown in the screenshot (I also replaced the LDR module with just a normal LDR(photoresistor )on tinkercad because the module is not on tinkercad).
After that I started to think about the code , I decided to move the servo motor upon condition simulate this movement in the final project , so I started by defining a new variable under the name (LDR_Value) to store the reading of the sensor , then I printed this variable on the serial Monitor so I can know the range of values to easily make the condition. I found it ranges from to (6 to 679).
I decided to make the condition that the servo will move 180 degrees if the sensor reading exceeds 500.
I started connecting the components to the breadboard and the Arduino as follows :
First , connect the 5V pin of the Arduino to the positive rail of the breadboard
Then connect the GND pin to the -ve rail of the breadboard
Start connecting the Servo Motor , Orange wire to pin 7 (Digital I/O) , red wire to the +ve rail in the breadboard , brown wire to the -ve rail of the breadboard.
after that connect the LDR module , as follows : VCC--->+ve breadboard, GND--->-ve breadboard, A0--->A0 pin (Analog Input).
After that , Copy the code from TinkerCad and paste it in Arduino IDE .
Connect the USB , Upload the code to the Arduino Board .
The challenge was that the LDR Module wasn't found on Tinker Cad . I searched and I found that there is a component called photoresistor without module . I found that it also reads analog signal so I decided to use in in the simulation.
Article to understand the LDR and LDR Module :
Also , I have changed the Digital pin of the servo motor from pin 7 to pin 9 because there is a jumper broken in this pin.