Introduction: Digital Measuring Tape
I always was thinking of a measuring tape that never ends and be able to measure very long things. So I decided to make a small odometer and use it as a digital measuring tape.
I used a PIC16F819 microcontroller and a sensor from an old computer mouse (the remaining parts of one of my other projects Crazy Mouse) to make this simple measuring tape.
Do you want to make yourself? If yes read the rest of this instructable.
Step 1: What You Need
- Printed circuits (find files in the next step)
- Copper board
- Sandpaper
- Iron
- Circuit board acid
- 1mm drill
- Soldering tools
- 1x PIC16F819 microcontroller + socket
- An old mouse (or one of its IR shaft encoders)
- 3x BC547 transistors
- 3x common anode 7 segments
- 1x 100uF electrolyte capacitor
- 1x 470ohm resistor (1/8 watt)
- 7x 10k resistors (1/8 watt)
- 2x Simple push buttons
- 1x Simple switch
- 2x AA batteries with a battery holder
- 1x Wheel (+ maybe some gears)
- A box for this measuring tape
Step 2: Making the PCB
- Print the circuit on a glossy paper with a laser printer without scaling.
- Cut some copper board and clear it with sandpaper.
- Put the printed circuit on it.
- Press the hot iron on the board.
- Remove the papers.
- Soak boards in acid and wait till visible copper disappears.
- Wash the boards.
- Drill the holes.
- Clear the board with sandpaper.
Step 3: Soldering Components
- Solder the mouse IR transmitter and receiver on the board.
- Solder 470ohm resistor behind the IR transmitter.
- Solder 10k resistors on the board.
- Solder some wires on the lines that connect two holes together. (jumpers)
- Solder microcontroller socket on the board in a correct direction.
- Solder seven segments.
- Solder transistors.
- Solder buttons with some wire.
- Solder the capacitor on the board in a correct direction.
- At last solder the switch to the battery holder and solder its wires to the BAT terminal.
Step 4: Programming
Don't forget to:
- Set oscillator to internal RC
- Set RA6 port to I/O port
- Turn off all timers
- Set MCLR to input pin
- Turn off the brown out detect
Attachments
Step 5: Attach the Wheel
Solder two legs on the board to hold the shaft encoder wheel, turn on the measuring tape and adjust the position of the toothed wheel. Rotating the wheel must cause increase in displaying number and rotating it back must cause decrease in displaying number.
Finally attach a wheel to the toothed wheel shaft directly or using some gears, and put all in a box.
Step 6: How It Works?
The IR receiver component contains two IR receivers that the sequence of their state change indicates the direction of rotation (00 10 11 01 00 ... and 00 01 11 10 00 ...).
One of the IR receivers is connected to A4 pin and the other is connected to B0 pin. Every time the state of B0 pin changes from 0 to 1 the microcontroller increases or decreases the "Ticks" variable depend on the state of A4 pin, high A4 indicates forward rotation and low A4 indicates backward rotation:
void interrupt(void)
{
if (INTCON.INTF)
{
if (Sensor1)
{
if (RButton)
{
if (OneMeterTicks == MaxOneMeterTicks) OneMeterTicks = 0;
OneMeterTicks++;
}
else
Ticks++;
}
else
{
if (RButton)
{
OneMeterTicks--;
if (OneMeterTicks == 0) OneMeterTicks = MaxOneMeterTicks;
}
else
Ticks--;
}
if (abs(Ticks) >= OneMeterTicks * 10) Ticks = 0;
INTCON.INTF = 0;
}
}
The number of ticks made by the change of B0 pin state determines the distance traveled after scaling by factor "OneMeterTicks". The value of "OneMeterTicks" can be changed by rotating the wheel while holding down the "RESET" button.
if (Ticks < 0)
n = -Ticks;
else
n = Ticks;
n *= 100;
if (UButton == 1)
n /= (unsigned long int)(OneMeterTicks * 2.54); // inch
else
n /= (unsigned long int)OneMeterTicks; // cm
Digit[2] = n / 100;
n = n % 100;
Digit[1] = n / 10;
Digit[0] = n % 10;
I used "mikroC PRO for PIC" to write the program.
Step 7: Calibration
- Turn on the device.
- Move it gently through a line that you know its length.
- Hold the "RESET" button down and rotate the wheel to see correct number on the display.
- Release the "RESET" button.
- The device is now calibrated.
Step 8: How to Use
- Turn on the device.
- Move it on a line gently to measure the distance traveled.
- Press the "RESET" button to set display number to zero.
- Hold down "INCH" button to see the display number in inches.

Participated in the
Microcontroller Contest
68 Comments
9 years ago on Step 4
CAN I USE ATMEGA OR ARDUINO UNO?
Reply 9 years ago on Step 4
Yes, but you must design new circuit and write new program.
Reply 5 years ago
do you have the circuit and the program for using arduino uno
Reply 5 years ago
No, I don't.
6 years ago
Can i get the output in 2 decimal points like vernier caliper? Thanks
Reply 6 years ago
Yes, you can do it by changing the code. But this is not accurate enough to display distance with 2 decimal points.
6 years ago
good idea thankes
8 years ago on Introduction
can i replace pic16F819 with pic16F627? and can you sent me your schematic project to febriansahsetiawan@gmail.com thanks
Reply 8 years ago on Introduction
Yes, but you must make little changes to circuit diagram and program. Try to DIY!
9 years ago on Introduction
Hello dear Vahid. Thank you for sharing this. I really liked your project and i'm going to make it. But I need to measure small distances with millimetric precision. I wonder if it's possible to change the code so that it can measure from 1 to 999 millimeters?
Regards
Reply 9 years ago
Yes, You must change the software and gears ratio.
9 years ago on Introduction
what software you used to sketch the circuit?
Reply 9 years ago on Introduction
proteus
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?
9 years ago on Introduction
what software you used to sketch the circuit?