This instructable will show how to build a digital tape measure using HC-
SR04 ultrasonic distance sensor and Arduino Pro Mini.
This is inspired by electronic technology and can find everyone's guidance here.
I have joined this project in the technical competition, so please vote if you like this. You will need:(
Note: Many of the above items can be found in this kit I purchased and recommended)
Tools: I use an old iPod nano retail box as the case for my digital surveyor with a 400 tie
Order the bread board.
In order for it to fit the container, it is necessary to remove one of the power rails.
To drill holes for the ultrasonic sensor, first put it into the housing and mark the profile of the transmitter and receiver.
Then grind the holes using the Dremel tool.
You should also drill a hole on the side of the power switch and on the front of the two buttons.
Next, drill four holes in the lid to keep the screen.
My initial plan was to use the screws, but I didn't have the screws that were narrow enough and long enough to install them, so I replaced them with kinks.
Assembly is one of the more difficult parts because there are too many things to assemble in a relatively small area.
Finally, I had to bend the pins on the LCD screen to make them parallel to the back of the LCD and move the 9v battery to the outside of the case.
I saved some space by using kinks on the wires of the LCD and using some connecting wires on some breadboard connections instead of longer DuPont wires.
I also ended up changing the larger 50k pan to a smaller 10k Pan in shape.
Once all the wiring is done and everything is in place, the case won't be closed all the time, so I keep it firmly closed with tape.
The Fritzing diagram above shows how I can connect this project, and the connections are listed below.
Buttons need to be connected to D2 and D3 and need to be high when the button is pressed.
They should have a ground drop down resistor when not pressed, I used 4. 7k resistance.
Arduino | LCD Arduino | HC-
SR04 the code for this is slightly different from most other Arduino projects because there is no code in the loop.
Instead, it runs under interrupts, which means that the code will only be executed after the user has entered it;
In this case, press one of the buttons.
Arduino Pro Mini can only accept interrupts on digital pins 2 and 3.
Set the interrupt so that when the voltage rises are detected on pins or 2 or 3 (
, The function connected to the interrupt will execute.
Set a button to measure the other switches between the SI and the unit of measure.
The SI units are in feet and inches and the meter units are in centimeters.
The code defaults to the standard speed of sound speed, but there is also a scaling factor (
You can adjust these values if you find a systematic deviation.
The speed of the sound is affected by many factors, including temperature, altitude, and humidity, so experiment a little to see if you need to adjust the fuzzy factor variable to achieve good results.
The ultrasonic sensor is very simple to work by placing the launch pin for a period of time (
I use 10 ms.
, Then pull it down and use pulseIn on the receiving pin.
Pulse in measures the time between the called function and the level set in the function in microseconds, which is high in our example.
Then we can use this time.
Divide by 2 to calculate round trip)
To calculate the distance.
If you have never programmed the Arduino Pro Mini, you can check step 4 in my motion detector and provide LED guidance for beginners for detailed instructions.
For Arudino Uno, this code should also work without modification.
I'm already embedded.
The ino file here, you can find the code on my GitHub page. Congrats!
You have finished your own digital tape measure!
I found that my own digital tape measure was accurate to about 0.
1 inch, although it seems to be only about 13 feet before giving the garbage result.
It also does its best on a bigger, flat surface, so I won't throw away your normal tape measure.
I hope you find this helpful and interesting, please let me know in the comments if you have any questions!