Digital Measuring Tape by vahid_you2004
Featured
IMG_5832.JPG
IMG_5831.JPG
IMG_5822.JPG
IMG_5829.JPG
IMG_5828.JPG
IMG_5825.JPG
IMG_5835.JPG
IMG_5836.JPG
IMG_5838.JPG
IMG_5837.JPG
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.
 
Remove these adsRemove these ads by Signing Up

Step 1: What you need

IMG_5501.JPG
IMG_5515.JPG
IMG_5494.JPG
IMG_5495.JPG
IMG_5523.JPG
IMG_5513.JPG
IMG_5511.JPG
IMG_5521.JPG
IMG_5517.JPG
To make this measuring tape you need the following components and tools:
  • 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
1-40 of 49Next »
afroze9 says: Jan 10, 2013. 2:58 AM
I'm trying to make this project but am running into a problem. How can i check if the IR receiver and transmitter are working or not? What are the voltages on their pins supposed to be if i apply a voltage of 3 volts after putting them on a breadboard?
vahid_you2004 (author) says: Jan 11, 2013. 3:43 AM
If you found this components in a mouse you can take a look at mouse board to find resistors you need to use (most of mouses are 5V). In my circuit I used a 470 ohm resistor for transmitter, no resistors for receivers and 4.5V battery pack. You can see IR transmitter light using a digital camera or mobile phone camera. You can test receivers by connecting it to an ohmmeter and any IR remote control like TV remote control. If you have the components ID search for their datasheet on the Internet.
zulwaqaromar says: Dec 12, 2012. 3:47 PM
can u explain it to me, thanks a lot mr.

