Ultrasonic Tape Measure using Arduino

Arduino Ultrasonic Tape Measure

Have you ever wanted an ultrasonic tape measure, like this Stanley? (See picture). Well, I have but then I am a Lazy Old Geek. I don’t really need one but I thought I’d try to make one. And naturally, I thought of an Arduino.

August 2012 update: I just found out the software used in this Instructable does not work in the latest Arduino environment, 1.0. I think it is the LCDKeypad library but haven’t found an updated version or software fix. However, this does work with version 023. LOG

Step 1: Parts List

Arduino                                  $17.60 (Duemilanove 2009) ebay.com
HC-SR04 Ultrasonic           $  4.61 ebay.com
LCD Keypad (Arduino)       $  8.88 ebay.com

Now I realize this is about $30 where the Stanley is available for around $24 but these parts are not committed to one function like the Stanley is.

Arduino Ultrasonic Tape Measure

Parts selection:
I wanted an Arduino that was shield compatible. I already have two, a Freeduino and Seeduino so I decided to buy a third. Right now, one of the best deals I liked is for a standard Arduino Duemilanove 2009 on ebay.
By the way, mine came with an Atmega 328-PU instead of the ‘standard’ Atmega328P-PU. I discussed this in another Instructable:

The LCD keypad also has Arduino support plus five user pushbuttons and a 16×2 (16 characters x two rows) display.

Step 2: Mechanical Design

First: I checked the Arduino pins used by the LCD Keypad. They are A0, D4, D5, D6, D7 and D8.
I’d already tested the HC-SR04. I’d set it up to use D2 and D3 and it needs 5V and Ground. So there would be no pin conflicts.

Modification1: The HC-SR04 had male right angle header pins coming out of the bottom of the module. To save room, I wanted them to come straight out of the PCB.
One way: So what I did was unsoldered the four pin connector, removed it and replaced it with straight male pins. (See picture) I also put some electrical tape on the back of the PCB to hopefully prevent it from shorting out.
Better way: That was a hard way to do it. I think a better way would be to take some pliers and carefully straighten the pins. They would be too long but could be cut off.

Second: Tthe LCD keypad is a standard shield and fits right onto a shield-compatible Arduino. The problem is how to connect the HC-SR04 to the system. I didn’t want to solder it directly to the shield or the Arduino.
Well, the LCD keypad has a nice feature. It has the standard male header shield connectors but it also has some extra 0.1” solder pads outside of the shield connectors but connected to the shield pins. (See picture)
This is the schematic for the HC-SR04 wiring that I used. (See picture)
Modification2: On the bottom of the LCD Keypad, I soldered two male header pins for 5Vdc and GND, so that they pointed downward. (See picture) This was so the connectors and wires would be out of the way for viewing the LCD.
On the top side, I soldered three male header pins on D1, D2  and D3. I used three pins so that it was easier to distinguish the two connectors though I only connected wires to D2 and D3.

TIP: If I was thinking ahead, I would probably have soldered complete six and eight pin male header strips. These might be useful for future projects.
Since it is easy to flip connectors, I used some red nail polish to mark one side of each connector and header.

Step 3: Software design

The LCD keypad and HC-SR04 each have Arduino libraries that have to be added to your Arduino software. Attached
The HC-SR04 libraries had some functions that would print out measurements in inches but I wanted a little better resolution so I wrote my own.

Arduino Ultrasonic Tape Measure design


Read more: Ultrasonic Tape Measure using Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *