I'll show you how to use a HC-SR04 Ultrasonic Sensor to find distance measured in inches and feet. With
a wonderful Arduino Uno R3 Clone created by Elegoo
I will be using my own code that I will up load later in this Instructable.
I hope you enjoy :)
Step 1: Gather Parts
Has everything you need!
- 1 - Arduino uno R3
- 1 - Ultrasonic Sensor
- 1 - LCD Liquid Crystal Screen
- 2 - 10K Potentiometer
- 1 - Breadboard
- About 20 - Male to Male Jumper Wires
- 1 - 9 Volt Battery if you want to make it portable.
Step 2: Wire Everything Up.
First start with the LCD screen.
LCD - Arduino
- VSS - Ground
- VDD - +5VDC
- VO - Middle of Potentiometer Left side to +5VDC and Right side to Ground (Controllers Contrasts)
- RS - Arduino Pin 12
- RE - Ground
- E - Arduino Pin 11
- D4 - Arduino Pin 5
- D5 - Arduino Pin 4
- D6 - Arduino Pin 3
- D7 - Arduino Pin 2
- A - +5VDC
- K - Middle of Potentiometer Left side to +5VDC and Right side to Ground (Controllers Brightness)
Then wire up the Ultrasonic Sensor
Ultrasonic Sensor - Arduino
- VCC - +5VDC
- Trig - Arduino Pin 6
- Echo - Arduino Pin 7
- Gnd - Ground
Step 3: Upload Code
I included the Code I used in this instructable.
Just click on the .ino file and open with the Arduino IDE and upload to you Arduino.
Step 4: Take You Project Farther
You can replace the 10K Potentiometer with a resistor by using a multimeter you can find the resistance between the middle pin one of the outer pins. In my case a 9.5K Ohm resistor is needed for my brightness (Yours may vary).
Now you wont have to worry about turning the Potentiometer. You can solder all parts to a prototyping board and make you own shield for you Arduino if you would like.
Or you could even build you own Arduino and this project or its own board and enclose it into a case.