LRButton = 0;
if (EEPROM_Read(0) == CorrectROMValue)
{
unsigned short int k;
OneMeterTicks = EEPROM_Read(1);
k = EEPROM_Read(2);
OneMeterTicks = (OneMeterTicks << 8) + k;
}
LOneMeterTicks = OneMeterTicks;
while (1)
{
if ((!RButton) && LRButton)
{
Ticks = 0;
if (OneMeterTicks != LOneMeterTicks)
{
EEPROM_Write(0, CorrectROMValue);
EEPROM_Write(1, (unsigned short)(OneMeterTicks >> 8));
EEPROM_Write(2, (unsigned short)OneMeterTicks);
LOneMeterTicks = OneMeterTicks;
}
}
LRButton = RButton;
vahid_you2004 (author) says: Dec 14, 2012. 4:06 AM
LRButton = 0; (*Initial assigment of LRButton variable*)
if (EEPROM_Read(0) == CorrectROMValue) (*if the user did not calibrated yet the value stored in posiition 0 of EEPROM is zero so if only already calibared read calibration value from EEPROM, CorrectROMValue is an arbitrary constant value*)
{
unsigned short int k;
OneMeterTicks = EEPROM_Read(1); (*read first byte of calibrated value fromm EEPROM*)
k = EEPROM_Read(2); (*read 2nd byte of calibrated value fromm EEPROM*)
OneMeterTicks = (OneMeterTicks << 8) + k; (*join 2 bytes together*)
}
LOneMeterTicks = OneMeterTicks; (*store OneMeterTicks value to LOneMeterTicks*)
while (1) (* the endless loop to run the reset of the program*)
{
if ((!RButton) && LRButton) (*if RButton is Up (=0) but in last state was down (LRButton=1)*)
{
Ticks = 0; (*zero the display value*)
if (OneMeterTicks != LOneMeterTicks) (*if OneMeterTicks not equals last saved OneMeterTicks means that the user changed calibration value so it must be saved to EEPROM*)
{
EEPROM_Write(0, CorrectROMValue); (*write the value that indicates already calibrated to EEPROM*)
EEPROM_Write(1, (unsigned short)(OneMeterTicks >> 8)); (*write 1st byte of calibration value to EEPROM*)
EEPROM_Write(2, (unsigned short)OneMeterTicks); (*write 2nd byte of calibration value to EEPROM*)
LOneMeterTicks = OneMeterTicks; (*store new value of OneMeterTicks value to LOneMeterTicks*)
}
}
LRButton = RButton; (*store the sate of RButton in LRButton*)
zulwaqaromar says: Dec 11, 2012. 1:30 PM
if (abs(Ticks) >= OneMeterTicks * 10) Ticks = 0;
INTCON.INTF = 0;

what is means with this coding
vahid_you2004 (author) says: Dec 12, 2012. 5:07 AM
This is the maximum distance limit, if the distance is 10 meters it could not be displayed on 3 digit seven segment display so reset the number to zero again. And also if you do not do this the "Ticks" variable may be overflow, or you must use variable type with more capacity.
zulwaqaromar says: Dec 11, 2012. 7:23 AM
can i use 1 transmitter n 1 receiver only?
vahid_you2004 (author) says: Dec 12, 2012. 5:04 AM
No, you must use 2 receivers in order to detect direction of movement. All IR encoders like that I used have a component that contains at least 2 receivers in a block.
zulwaqaromar says: Dec 9, 2012. 10:54 PM
if i need use LCD which part of programming i need to change
vahid_you2004 (author) says: Dec 11, 2012. 3:35 AM
Change:

Cycle++;
if (Cycle == DigitChangeCycle)
{
SS1 = 0;
SS2 = 0;
SS3 = 0;
if (Ticks < 0)
n = -Ticks;
else
n = Ticks;
n *= 100;
if (UButton == 1)
n /= (unsigned long int)(OneMeterTicks * 2.54);
else
n /= (unsigned long int)OneMeterTicks;
Digit[2] = n / 100;
n = n % 100;
Digit[1] = n / 10;
Digit[0] = n % 10;
dig = Digit[DigitIndex];
SSA = ((dig == 1) || (dig == 4));
SSB = ((dig == 5) || (dig == 6));
SSC = (dig == 2);
SSD = ((dig == 1) || (dig == 4) || (dig == 7));
SSE = ((dig != 0) && (dig != 2) && (dig != 6) && (dig != 8));
SSF = ((dig == 1) || (dig == 2) || (dig == 3));
SSG = ((dig == 0) || (dig == 1) || (dig == 7));
if (DigitIndex == 0) SS1 = 1;
if (DigitIndex == 1) SS2 = 1;
if (DigitIndex == 2) SS3 = 1;
Cycle = 0;
DigitIndex++;
if (DigitIndex == 3) DigitIndex = 0;
if ((DigitIndex == 2) && (Digit[2] == 0)) DigitIndex = 0;
if ((DigitIndex == 1) && (Digit[2] == 0) && (Digit[1] == 0)) DigitIndex = 0;
}

To:

if (Ticks < 0)
n = -Ticks;
else
n = Ticks;
n *= 100;
if (UButton == 1)
n /= (unsigned long int)(OneMeterTicks * 2.54);
else
n /= (unsigned long int)OneMeterTicks;
Your code to display n on the LCD
zulwaqaromar says: Dec 10, 2012. 12:23 AM
i dont understand with Void intterupt part..
vahid_you2004 (author) says: Dec 11, 2012. 3:30 AM
At the beginning of the program I configured PIC to go to interrupt routine every time the state of B0 pin (that is connected to oner of receivers) changes from 0 to 1.
"if (INTCON.INTF)" ensures that B0 pin changed.
"if (Sensor1)" means that if the other receiver that is connected to A4 pin is 1.
"if (RButton)" means that is user held down the Reset button in order to calibrate.
When the B0 pin changes from 0 to 1, if the A0 pin is 1 it means that wheel if rotating forward, and if the A0 pin is 0 it means that wheel if rotating backward. So if the user wants to calibrate the program changes the Ticks/Meter constant that is stored in the ROM of PIC, and if the user want to measure (not holding down Reset button) program counts the number of ticks made by rotating toothed wheel and convert it to meter using the conversion ratio.
zulwaqaromar says: Dec 9, 2012. 10:50 PM
is it true, i just need 1 set of optical sensor (1 transmitter and 1 receiver)...or i need 2 set..
vahid_you2004 (author) says: Dec 11, 2012. 3:18 AM
you need 1 transmitter and 2 receivers, the receiver part in old mouses is a single component that contains 2 receivers inside.
zulwaqaromar says: Dec 6, 2012. 10:58 PM
hello, i dont understand for "if(Rbutton)?...can u explain it to me..
vahid_you2004 (author) says: Dec 7, 2012. 8:59 AM
If you download and see the rest of code, you'll see that RButton is defined as A2 pin that is connected to Reset (Calibrate) button, so this line means that "if that button is closed".
kALuN_pUD says: Nov 13, 2012. 5:21 AM
hi, I want just to ask if the program is running? or there's some changes ?
noykolz says: Sep 19, 2012. 7:46 AM
Hello. are the IR receiver and the IR transmitter both found in the IR shaft encoder from mouse?
if not, what is that IR shaft encoder a trasmitter or a receiver? Thanks in advance for the answer.
vahid_you2004 (author) says: Sep 20, 2012. 4:35 AM
Hi, Yes, You can find all these 3 components in a old mouse, shaft encoder is the toothed wheel, and transmitter and receiver are the components that toothed wheel is among them.
vjeamrhasty says: Aug 2, 2012. 11:05 PM
nice project!
i just want to ask if we can use meter, ft, inches, cm, etc. units at the same time?
vahid_you2004 (author) says: Aug 4, 2012. 4:51 AM
Thanks, Yes, All you have to do is to add conversion factors between units to the program and use a display with more capacity like LCD.
vjeamrhasty says: Aug 4, 2012. 5:14 AM
can i replace PIC16F819 with PIC16F84A ?
vahid_you2004 (author) says: Aug 5, 2012. 7:18 AM
Yes, But a few changes must be made in the source code.
pmounica says: Oct 7, 2011. 3:05 PM
how long does it took to finish
can ii do it in less than a 3 weeks
vahid_you2004 (author) says: Oct 9, 2011. 4:23 AM
If you have all things needed, you can do it in a day.
farzadbayan says: Apr 23, 2011. 5:28 AM
Kheyli jaleb bod vahid jan !
vahid_you2004 (author) says: Apr 24, 2011. 4:41 AM
thanks
agis68 says: Feb 5, 2011. 1:28 AM
cool project but you should do professional job in appearance. It seems like done with caveman tools...lol
vahid_you2004 (author) says: Feb 5, 2011. 6:11 AM
Yes, I do it with caveman tools!!!!!!!!
agis68 says: Feb 6, 2011. 11:45 PM
I thought so!....(no offence)
mdog93 says: Jan 31, 2011. 10:55 AM
you might want to calibrate it on as long a distance as possible, thiss will decrease the percentage error
vahid_you2004 (author) says: Feb 1, 2011. 4:06 AM
Yes, you're right. The longest distance, the more accuracy.
mdog93 says: Jan 31, 2011. 10:52 AM
any chance of a quick viedo of this in action?
vahid_you2004 (author) says: Feb 1, 2011. 4:05 AM
I think it doesn't need any video, rotation of the wheel causes the change in the display number.
MagicLanternProductions says: Jan 30, 2011. 6:44 AM
Hi nice design. I, need to measure 1,000' + do I, need to use 2, " 1x PIC16F819 microcontroller + socket ? " To add the extra digit, or can I, get by with one
processor unit. What would I, need to make these changes to increase the measuring capacity of your tape measure ?
vahid_you2004 (author) says: Feb 1, 2011. 4:03 AM
Connect the sensor that is connected to A4 to MCLR, now there are 2 free pins on the PIC (A3 & A4) so you can easily add 2 more digits to it, but you must make some changes in the source code.
rocketman221 says: Jan 27, 2011. 2:58 PM
Cool project.
How accurate is it?
vahid_you2004 (author) says: Jan 28, 2011. 3:40 AM
I made this for long distances, It's accuracy is 1 cm or 1 inch.
-=Dr.Who=- says: Jan 30, 2011. 7:02 AM
Cool project. I love how you used the ink carts as the shell. Bonus for the recycle!
OK, dumb question incoming (sorry, I have to ask it) but, 1 cm or 1 inch...? That's a big discrepancy. If you were talking about 1cm per 1/2 kilometer or 1 inch per 300 yards or something along that line, then it's not that big a deal. But, if it's less than that then I question the accuracy.
Can you be a little more specific about it's accuracy, please?

Thanks!
vahid_you2004 (author) says: Jan 31, 2011. 4:06 AM
Its accuracy depends on the calibration, according to the 7th step you can calibrate it with 50cm line or with a 9m line, of cource calibrating with a 9m line makes the device more accurate. Actually the shortest distance that you can measure with this device is 1cm, when the software converts the result to inches it rounds the number so if you use inch unit the shortest distance is 1".
1-40 of 49Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!