Introduction: Digital Measuring Wheel
In this Instructable I'll show you how to make my digital measuring wheel (DMW). The DMW is like a traditional measuring tape, but instead using a tape, it uses a wheel that records the distance traveled as it rotates. The wheel runs around the outer body of the DMW, so to measure something you simply press and roll the DMW across your object.
This is great because it lets you measure in ways that would be tricky or impossible with a normal measuring tape. You can easily measure along curves, around corners, etc. Likewise, since you don't have to deal with a physical tape, you aren't really limited by length. The upper limit on the DMW is 9999.99cm (your average tape measure will do 25ft, or 762cm), which is only due to the screen size limits. At the same time, its minimum measurement is just about 1mm (0.04in), making it more than accurate enough to be useful. You can also instantly convert from cm to inches, displayed as both in decimal form, and rounded to the nearest 1/16" of an inch (configurable in the code).
I've also included a pipe diameter calculation mode, an inside corners mode (not in video above, see modes in Step 14), and a tachometer/speed mode (for low RPMs).
The modes can be re-ordered or removed easily in the code.
The brains of the DMW is an common Arduino Pro-Mini, which monitors the buttons, rotary sensor, and battery, while recording and displaying measurements on the DMW's OLED screen. All the electronics are mounted on a single custom designed PCB, which is in-turn mounted in a 3D printed case. Overall, the DMW is almost the same size as a regular measuring tape, keeping it portable and easy to handle.
I've tried to keep the PCB fairly easy to assemble even if you're newish to soldering. It's mostly through-hole parts, with the exception of a few 0805 SMD sized resistors (should still be easy to solder). Likewise, I tried to use mainly common, off-the-shelf components that you should be able to easily find on Amazon, Aliexpress, Ebay, etc.
The DMW is powered by a rechargeable LiPo battery. I should note that LiPo's can be dangerous if handled improperly. The main thing is not to short-out the LiPo, but you should do some safety research if you are completely unfamiliar with them.
You can find all of the DMW's 3D print, PCB, and code files at my Github: here.
I'm really happy with how this project turned out! I hope that you find it equally useful! :)
If you have any questions, please leave a comment and I'll try to help out!
You can find Gerber files for the DMW's PCBs here (hit download in the bottom right).
You will need one of each PCB.
If you'd like to inspect the PCB's schematic, you can find it here.
Unless you can make PCB's locally, you'll have to order some from a prototype PCB manufacturer. If you've never purchased a custom PCB before, it's very straight forward; most companies have an automated quoting system that accepts zipped Gerber files. I can recommend JLC PCB, Seeedstudio, AllPCB, or OSH Park, although I'm sure most others will work as well. All the default board specs from these manufactures will work fine, but make sure to set the board thickness to 1.6mm (should be the default). Board color is your preference.
(note that you can probably find these parts for cheaper on sites like Aliexpress, Ebay, etc)
- One Arduino Pro-mini, 5V Ver. Please note that there a few different board designs out there. The only difference between them is the placement of analog pins A4-7. I have made the DMW's PCB such that both boards should work. Found here.
- One 0.96" SSD1306 OLED (I2C). Display color doesn't matter (although the blue/yellow version works best). Can be found in two different pin configurations, where the GND/VCC pins are reversed. Either will work for the DMW. Found here.
- One TP4056 1s LiPo charger board. Found here.
- One 1s LiPo battery. Any kind is fine as long as it fits in a 45x35x10mm volume. Capacity and current output are not hugely important as the DMW's power consumption is low. You can find the one I used here.
- One 7mm tall mouse encoder. Found here or here. (You may want to buy couple of spares)
- One 19x6x13mm slide switch. Found here.
- Two 1K 0805 SMD resistors. Found here.
- Two 100K 0805 SMD resistors. Found here.
- Two 47K 0805 SMD resistors. Found here.
- Two 1uf 0805 SMD multi-layer ceramic capacitors. Found here.
- Two 6x6x13mm through-hole tactile push-buttons. Found here.
- One 14x12mm Micro-USB breakout. Found here.
- Right angle 2.54mm male headers. IMPORTANT! There are two different types of right angle headers available. The only difference is the location of black support/connection block. You need to get the type with blocks on the longer pin side. Found here.
- A FTDI programming cable. Found here, although other types are available on Amazon for less. You can also use an Arduino Uno as the programmer (if it has a removable ATMEGA328P chip), see a guide for that here.
- One 25x1.5mm clear acrylic square. Found here.
- ~2" of 1/16" (1.57mm) Dia metal rod. Found here.
- Four 8mm M2 screws.
- Two 5+mm M2 screws (optional, for belt clip).
- Approx 162 3mm ball bearings. Plastic, steel, w/e is fine. You can even use small 3mm beads for this like these: here.
- 3/4" wide friction tape (like for wrapping tennis racquets/hockey sticks) Found here. Or flexible 3D print filament.
- 3D printer (either FDM or resin should be fine).
- Hot glue gun and sticks.
- Plastic glue and superglue.
- Some light oil/lube, any type will probably do.
- Soldering iron w/ fine tip.
- Wire strippers and cutters.
- Tweezers (for handling SMD parts)
Step 1: Construction and Design Overview
To give you a quick overview of the DMW's assembly, I've attached an exploded CAD drawing to this step. This lists all the mechanical components of the DMW (3D printed or otherwise) and will hopefully give you a rough idea of how the DMW goes together. Please note that throughout this Instructable, I will refer to all the parts by their name shown on the assembly drawing.
All the parts on the drawing are 3D Printed unless otherwise noted.
For the wheel grip you can either print it using flexible filament or use grip tape (linked in Supplies). I used grip tape so I can't comment on the effectiveness of flexible filament. Whatever you use it should be grippy enough to prevent the outer wheel from slipping when using the DMW.
You can find all the printed parts here.
Finally, make sure you have the correct type of right-angle male 2.54mm headers. The two commonly available types have different stop block locations. You need the type with the blocks on the long legs, as shown in the image for this step. Using the wrong type will prevent the PCBs from fitting together.
Reading the rest of this step is optional. I'm just going to ramble a bit about how the DMW works and how I designed it.
Basic Working and Some Math:
The DMW's is assembled like a sandwich. It has a central rotating gear wheel that is held between two fixed outer plates. The wheel is supported on either side by a set of ball bearings, which allow it to spin freely. One of the inner edges of the wheel is toothed. The toothed edge meshes with the inner gear, which is connected to the PCB's encoder. The encoder records the rotation of the inner gear, and so, with a bit of math, we can work out the travel of the outer wheel:
Distance Traveled = number_encoder_steps_taken * (pi * WHEEL_DIAM) / (ENC_STEPS_PER_REV * GEAR_RATIO)
- WHEEL_DIAM is the diameter of the outer gear wheel
- ENC_STEPS_PER_REV is the number of steps per revolution of the encoder (part of the encoder's specs)
- GEAR_RATIO is the ratio between the number of teeth on the outer gear divided by the number on the inner wheel. This is the number of rotations the inner gear goes through for one rotation of the outer gear wheel.
- number_encoder_steps_taken is the current total number of steps recorded by the encoder.
Overall, the (pi * WHEEL_DIAM) gives us the distance traveled by one revolution of the outer wheel, while number_encoder_steps_taken / (ENC_STEPS_PER_REV * GEAR_RATIO) gives us the total number of revolutions of the outer wheel.
Similar equations can be used to work out rpm (over a given time period) or the diameter of a measured object (assuming it's circular). You can find these in the DMW's code.
I designed the DMW using Fusion 360 with the help of the FM Gears add-in. Overall, I wanted it to be close in size and shape to a traditional measuring tape so that it could serve as a comfortable stand-in. I already knew that I wanted to use a mouse encoder in the DMW because I had worked with them in a prior Instructable, and had a few spares lying around. These two factors informed my design.
I first considered how I'd mount the encoder. The easiest option would have been to directly mount a wheel to the encoder. This would be fine for a small wheel, but not great for a larger one because you lose measurement fidelity as the wheel gets larger. The encoder has a pre-set number of steps per revolution. So for a direct drive wheel, the distance covered per step is (pi * WHEEL_DIAM) / ENC_STEPS_PER_REV, which is also minimum measurement distance. I could have just gone with a smaller wheel, but I felt that it wouldn't fit my tape-measure-esque vision, and I knew from my Digital-Multi-Tool, that using a small wheel is somewhat fiddly. Perhaps in the future I will design a detailed measuring tool using a smaller wheel.
So, I knew that I needed to drive the encoder indirectly. Using gears seemed the most simple method so I spun up a few pinion gears in Fusion 360 to see what might work. In the end I decided upon mounting the encoder horizontally, connecting it to larger outer gear wheel, which I sized to about the same diameter as a common measuring tape. This gave plenty of internal space for the other electronics, but let me keep the thickness of the DMW to a minimum. I also figured that I could use the upper and lower outer face plates not only to keep the DMW together, but also as bearing surfaces for the outer wheel so it would run smoothly. To keep the thickness down I had to use small 3mm balls, which seemed to strike a good compromise in price, availability, and ease of work (handling a bunch of 1mm balls would suck!)
After test printing a few smaller pinion gears to check my printer's limitations, I set the inner gear size and moved onto the PCB.
I based the PCB on my Digital-Level, reusing most of the components and design elements (you can read about those in Step 1 of it's Instructable). I did have to mount a couple of parts somewhat unconventionally using right angle headers (see Steps 3 and 8 for more), but after a bit of back-and-forth between the CAD and the PCB to get everything to fit the DMW design was complete.
Step 2: Encoder Assembly 1
We'll begin by assembling the encoder shaft and gear.
If you haven't done so already you should print all the parts as indicated in the DMW assembly drawing in the previous step.
First cut a ~14mm long section of your 1/16" Dia. metal rod. Then insert and glue the rod into the small Inner Gear as pictured. The gear will have a small raised circle on one side. This should be facing towards to long side of the rod once inserted.
This next step is fiddly, so you might need to attempt it a few times. I recommend buying a couple of spare encoders just in-case.
Insert the rod through the encoder's central drum hole so that the gear butts up against the encoder. You need to glue the rod to the encoder's drum, but you must be very careful. The encoder's drum needs to be able to spin to count rotations so you must avoid gluing it to the encoder's metal housing. I recommend injecting a small amount of superglue into the encoder's hole and then inserting the rod. This should minimize any dangerous overflow.
Once everything is dry, you should be able to spin the gear freely, which should also turn the black drum on the top of the encoder. You will be able to see if it's working. You should check that bond between the encoder and the gear shaft is strong enough to withstand quick rotations.
About Encoders (optional):
Encoders are a common way of measuring rotary motion. They generally consist of a disk featuring some kind of marker, be it an indent, slit, magnet, etc. The disk is attached to a rotating shaft, and as it rotates, the disk's marker passes by some kind of sensor, registering the rotation.
The DMW's mouse encoder uses a series of indents to flex a pair of metal plates, which complete a circuit, producing a pulse of current. It's like a pair of buttons being pressed as the encoder turns. The encoder is used to track the rotation of the DMW's outer wheel and measure the distance traveled. It is the one and only sensor of the DMW.
Most encoders are quadrature encoders; which can distinguish between forwards and reverse rotation. They do this by offsetting the two sets of markers such that one is "off" while the other is "on". So whatever marker turns "on" first determines the direction of motion.
Due to the need to accurate counting, encoder's are generally wired to interrupt pins on micro-controllers. This lets you record their outputs in the background, no matter what the micro-controller is doing.
Step 3: Encoder Assembly 2
Take the encoder breakout PCB and solder two 47K resistors as pictured. These limit the current to the encoder.
Next solder the encoder + gear mechanism you assembled in the previous step to the PCB. The encoder should be on the same side as the 47K resistors.
This PCB will later be attached to the main DMW PCB. It is separate so that it can be mounted at a right angle, allowing the encoder's gear to mesh with the outer measuring wheel.
Step 4: PCB Assembly 1
Take the DMW's main PCB and solder 1K, 100K, and 1uf resistors/capacitors to the pads in the upper left corner as pictured. These form de-bounce circuits for the DMW's push buttons.
Next, flip the PCB over and grab your SSD1306 OLED display. To my knowledge, there are two different versions of the common SSD1306 OLED board. Both function the same, except, annoyingly, their GND and VCC pins are swapped. To accommodate both types, the DMW's PCB has a set of jumper pads to switch the pin order. As pictured, line up the DMW's through-holes with the pins on your SSD1306 and solder the jumper pads to match. Make sure not to bridge all three pads or you'll probably fry your OLED!
Step 5: PCB Assembly 2
Now we'll attach the encoder PCB to the main DMW PCB. To do this, begin by inserting the encoder PCB through the encoder labeled slot on the DMW PCB. The encoder's rod should stick through the corresponding hole in the DMW PCB, as pictured. The geared side of the encoder should be on the bottom side of the DMW PCB.
Next take a length of four right angle 2.54mm male headers and slide the long side pins into the through-holes on the encoder PCB. The short header pins should be facing into the DMW PCB. You'll need to angle the encoder PCB to the the pins in.
You should be able to push the short header pins into the corresponding through-holes on the DMW PCB as pictured, letting the encoder PCB rest at a right angle to the DMW PCB.
Keeping the encoder PCB at a right angle, solder the header in place to both boards.
After soldering, you should cut off any excess pin lengths. You can also trim down the encoder's rod.
Step 6: PCB Assembly 3
Next, solder 2.54mm male headers in place for the Arduino Pro-Mini and TP-4056 board.
Make sure you use the A4-7 pin orientation matching your Pro-Mini (mine has the as a row along the bottom of the board, but some have them placed as pairs along one edge)
You'll need to use single header for the TP-4056 board. Do not solder headers to the B+ and B- through-holes.
Then, as pictured, solder the Arduino Pro-Mini, its programming header, and the TP-4056 board in place.
The programming header pins should have the long legs facing upwards.
Finally, cut off any excess pin lengths, but do not trim the programming pins!
The Arduino Pro-Mini is the brains of the DMW; it monitors the encoder and buttons, while outputting data to the OLED display.
The TP-4056 is a commonly available LiPo battery charger board/ic. It connects the battery to the DMW PCB and protects it from damage while managing its charging.
Step 7: PCB Assembly 4
Next solder the OLED display in place as pictured. Double check that the GND and VCC pads you soldered previously match those on the display.
Solder the push buttons and slide switch in place as indicated on the PCB. You'll have to break the side tabs off the switch.
Cut off any excess pin lengths.
Finally, glue the 3D printed Switch Cap to the switch. Ignore the USB board in the step image, we will add that in the next step.
Step 8: PCB Assembly 5
Next we'll add the USB breakout board. It is used for charging the LiPo battery and is connected to the TP-4056's + and - pads via the DMW's PCB. It's basically a replacement for the TP-4056's own USB connector, which is inaccessible once the DMW is assembled.
The USB board is mounted similarly to the encoder's PCB from Step 5.
Begin by inserting the USB board through the USB slot on the DMW's PCB. The USB should be on the same side as the Arduino and OLED. As pictured, the USB should be facing towards the encoder's PCB. You should confirm that the USB board's GND and VCC through-holes line up with the IN- and IN+ through-holes on the DMW's PCB.
Like with the encoder PCB you should be able to slide a set or right angle headers into the through-holes on the DMW PCB. As pictured, the long legs of the headers should be inserted into the DMW PCB, while the short legs should be facing the USB PCB.
Push the short legs into the USB PCB's through-holes, then push the header and USB into the DMW PCB as far as possible.
While holding the USB PCB board at a right angle to the DMW PCB, solder the headers in place to both boards.
Finally, cut off any excess pin lengths.
Step 9: PCB Assembly 6
Flip the DMW's PCB over and hot glue the LiPo battery into place at the center of the PCB. You may need to add a strip of cardboard under the battery to protect it from the Arduino's pins. Make sure the leads from the battery are facing the TP-4056 end of the board.
Next, cut and strip the battery's positive and negative wires. To avoid shorting out the battery, I recommend striping and soldering only one wire at a time. As pictured, pass the wires through the holes in the PCB and solder them to the B+ and B- pads on the TP-4056. The battery's positive wire should be connected to B+, and the negative to B-. Before soldering, you should confirm each wire's polarity using a multi-meter.
At this point, the PCB is finished. We will now move on to assembling the outer shell and wheel.
Before moving forward you should skip to the code section and upload the code. If everything's assembled correctly the DMW should start working (toggle the slide switch to turn it on). Spinning the encoder's gear should change the measurement shown on the display.
Step 10: Final Assembly 1
With the electronics complete we'll move onto the final assembly of the DMW.
Before you begin you should print out all the parts as indicated on the assembly drawing in Step 2.
Begin the assembly by gluing a clear acrylic square to the Top Plate as pictured. You should avoid using superglue for this because it can fog up the acrylic. The main purpose of this square is to protect the OLED display, since they are fairly easy to crack.
Next we'll add some grip the the Outer Gear Ring. We want it to have a grippy surface so it rolls easily even on smooth surfaces. To do this you have two options: either print out a Wheel Grip using flexible filament and slide it over the Gear Ring, or wrap the Gear Ring in grip tape (linked in the supplies). I didn't have any flexible filament handy, so I used grip tape. The grip tape sticks best to itself so you'll want to wrap two to three layers. Leave it to dry for a bit.
Step 11: Final Assembly 2
Now we'll start putting all the parts together.
Take the Bottom Plate and insert 8mm M2 screws through each of the four support posts. Then lay the Bottom Plate flat and add 3mm ball bearings to its outer groove as pictured. Add a few drops of light oil as well.
Next, slide the Outer Gear Ring onto the plate. The grove on the gear ring should rest on the ball bearings allowing the ring to rotate smoothly. Make sure that the geared teeth are on the bottom side of the ring as pictured.
Now, add a second set of ball bearings into the grove on the top of the Outer Gear Ring. Add a few drops of light oil as before.
Step 12: Final Assembly 3
Now, take the DWM PCB and drop it into the assembly from the previous step. Make sure that the four holes in the corners of the PCB line up with the M2 screws in the assembly. The PCB should sit flat on the four support posts with the encoder gear meshing with the gear teeth of the Outer Gear Ring.
Step 13: Final Assembly 4
This is the final step of the assembly.
Begin by placing the Top Plate onto the PCB. The PCB's buttons and switch should fit into holes in the Top Plate, and the cutout under the acrylic square should align with the OLED display.
The outer grove in the Top Plate should cradle the ball bearings in the Outer Gear Ring so that the ring can spin freely.
This next step is a bit tricky. You need to gently lift up and hold the Top and Bottom Plates together without allowing any of the ball bearings to fall out. Once you're gripping the plates, screw the M2 screws in the Bottom Plate into the Top Plate, binding the two plates together. Adjust the tightness so that the outer wheel doesn't bind up.
If you have trouble, you can do the assembly in reverse, starting with the Top Plate and ending with the Bottom so that the screws holes are facing upwards. You'll have to place something under the Top Plate to support it, otherwise the buttons and switch on the PCB stick out, making it hard to keep everything level.
You may optionally add the Belt Clip to the back of the DMW using two 5+mm M2 screws.
At this point the DMW is almost finished, you just need to upload the code and calibrate the wheel.
Step 14: Code
You can find the code at my Github: here.
You will need to install the following libraries either manually or by using the Arduino IDE's library manager:
To upload the code, you'll need to connect an FTDI programming cable to the six pin header above the Arduino pro-mini. The FTDI cable should either have a black wire, or some kind of marker for orientation. When you insert the cable onto the header, the black wire should slide over the pin labeled "blk" on the DMW's PCB. This is the left most pin on the header. If you get it the right way round the power LED on the Arduino should light up, otherwise you'll have to reverse the cable.
You can alternatively upload the code using an Arduino Uno as described here.
When using either method, you should be able to upload the code as you would to any other Arduino. Be sure to select Arduino Pro-Mini 5V as the board under the tools menu when uploading.
If you cannot upload the code, you may have to set the board as an Arduino Uno using the tools menu.
If the display doesn't turn on, check its I2C address with whomever you bought it from. By default in the code it is 0x3C. You can change it by setting the DISPLAY_ADDR variable towards the top of the code. If this doesn't work, you'll have to remove the level's PCB from the case and confirm that the display's pins match those on the level's PCB. If they do, you probably have a broken display (they're fairly fragile and sadly can come broken in shipping) and you'll have to replace it.
The DMW has three modes. To cycle between modes double press the "Z" button. Unless other wise specified, single pressing the "Z" button zeros the current reading. Single pressing the "M" button switches units between cm and inches.
When using inches the closest 1/16 of an inch to the current measurement is displayed in the lower right hand corner. For example, for a reading of 1.35", the closest 1/16" is 6/16" so 6/16 would be displayed. Note that the fraction is not simplified. You can change the fraction of an inch used by changing INCH_FRACT in the code.
The battery charge percentage and mode name are displayed along the top yellow bar of the display.
The Micro USB is used to charge the battery. You should be able to see a blue/red led to indicate its charge level.
The DMW is turned on/off using the slide switch.
- Measuring Wheel: The default mode. Measures the linear distance traveled by the wheel, like a traditional ruler.
- Pipe Diameter Measuring: Calculates the diameter of a pipe based on the circumference. Roll the wheel once around any cylinder to get its diameter.
- Inside Corner Measuring: Like the measuring wheel except the wheel diameter is added to the measurement. This is useful for measuring inside corners where you have to start the measuring wheel offset from the edge wall. For example, measuring the inside dimensions of a box. Only works on pairs of right-angled corners!
- Tachometer: Measures RPM and linear speed. Only use this mode for lower RPMs, both for safety, and to avoid damaging the encoder. I'm not sure what the maximum safe RPM is, but I'd try to keep measurements below 100 RPM. To begin reading hit the zero button and hold the wheel to your spinning object. By default, the DMW will count the number of rotations over a 10 sec period, and then calculate the RPM. Note that the timer only begins after the DMW detects rotation, so you can start a measurement, and then position the DMW. You can also end the measurement early by hitting the zero button again. Once the measurement period has ended, the multi-tool will report the RPM. Pressing the zero button will start a new measurement.
- The reported RPM is that of the DMW's wheel. To find the RPM of your object, you need to take this and multiply it by the ratio between the DMW's wheel diameter, and the diameter of your object. Ie RPM * (DMW Wheel Diam / Object Diam) = RPM of object.
There are a few other settings in the code for changing things like the default mode, mode order, units, etc. These are all documented in the code, so I won't go over them in detail here.
Step 15: Calibration
Due to differences in printing, assembly, etc, the diameter of your Outer Gear Ring wheel will be different from mine. For the DMW to be accurate you need measure and input your exact wheel diameter. This is set in the code via the WHEEL_DIAM variable.
I recommend using a pair of calipers to measure the diameter. If you don't have a pair you can estimate with a ruler. You'll want to be pretty precise, down to a 1/10 of a mm if possible.
After inputting your diameter you should check it by measuring something of known length, such as a ruler. The longer the thing you measure the better because small errors only start to be noticeable over longer distances. Using a yard or meter stick should be okay.
If your test measurements are too big, you need to decrease your WHEEL_DIAM value, and visa versa if they're too small.
You'll probably need to go back and forth a few times to pin down the diameter accurately.
Once the calibration is finished, you Digital Measuring Wheel is complete!
Thank you for reading, and I hope you find the DMW useful. :)
If you have any questions, please leave a comment and I'll try to help out!
This is an entry in the
Build a Tool Contest