The assignment for this week is to Build and Program a smart circuit using an Arduino UNO which reads a signal from an input component to control an action component using code blocks.
Inspiration
Here is the dinosaur game that we can play during internet disconnection.
So I tried to make the Arduino play instead of me and compare our results.
This site helped me to do the assignment.
Software
Arduino IDE to upload code to arduino boards.
Components
Arduino Uno to control the circuit.
Breadboard to connect all components.
potentiometer to get the suitable value to detect the change of light.
LDR to detect the light and changes.
Jumper wires for connection.
Servo motor to press the space button.
Circuit Diagram
Design Steps
Connect the LDR series with a resistor of 10k ohm to increase the sensitivity of LDR.
Connect a servo motor direct to the Arduino board.
Always initiate the angle of the motor to be 80 degrees.
Read the analog value of the LDR sensor to detect light changes.
After try and error, The value when an obstacle is coming always be larger than 650.
Compare the value with 650 as if it's smaller that means an obstacle is coming.
Then servo press the space button to make the dinosaur alive.
After many tries, set the angle of the servo to be changed to 100 degrees using the try and error method as it gives the best stable movement to press the space button.
Test the circuit and simulate it in Tinker CAD.
Design Implementation
Test the components before starting.
Connect the components together in the diagram above.
Try and error to get the required sensitivity for LDR in reality.
Try and error to get the required angle of servo movement to press the space button in reality.
Fix the servo beside the button and then start the dinosaur game and test the circuit.
Final Result
After testing the components, I found that the pins of the LDR sensor weren't working correctly, So I tried to test the LDR sensor inside the IC only using crocodile jumpers then I found that the problem was in the IC pins and the LDR resistor was working correctly.
So I used the LDR resistor inside the LDR IC using crocodile jumpers to make the project.
At first, I couldn't read values correctly from LDR alone, So after searching on the internet I found that I should connect it with a series 10k ohm resistor as the link here.
I learned how to use Arduino, how to deal with sensors and control the components using code blocks.
This Week, I made a simple box that can greet anyone in front of him.