Intro: Ultrasonic Parking Sensor With Arduino
Today, I will be showing you how to make a parking sensor using a few simple materials and a few lines of code. This project will take about 20-30 minutes to complete and will teach you the basics about how to use an Arduino and other components such as LEDs and ultrasonic sensors.
Step 1: Materials
You will need:
- An Arduino (I'm using an Leonard but you can use any of the Arduino boards)
- Ultrasonic Sensor (HC-SR04)
- RGB LED or you could use different single LEDs
- Jumper Wires
Simply enough, Let's get started!
Step 2: Step 1: Breadboard
To start you will want to place your ultrasonic sensor and LED into your breadboard like shown in the picture.
Step 3: Step 2: Wiring
The next step is to wire everything up. You can follow the images to see how I did it.
First hook up GND and 5v to the power rails on the breadboard.
Then hook up the LED to the Arduino and GND rail.
Blue --> Pin 10
Green --> Pin 11
GND --> GND
Red --> Pin 12
Finally hook up the Ultrasonic Sensor to the Arduino, GND rail and 5v rail.
VCC --> 5v
Trig --> Pin 0
Echo --> Pin 1
GND --> GND
If you decide to change up the pins on the Arduino make sure you change it in the code as well. (last picture)
Step 4: Step 3: Upload the Code
Download the Arduino code and upload it to your Arduino.
and your done :D
Step 5: Step 4: Testing
You'll need something stiff like a credit card or maybe your car ;) move the object back and forth and you'll see the colour of the LED change depending on where the object is positioned.
Step 6: Step 5: Using Serial
If you wanted to see the actual distance of the object and what the Arduino is reading, you can open serial.