Water Tap with sensor
The water tap with sensor inspired me if I can use servo motor to open and close the tap as (output) and the ultrasonic sensor used as a (input) when my hand is close to the water tap.
Programs:
1. Tinkercad first to assemble all the components together and simulate.
2.IDE: used to apply the code to the Arduino and test my project.
Components:
Jumper wires.
Cable.
ultrasonic sensor.
Servo Motor.
Arduino.
Breadboard.
Click here to see the simulation.
I started using Tinker Cad to make new circuit with selection of all Componentes :(Arduino, Ultrasonic sensor, servo motor and breadboard) and connect as following steps:
Ultrasonic sensor:
GND: using jumper wire connect with the -ve on Breadboard.
ECHO: using jumper wire connect with pin (3) on Arduino
TRIG: Using jumper wire connect pin (2) on Arduino.
VCC: Using jumper wire connect with +ve on Breadboard.
Servo Motor:
RED: refers to +ve so connected with the +ve of the breadboard using jumper wires.
ORANGE: Signal connected using jumper wire to the Arduino pin(9).
BROWN: The -ve connected to the -ve on breadboard using jumper wire.
Arduino:
5V: connect to the +ve of the breadboard.
GND: connect to the -ve of the breadboard.
Coding:
1.Created variable and give it the name of ultrasonic.
2.I chose the block called :(set ultrasonic to...........)
3. I add to the first block from input:(read ultrasonic distance sensor on trigger pin (2) echo pin (3)in units cm
4.from output blocks i chose:(print to serial monitor ..................with newline.
5.Chose from the variable blocks (ultrasonic) and added to the step number 4.
6.choose from control blocks:(if.....then.....else......)
7. change it into if (ultrasonic)< 80 then rotate servo on pin 9 to 90 degrees else rotate servo on pin 9 to 0 degree.
You can see the video by clicking here.
I connect all the components like the Tinkercad
Ultrasonic sensor:
GND: using jumper wire connect with the -ve on Breadboard.
ECHO: using jumper wire connect with pin (3) on Arduino
TRIG: Using jumper wire connect pin (2) on Arduino.
VCC: Using jumper wire connect with +ve on Breadboard.
Servo Motor:
RED: refers to +ve so connected with the +ve of the breadboard using jumper wires.
ORANGE: Signal connected using jumper wire to the Arduino pin(9).
BROWN: The -ve connected to the -ve on breadboard using jumper wire.
Arduino:
5V: connect to the +ve of the breadboard.
GND: connect to the -ve of the breadboard.
then I changed the coding in Tinkercad into Blocks + Text and copy the text the went to IDE and paste my text code and then connect the Arduino with the cable and test.
My project is a live
I used videos to learn more about coding and connecting the components.
when I wrote the code I switched between the pins of the Echo and Trig of the ultrasonic sensor this lead me to always check the pins and make sure that i've connected the right pin and coded with the right number also something would help is always to use external agenda to document everything step by step as a refrence while I'm working helped me to recognize my mistake.
switched to number of the 2 pins Trig and Echo
Ultrasonic sensor (input)+Servo Motor(output)+Arduino
I've learnt how to code using blocks and then change it into text as I can use it in IDE to bring my project a live.
how to make automatic and manual project and connect between them using switch.
We had great Kent's Got Talent and I really enjoyed the show especially year 2