Introduction: DIY Digital Tape Measure

About: Enjoying the projects? Support this page on Patreon:

Hey Everyone

Today I hope to teach you all about ultrasonic sensors and hopefully by the end you'll have a nice little digital tape measure of your own to use as you please.


Step 1: Parts List

This is my second version of this project so if you can get it as small or just don't feel like dealing with the Arduino Pro mini feel free to change it in any way you want.

To start off we will need:

  1. Arduino pro mini (Get it h ere)
  2. 10K potentiometer (Get it here)
  3. A 16x2 LCD (Get it here)
  4. A Ultrasonic sensor (Get it here)
  5. A battery and battery connector (I originally used a 9v but it proved to much for the Pro mini so i switched to 4.5V)
  6. Wire
  7. A Switch (Get it here)

The Tools you'll need:

  1. Soldering Iron and solder
  2. Wire cutters/strippers
  3. breadboard (for testing)
  4. Something to make you case out of (I used flat cardboard)
  5. Glue gun and glue sticks
  6. Cutting Knife

Step 2: Plotting It

This is the most important part if you are focusing on getting A small and neat package, If you just want it to work you can skip this step

To start you're going to want to find a configuration were your components are closest together for me that was the LCD on top of everything which ended very well because the LCD pin lined up with the Arduino pins thus lowering the amount of wire I need.

You can see how I plotted mine in the gif above, just beware I didn't end up using the 9v battery, my final battery pack ended up being three AAA batterys on the outer back of my device which made it easier for battery changes.

Step 3: The Wiring

If you're using the Arduino pro mini or a Arduino were you need to solder to pins, this will probably be the worst part. It will be worth it, I hope :D.

The pin configuration will be the same with all Arduinos so don't worry about changing the pin layout or code.

When I refer to LCD pins look at picture from right to left

  • LCD pin 1 to GRD
  • LCD pin 2 to Vcc (power)
  • LCD pin 3 to the middle pin on the potentiometer
  • LCD pin 4 to Arduino pin 12
  • LCD pin 5 to GRD
  • LCD pin 6 to Arduino pin 11
  • LCD pin 7 to Nothing
  • LCD pin 8 to Nothing
  • LCD pin 9 to Nothing
  • LCD pin 10 to Nothing
  • LCD pin 11 to Arduino pin 5
  • LCD pin 12 To Arduino pin 4
  • LCD pin 13 To Arduino pin 3
  • LCD pin 14 To Arduino pin 2
  • LCD pin 15 to Vcc (power)
  • LCD pin 16 to GRD

    potentiometer Right pin to GRN

  • potentiometer Middle pin to LCD pin 3

  • potentiometer left pin to Vcc

  • Ultrasonic Right pin (GRD) to GRD

  • Ultrasonic Right middle Pin (Echo) to Arduino pin 3

  • Ultrasonic Left middle pin (Trig) To Arduino pin 8

  • ultrasonic Left pin (Vcc) to Arduino pin 7

    Step 4: The Code

    <br></p><p>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);</p><p>int pingPin = 7;
    int inPin = 8;
    long duration, inches, cm;
    int indec, cmdec;
    int inchconv = 147;
    int cmconv = 59;
    String s1, s2;</p><p>void setup() {
      lcd.begin(16, 2);
      pinMode(pingPin, OUTPUT);
      pinMode(inPin, INPUT);
    }</p><p>void loop()
      digitalWrite(pingPin, LOW);
      digitalWrite(pingPin, HIGH);
      digitalWrite(pingPin, LOW);</p><p>  duration = pulseIn(inPin, HIGH);</p><p>  inches = microsecondsToInches(duration);
      indec = (duration - inches * inchconv) * 10 / inchconv;
      cm = microsecondsToCentimeters(duration);
      cmdec = (duration - cm * cmconv) * 10 / cmconv;
      s1 = String(inches) + "." + String(indec) + "in" + "     ";
      s2 = String(cm) + "." + String(cmdec) + "cm" + "     ";
      lcd.setCursor(0, 0);
      lcd.print(s2);</p><p>  delay(900);
    }</p><p>long microsecondsToInches(long microseconds)
      return microseconds / inchconv;
    }</p><p>long microsecondsToCentimeters(long microseconds)
      return microseconds / cmconv;

    Step 5: Uploading the Code

    Now for the most part this step is useless if you're using an Arduino with serial communication (Arduino uno, Nano) However if you're using a Arduino Pro Mini like me you'll soon find that there is no USB port to plug it in! To solve this problem you will need a serial programmer or an Arduino Uno (im using the uno to program my mini)

    Connect arduino uno board 5V pin to pro mini’s VCC pin.

    Connect arduino uno board GND pin to pro mini’s GND pin.

    Connect arduino uno board TX pin to pro mini’s TX0 pin.

    Connect arduino uno board RX pin to pro mini’s RXI pin

    Connect arduino uno board RESET pin to pro mini’s RST pin.

    Then in the Arduino IDE select Arduino pro mini as the uplaod board. Once all this is done you should be ready to upload.

    Step 6: The Casing

    Finally you can choose a material to make your case out of. Preferably A hard ridged cut-able material that can be glued. (Thin wood, Cardboard, Card stock, sheet metal just don't forget to insulate it) Now unfortunately i cant really help you with this step as everyone's final wiring and size will be different all i can say is make sure you measure and glue as accurate as possible and most important of all make it yours. :)

    Thanks for reading and as always please feel free to message me at anytime for assistance.