Parking System Implementation Using RGB LED & Ultrasonic distance sensor || Arduino Micro controller Controller
Description:
Parking system is implemented using Arduino R3 micro controller and Ultrasonic Distance Sensor. purpose of this experiment to just see how these parking system can be implemented using cheapest technology we can also build home security systems, object identification systems etc. using same experimental components.
LED Experiment circuit:
Peepgram |
Peepgram |
Parking System Implementation:
Parking system is implemented using Arduino and ultrasonic sensor which turn the led red is the distance is below 20 and turn green otherwise. All object distance information displaying in the Serial Monitor for understanding purpose how object will be detected and distance calculated. Circuit and Code implementation is given below:
Peepgram |
Peepgram |
Peepgram |
Peepgram |
Code implementation:
const int Pin=7;
void setup()
{
Serial.begin(9600);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
}
void loop()
{
long inches,cm,duration;
pinMode(Pin, OUTPUT);
digitalWrite(Pin,LOW);
delayMicroseconds(2);
digitalWrite(Pin,HIGH);
delayMicroseconds(2);
digitalWrite(Pin, LOW);
pinMode(Pin,INPUT);
duration=pulseIn(Pin,HIGH);
inches=microsecondsToInches(duration);
cm=microsecondsToCentimeters(duration);
if(cm<20)
{
analogWrite(A0,255);
analogWrite(A2,0);
analogWrite(A1,0);
delay(1); // Wait for 1000 millisecond(s)
}
else
{
analogWrite(A0,0);
analogWrite(A2,255);
analogWrite(A1,0);
delay(1); // Wait for 1000 millisecond(s)
}
Serial.print(duration);
Serial.print("");
Serial.print(inches);
Serial.print("in");
//Serial.print();
Serial.print(cm);
Serial.print("cm");
//Serial.print();
delay(100);
}
long microsecondsToInches(long microseconds) {
// According to Parallax's datasheet for the PING))), there are 73.746
// microseconds per inch (i.e. sound travels at 1130 feet per second).
// This gives the distance travelled by the ping, outbound and return,
// so we divide by 2 to get the distance of the obstacle.
// See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) {
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the object we
// take half of the distance travelled.
return microseconds / 29 / 2;
}
Assignment Task:
you are instructed to create a parking system using LED and Buzzer with Arduino R3 board 30-04-2020 Dead Line strictly follow things which needs to be fulfill:
- all circuit designing should be using bread board
- All Ground, signal, and Power wires should be colors such as black for GND, red for power and Yellow for signal.
- LED will lighten up in two colors if the object is near 10-20 cm it should be RED and if the object is 21-40 cm it should be Green. LED will get off otherwise (if you led still on no marks will be given ).
- buzzer will only make sound whenever object get into less than 10 cm distance otherwise no sound should be generate (no marks if buzzer generate sound other than mention condition).
- Submit your code and screen shots of the Circuit in word file on the Link.
Post a Comment