This week's assignment is about building and programming a smart circuit using an Arduino UNO which reads a signal from an input component to control an action component using code blocks on TincerCAD.
I chose (Jolly Chimp monkey)
I designed my Jolly Chimp monkey to use the ultrasonic sensor to measure the distance between the monkey and the object and take an action depending on this distance.
The action will be a FATAL NOISEEEE
Software
Arduino Uno
Buzzer
Ultrasonic Sensor
Breadboard
Connecting Wires
5v Adaptor
Tools
Glue gun
scissor
sellotape
Material
Cardboard for the enclosure
Long screw
First, I used an Arduino Uno board to control my circuit.
I used an Ultrasonic sensor to detect the objects at a distance of 10 cm.
I put a buzzer to be an alert if any object enters the ultrasonic sensor range.
The same thing with the servo motor, it will rotate with a stick to make noise.
Ultrasonic sensor was programmed as an INPUT.
The Ultrasonic detection range is 10cm.
Buzzer was programmed as an OUTPUT.
Servo motor was programmed as an OUTPUT.
When the ultrasonic sensor detects an object at a distance of less than 10 cm, the buzzer will peep and the servo motor will rotate to 90 degrees for 0.3 second and then return to 0.
The positive terminal of the buzzer is connected with pin 13 in Arduino.
The negative one is connected with the common ground.
The red wire of the ŮŤservo motor is connected with the 5v pin in Arduino.
The black one is connected with the common ground.
The orange wire is connected with pin 7 in Arduino.
The Vcc terminal of the ultrasonic sensor is connected with the 5v pin in Arduino.
The GND is connected with the common ground.
The Echo pin is connected with pin 5 in Arduino.
The trigger pin is connected with pin 6 in Arduino.
Using Cardboard I was trying to make a monkey.
I mounted the ultrasonic sensor and buzzer to look like a monkey's mouth and eyes.
Final Result
I had a problem understanding the map() function, but with the instructor's help, I understood it.
Here is a nice tutorial that explains the map function.
Using Arduino to control my project.
Using Arduino IDE.