Introduction: Rotational Based Tape Measure
"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)"
This project is designed based off the idea of a surveyor's wheel where a user can roll the device on the ground and get a distance measurement based off the number of revolutions made.
Arduino UNO : (Or any board that is compatible)
Digital Push Button (White) : https://www.dfrobot.com/product-1097.html
4PIN Sensor Adapter : https://www.dfrobot.com/product-1626.html
Incremental Photoelectric Rotary Encoder : https://www.dfrobot.com/product-1601.html
I2C RGB 16x2 LCD : https://www.dfrobot.com/product-1609.html
Arduino Expansion Shield : https://www.dfrobot.com/product-1009.html
9V battery Snap : https://www.adafruit.com/product/80?gclid=Cj0KCQiA...
(Optional) Neoprene or Silicon window trim for wheel grip
Step 1: Preparing the Encoder
For this project, not all of the wire attached to the encoder is necessary and could take up valuable space so I went ahead and trimmed it down to about a foot in wire length and stripped the individual wires to obtain the 4 colored connection wires.
These wires should be connected into the input of the 4 PIN sensor adapter (switch set to Vin) with the following pinout:
- White : Vout
- Black : Gnd
- Red : IO1
- Green : IO2
Step 2: Wiring Diagram and Layout
Be sure to properly attach the Shield to the UNO
- Digital Input = Green Row
- Analog Input = Blue Row
- Vcc = Red Row
- Gnd = Black Row
The 4 connections out of the cable adapter module (from the provided cable with the 4PIN module) will attach as follows:
- VIN (Red) : Analog Vcc (Pin 5)
- GND (Black) : Analog Gnd (Pin 5)
- IO1 (Blue) : Digital Input (Pin 3)
- IO2 (Green) : Digital Input (Pin 4)
The 3 connections from the Push Button and provided cable should attach as follows:
- Input (Green) : Digital Input (Pin 12)
- Vcc (Green) : Digital Vcc (Pin 12)
- Gnd (Black) : Digital Gnd (Pin 12)
The 4 connections from the RGB LCD are done via I2C connection and use the provided cable attached as follows:
- Vcc (Red) : I2C 5V
- Gnd (Black) : I2C Gnd
- SCL (Blue) : I2C SCL
- SCA (Green) : I2C SCA
Step 3: Enclosure Printing
The 3 parts the need to be printed are the Enclosure, the Enclosure Cover, and the Wheel
These parts were designed in Autodesk Inventor and their files can be found here along with their STL files
NOTE: Sometimes files need to be scaled up by a percentage of 1,000 in Cura. Change scale from 100 to 1,000 to make the project seem reasonably sized
Step 4: Assembly!
- The best place to start is with the Encoder where it should slide into the back end by angling the shaft in initially and screwing it into place.
- Then it should have its provided shaft extension set into place and tightened in with its provided Allen key
- Wind any loose wire around the printed wire wrap towards the top keeping the adapter held in place under the winding
The Arduino Should be screwed into the standoffs in the enclosure (May need to remove the shield) along with the push button and the LCD in their appropriate slots in the enclosure with screw holes
The wheel should be slid into place and a large screw should be threaded through the center in order to catch onto the printed PLA
This screw should be guided into the opening in the encoders extended metal shaft and tightened down by the Allen key and screw provided inside the shaft.
At this point we may be wondering what should be done about the powering source of the Arduino and the method that was chosen was powering via a 9V battery with an adapter. This battery can be attached to the enclosure via Velcro or the way it was done in this project being printing out a pre-designed 9V battery holder and applying JB weld to adhere the holder to the enclosure between the wheel slot and the enclosure front.
Step 5: Programming
The code is set to determine the mode that is desired based off of button presses and press and holds.
A button push will cycle between Reset, Measure (Where the wheel spinning will be recorded), and Lock (where a measurement and be viewed without it changing.
A press and hold while on the lock mode will swap the mode to Reset as well as changing the units between cm and in (It must be on lock screen to prevent the units changing with an inaccurate measurement pertaining to those units)
A Lengthy press of over 3-5 seconds will have the LCD power ON or OFF depending on what power state it is currently. This is done to help conserve power.
The code itself uses many if/else statements and loops to determine button press time as well as modes and operations of each. It includes a interrupt statement in order to constantly read any changes on the encoder to have live feedback to its rotations. It is thoroughly commented to help figure out its parts and if anythings needs to be adjusted based off the project or any variation of it.