Digital Ultrasonic Tape Measure




This instructable will show how to build a digitial tape measure using a HC - SR04 ultrasonic distance sensor and an Arduino Pro Mini. This was inspired by elecronics for everyone's instructable which can be found HERE.

I have entered this in the Tech contest so please vote if you like this.

Step 1: Supplies

You will need:

(Note: many of the above items can be found in this kit which I have purchased and recommend)


  • Wire strippers
  • Soldering iron and solder
  • Rotary tool

Step 2: Constructing the Container

I used an old iPod nano retail box as a case for my digital measurer and a 400 tie-point breadboard. It was necessary to remove one of the power rails from to make it fit in the container. To make the holes for the ultrasonic sensor first put it in the case and mark the outlines of the transmitter and receiver. Then use the Dremel tool to grind out the holes. You should also drill a hole in the side for the power switch and the front for the two buttons. Next drill four holes in the lid to hold up the screen. My original plan was to use screws but I didn't have any that were narrow and long enough to fit so I used twist ties instead.

Step 3: Wiring and Assembly

The assembly was one of the more difficult parts because there is so much to fit into a relatively small area. In the end I had to bend the pins on the LCD screen so that they were parallel to the back of the LCD and move the 9V battery to outside of the case. I was able to save some space by using twist ties on the wires to the LCD and using some hookup wire for some of the breadboard connections instead of longer Dupont wires. I also ended up switching out the larger 50k pot for a 10k pot with a smaller form factor. Once all of the wiring was done and everything was in place the case no longer shut all of the way so I used electrical tape to hold it firmly shut.

The Fritzing diagram above shows how I wired this project and the connections are listed below. The buttons need to be connected to D2 and D3 and need to go to HIGH when pressed. They should have a pull down resistor to Ground when not pressed which I used a 4.7k resistor for.

    Arduino | LCD

    • GND | VSS
    • Vcc | VDD
    • Pot | V0
    • D13 | RS
    • GND | RW
    • D11 | E
    • D5 | D4
    • D4 | D5
    • D7 | D6
    • D6 | D7
    • Vcc | A
    • GND | K

    Arduino | HC-SR04

    • Vcc | Vcc
    • D8 | Echo
    • D9 | Trig
    • GND | GND

    Step 4: Code

    The code for this is slightly different than most other Arduino projects because there is no code in the Loop. Instead, it operates off of Interrupts meaning code executes only after user input; in this case, pressing one of the buttons. The Arduino Pro Mini can only accept interrupts on digital pins 2 and 3. An Interrupt is set up so that when pins or 2 or 3 detect a rise in voltage (voltage goes to HIGH), the functions attached to the Interrupt will execute.

    One button is set to measure and the other switches between SI and metric units. SI units are reported as feet and inches and metric units are in cm. The code defaults to standard velocities for the speed of sound but there is also a scaling factor (called fudgeFactor) which can be adjusted if you find that the values are systematically biased high or low. The speed of sound can be influenced by many factors including temperature, elevation, and humidity so experiment a little to see if you need to adjust the fudgeFactor variable to get good results.

    The ultrasonic sensor is very simple and works by putting the transmit pin HIGH for some length of time (I use 10 milliseconds), then pulling it low and using pulseIn on the receive pin. Pulse in measures the time in microseconds between the function being called and it being triggered to level set in the function, in our case HIGH. After that we can use that time (divided by 2 to account for the round trip) to calculate the distance.

    If you've never programmed an Arduino Pro Mini before you can look at Step 4 in my Motion Detector With LED for Beginners Instructable for detailed instructions. This code ought to work without modification for an Arudino Uno as well.

    I have embedded the .ino file here and you can find the code on my GitHub page Here.

    Step 5: Measure Away!

    Congratulations! You've finished making your very own digital tape measure! I've found that my own digital tape measure is accurate to around 0.1 inches though it only seems to measure out to around 13 feet before giving garbage results. It also does best with larger, flat surfaces so I wouldn't throw away your regular tape measure just yet. I hope you found this helpful and fun and let me know in the comments if you have any questions!



      • Tape Contest

        Tape Contest
      • Trash to Treasure

        Trash to Treasure
      • Arduino Contest 2019

        Arduino Contest 2019

      12 Discussions


      2 years ago

      Nicely done. I'm looking for a device that will measure calipers from about 1.25 cm to 12 cm. Would this accomplish that? Thanks.

      2 replies

      Reply 2 years ago

      I'm not sure what you mean by measure calipers. The only limitation this has is that it needs to have a large enough surface to get an echo off of. How accurate do you need the measurement to be? A I think this has 2 or 3 significant figures of accuracy at best and I wouldn't set much stock in anything beyond the tenths place for either inches or cm.


      Reply 2 years ago

      I'm hoping to be able to measure the caliper of small tree trunks that are 1.25 to 12 cm. The accuracy would be acceptable, but since the surface would be cylindrical and potentially a bit rough it may not work??? Thanks for your response.


      3 years ago

      Good job. I was thinking to do the same project but every time I got busy.

      1 reply

      Reply 3 years ago

      I know how that goes. I had this project on the backburner for almost three months because things just kept coming up. Good luck getting some more free time in the future!


      Reply 3 years ago

      I've gotten good measurements out to just over 13 feet. At that distance though I occasionally have to hit the measure button a few times to get a good read. It seems to consistently work on the first hit up to about 12 feet.


      3 years ago

      This is cool. You should enter this into one of the Instructables Contest like the Tech Contest and the Robotics Contest.

      3 replies

      Reply 3 years ago

      Thanks! I'm glad you liked it. I've submitted it to the Tech contest now.


      Reply 3 years ago

      Awesome. When the approve the entry, you'll get my vote.


      Reply 3 years ago

      Thanks a lot. I just got the e-mail saying it's approved so it should be in the contest now.