Introduction: Arduino - HC SR04 Ultrasonic Distance Sensor/ Ultrasonic Range Sensor
Hello world! Today i made a pretty handy thing. A Distance meter with a ultrasonic distance sensor. it works perfect and can be used for a lot of things, like robot positioning etc. Don't mind the phone and Bluetooth module you don't need it, i'm just displaying the value on my phone with my android serial monitor app. Follow the next step for the Schematic Code & parts list.
Step 1: Schematic, Code & Parts List
Just wire it up like the schematic and it should work after uploading the code.
If you are using a LCD with a I2C then make sure you use the right address, i already set the lines
for using a I2C, you just need to uncomment them, and remove or comment this line below:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Here are the most common addresses. Look at the back of your lcd which screen you have.
//PCF8574 = 0x20, PCF8574A = 0x38, PCF8574AT = 0x3F.
You do not need the bluetooth module! i just used it to display values on my android app.
- Arduino uno, I used the RobotDyn uno. A Uno with 7 analog pins.
- HC-SR04 Ultrasonic Distance/range sensor.
- LCD 1602A, i used blue screen. (The code also has a setup for a I2C, you need to uncomment that part.)
- Potentiometer 10k
- Set of jumper wires MM/FF/MF
- (OPTIONAL)HC-06 Bluetooth module. To display values on my app.