the idea of my project is Distance Detector!
The assignment for This week is building and programing a circuit with an Arduino uno which reads a signal from an input component (Ultra sonic sensor) to control an action component (Buzzer and LED)
Alarm circuit, to detect the distance and alarm when the body passes in front of ultra sonic sensor .
if the distance between the object and the sensor more than or equal 30 cm the buzzer will work and make sound.
- if the distance between them less than 30 the led will work and emitting light.
For this assignment i used:
1- Jumpers
2- Resistor 220 ohm
3-LED
4- Buzzer
5-Breadboard
6- Ultra sonic sensor
7-Arduino uno
8- Tinkercad
9- Arduino uno software
Arduino uno
Tinkercad software
Arduino uno software
Jumpers
Breadboard with buzzer and led
I used tinker-cad to design and simulate the circuit before connecting it with Arduino
Connecting the led (the negative pin with 220 ohm resistor and the positive with pin6)
Connecting the buzzer ( the negative with gnd and the positive with pin 9)
Connecting the ultra sonic sensor with Arduino ( vcc with 5 v, trig with pin10, ECHO with pin11 and the last pin with gnd)
if the distance between the object and the sensor more than or equal 30 cm the buzzer(pin 9 is High) will work and make sound.
- if the distance between them less than 30 the led will work (pin 6 is High) and emitting light.
After finishing the connections, I wrote the code on Tinkercad.
The simulation of the circuit
Connecting the components on breadboard then with Arduino.
Connecting the led (the negative pin with 220 ohm resistor and the positive with pin6 on Arduino )
Connecting the buzzer ( the negative with gnd and the positive with pin 9 on Arduino)
Connecting the ultra sonic sensor with Arduino ( vcc with 5 v, trig with pin10, ECHO with pin11 and the last pin with gnd)
Then i take the text after transfer the block-code on tinker-cad into text code and put it on Arduino.
Text code on Arduino
Connecting the led and the buzzer on breadboard
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}
void setup()
{
pinMode(9, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
if (0.01723 * readUltrasonicDistance(10, 11) >= 30) {
digitalWrite(9, HIGH);
} else {
digitalWrite(9, LOW);
}
if (0.01723 * readUltrasonicDistance(10, 11) < 30) {
digitalWrite(6, HIGH);
} else {
digitalWrite(6, LOW);
}
delay(10); // Delay a little bit to improve simulation performance
}
wiring with Arduino
In the offline session we're divided into groups, I worked with Salma and Aya to build smart waving hand with two modes:
Manual mode ( ultra sonic sensor with servo motor)
Automatic mode ( potentiometer with servo motor)
salma helped us to control on servo motor and how to write the code.
Aya worked on the model and i worked on wiring.
Automatic Mode
Manual Mode
Firstly, i made another circuit to this assignment ( fire alarm)
the circuit consists of buzzer, led and LM 35, made it on tinkercad and wiring with arduino, it works successfully! :D
Butttttt! before recording the final outcome, one of pins of the temperature sensor has been broken today before the deadline :((
so i changed the fire alarm to this project
I'll use Arduino uno in my final project
Title of Media
some exercises i practice on