DIY Digital Tape Measure

22,110

179

19

Introduction: DIY Digital Tape Measure

About: Enjoying the projects? Support this page on Patreon: https://goo.gl/QQZX6w

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.

Enjoy

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

    <p>#include 
    <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);
      delayMicroseconds(2);
      digitalWrite(pingPin, HIGH);
      delayMicroseconds(10);
      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(s1);
      lcd.setCursor(0,1);
      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;
    }</p>

    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.

    DR

    1 Person Made This Project!

    Recommendations

    • Toys & Games Contest

      Toys & Games Contest
    • Big vs Small Challenge

      Big vs Small Challenge
    • Fix It Challenge

      Fix It Challenge

    19 Comments

    0
    tcodd86
    tcodd86

    5 years ago on Introduction

    This is a great idea. I think I'll try to make this tonight!

    0
    paulchabot
    paulchabot

    3 months ago

    Really cool, but you can wrap a measuring tape around a circular object. I am looking for something I can pull out that would change a resistance, like a potentiometer. Like a measuring tape, but with digital readout. Any ideas? Looking through Digikey for something that would work, but not exactly sure what I am looking for lol.

    1
    patrickotiato234
    patrickotiato234

    4 months ago

    Can someone help me with the flowchart to that algorithmn

    0
    JoelJ31
    JoelJ31

    4 years ago

    Can somebody please answer my question? -
    Is it okay if i don't you the potentiometer

    0
    miraheng
    miraheng

    4 years ago

    what is tape measure?measuring the physical tape wire or distance?

    0
    jbouchetd
    jbouchetd

    4 years ago

    Hello,
    When I copied the code, I get this error (screenshot below)

    when I type the code and I checked the code, it appears in an error message screen:

    stray'#'in program
    exit status1
    stray'#'in program

    could you help me?
    thank you very much

    0
    jbouchetd
    jbouchetd

    4 years ago

    Hello,
    When I copied the code, I get this error (screenshot below)


    could you help me?
    thank you very much

    0
    electronics for everyone
    electronics for everyone

    Reply 4 years ago

    Hey i would love to help but i dont see the screen shot, try reposting it.

    0
    RonKnock
    RonKnock

    5 years ago

    This is so good!

    0
    mozzey16
    mozzey16

    5 years ago

    Can I just in use the arduino uno instead of pro mini?

    0
    fabitencourt
    fabitencourt

    5 years ago on Introduction

    Good work, I would like to make one of these, but first of all, some comments:

    The code as presented here doesn't compile for me. I had to get rid of the

    «</p><p>» thing and I added to #include «<LiquidCrystal.h>». Now it is compiling

    with Arduino 1.6.5. I will tell you how is it going. Thanks.

    0
    macnilrad
    macnilrad

    5 years ago

    is it possible to expand the range of the measurement author? by the way great instructables

    0
    grayl
    grayl

    5 years ago on Introduction

    What range and accuracy are you getting with your system?

    0
    GianlucaG1
    GianlucaG1

    5 years ago on Introduction

    It's very interesting, but you could write simply cm=us/58 or similar for inches :-)

    0
    Just4Fun Media
    Just4Fun Media

    5 years ago

    Awesome idea! And by second decimal place accuracy, what unit do you mean? cm?

    Have a great day! :-)