Step 1: Supplies
In order to build this, you will need:
·An Arduino (I used Uno)
·The Arduino IDE
· Android Serial Monitor app
·One HC-06 Bluetooth module
·A Battery Case
·Batteries for case
·Male to Male jumper wires
·Male to Female jumper wires
All of these can be found at Amazon for as little as $40. Now that we have our parts, let's get building!
Step 2: Wiring
Using the diagram, connect the echo pin of the HC-SR04 to pin 8 on the Arduino using the male to female wires. Connect the trig pin to pin 7 in the same way. Once this is done, place the vcc and gnd pins in separate breadboard rows. Now for the Bluetooth! Although the Bluetooth is optional, it allows us to view the data without connecting it to the computer. Place the rxd pin in pin 1 of the Arduino,and place the txd pin into pin 0. The place the vcc and gnd pins in the same breadboard rows as the vcc and gnd of the HC-SR04.
Step 3: Finish Wiring and Coding Arduino
Now for the Arduino! Connect the 5V pin to the vcc breadboard row. Do the same for the gnd Arduino pin and the gnd row. Now for the code! Using the Arduino IDE, upload the code below to your Arduino. You may have trouble uploading the code to the board. This is because of the Bluetooth module. To fix this, simply unplug the Bluetooth module until the code is done uploading.
Step 4: Turn It On
Time to test our device! Put the batteries in the case. Then connect the positive (red) wire to the vcc row, and the negative (black) wire to the gnd row. You should see the Arduino and the Bluetooth light up. Now connect to the Bluetooth (normally HC-06) through the Android Serial Monitor app. Once connected, you should see the readings from the device.
Step 5: Done!
Now that you've built it, there are easy ways to modify it for different projects. With some small code changes, this design can be used for a radar in an RC vehicle, an electronic thief detector (in my next Instructable I will build one) and other things. It's all up to you. Have fun!