The ability to measure the distance via ultrasonic sensor within the cost of a couple of dollars is quite fantastic, to be honest, and adding the wireless functionality is even appealing, you could use it as a parking sensor in an old car where the distance will be displayed on your phone instead of an external display.
So let us get started with the build! Here is the video tutorial for the same which also includes its working in real-time.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Things Required
Step 2: Connect the HC-SR04 to Arduino in the Following Way:
Vcc -- 5V
Trig -- Pin 13
Eco -- Pin 12
Gnd -- Gnd
Step 3: Connect the Bluetooth Module HC-06 to Arduino Nano in the Following Way:
Vcc -- 3.3V
Gnd -- Gnd
Tx -- Rx
Rx -- Tx
Step 4: The Library
For the library, you need to download the HC-SR04 Library for this, inside the Arduino IDE, go to Tools->Manage Libraries and then search HC-SR04 and install the one by Martin Sosic.
Step 5: Upload the Code!!
For this make sure the Tx and Rx pins of Bluetooth Module and Arduino are disconnected before uploading the code, after successful upload you can reconnect.
For the code, go to File->Examples->Tools->HC-SR04->Simple, Upload it to the Arduino. If you open the serial monitor at 9600 Baud rate after uploading the code, you will see the distance measured by the ultrasonic sensor. Now its time to add the Bluetooth module
Step 6: The Serial Monitor App
This is a generic Android application which acts as a serial monitor via Bluetooth, you can find similar apps on IOS.
Just go to the connect button and click the HC-06 to get connected.
Step 7: Done!
After Pairing and connecting the Bluetooth Module to the app, you would easily be able to read the data which measures the distance between the object and sensor in Millimeters, it is recommended that you do not measure the distance of less than 3 centimeters and more than 3 meters.
Thank You So Much For Reading!
Participated in the