Question

In: Physics

If i want to design speed breakers using ultrasonics sensor for measuring speed of the car...

If i want to design speed breakers using ultrasonics sensor for measuring speed of the car and if the speed greater than or equal 25km /h trun the LED green and open the lock
And if the speed more than 25km/h turn the LED red and close the lock using ardoino program

Solutions

Expert Solution

You need the following components to design this system:

Nano Arduino

Battery

Battery Connector

Ultrasonic sensor

Buzzer or similar alert system

First connect ultrasonic sensor to arduino. Then connect this system to the battery using connector. Connect this to the buzzer.

please find the code below:

## defining the pins connection

const int trigPin = 12;

const int echoPin = 11;

const int buzzerPin = 13;

// defines variables

int setDistance=20;

int GetDistance()

{

long duration;

int distance;

// Clears the trigPin

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

return distance;

}

void setup() {

// put your setup code here, to run once:

// initialize the digital pin as an output.

// Pin 13 has an LED connected on most Arduino boards:

pinMode(trigPin, OUTPUT); // trigPin as an Output

pinMode(echoPin, INPUT); // echoPin as an Input

pinMode(buzzerPin, OUTPUT);

Serial.begin(9600);

delay(1000);

//setDistance= GetDistance();

//setDistance=8;

}

void loop() {

Serial.print(“Current Distance: “);

Serial.print(GetDistance());

Serial.print(” Set Distance: “);

Serial.println(setDistance);

if(GetDistance()<setDistance-1)

{

digitalWrite(buzzerPin, HIGH);   // LED on

}

else

{

digitalWrite(buzzerPin, LOW);   // LED light on

}

delay(5000);

}


Related Solutions

How can I make calculations and design a toy car running at a speed of 10m/s...
How can I make calculations and design a toy car running at a speed of 10m/s and which should cover a maximum distance of 30m? The design should consist of springs, gears, shafts, rack, and pinion. Urgent help needed.
How to "Measuring the Speed of Neural Transmission”?
How to "Measuring the Speed of Neural Transmission”?
I want to design an algorithm decides on the notes to give a customer at a...
I want to design an algorithm decides on the notes to give a customer at a cash dispensing machine. The machine only has $20 and $50 notes and I want my algorithm to dispense the minimum number of notes to the customer. This means that if a customer wants $120 then the machine will dispense two $50 notes and one $20 note rather than six $20 notes. I propose an algorithm to solve this problem. My algorithm is: input: amount...
i want for an exercise to find the materials for a supsension car system and manufacturing
i want for an exercise to find the materials for a supsension car system and manufacturing
I want answers in 60 minutes Design a CV for the job of a Physiotherapist at...
I want answers in 60 minutes Design a CV for the job of a Physiotherapist at any hospital supposing an individual has completed DPT with an A grade and have 2 years of professional experience in the related field. Your answer Define the terms: Cohesion, Coherence, Skimming, Scanning Your answer You are the CEO of a company write a memorandum to your staff explaining the new software the company has purchased. Your answer What five major details should a person...
I want to design a project for fun, since I am planning to take electromagnetics next...
I want to design a project for fun, since I am planning to take electromagnetics next semester. I need help with this design Design Construct and demonstrate An arc generator solely driven by electrostatics, magnetostatics, and/or electromagnetics Techniques using only household materials and a 9V battery.
A car traveling with constant speed travels 150 km in 7200 s. What is the speed of the car?
A car traveling with constant speed travels 150 km in 7200 s. What is the speed of the car? Express the speed with the appropriate units.
Hi, I want to design a LAN infrustrure for a building that has 5 Levels OR...
Hi, I want to design a LAN infrustrure for a building that has 5 Levels OR floors. The 1st Level is called ground floor. Can you please help?
A major road with a design speed of 90km/h intersects a minor road whose design speed...
A major road with a design speed of 90km/h intersects a minor road whose design speed is 50km/h. If the right of way of the main road is 20m while that of the minor road is 10m and that the two roads are perpendicular to each other, calculate the size of the sight triangle. NOTE: The right of way is measured from the centre of the road. (According to TRH170
I want the code for the 2D Ising model using Matlab
I want the code for the 2D Ising model using Matlab
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT