Distance Analyzer 3000

Measuring device housed in an Altoids tin. Uses a rotary encoder with a wheel to estimate distance and display measurements on an LCD.

Similar projects worth following
Submission for the Pro-Trinket EDC contest. It's an Altoids tin that uses a rotary encoder to measure linear distance and then displays the measurements on an LCD.

The device is mean to replace common tools for measuring distances. It would be easy for someone to have this in their backpack or tool bag and use it to quickly estimate distances. This tool would be handy for people who need rough estimates such as contractors or real estate agents. It would much easier to use this device instead of a measuring tape or meter stick.

  • 1 × Pro-Trinket 5v + Lipo charger
  • 1 × Rotary Encoder
  • 1 × 16x2 LCD
  • 1 × 500mAh Lipo
  • 1 × Tactile Button

View all 6 components

  • New Beginnings

    John Hamann01/19/2015 at 01:06 0 comments

    So because of my lack of spacial planning and poor organization, the first iteration of the device doesn't close all the way and some of the contacts aren't as sound as I would like them to be. I'm planning on building the Distance Analyzer 5000 which will have more spacial planning and 2 dedicated interrupt pins for the encoder. Also I will be laser cutting the measuring wheel for increased accuracy.

    I'll be using a Arduino mini clone with the ATMEGA-328p, as well as an i2c backpack on the LCD to reduce the wire clutter. Other than that not much else is going to change.

  • Here's the code

    John Hamann01/04/2015 at 08:20 0 comments

    So this is the code I wrote despite it being 24 hours late.

     Distance Analyzer 3000
     (Pro-Trinket EDC hackaday contest)
     John Hamann
     Started November 29th 2014
    #include <LiquidCrystal.h>
    #include <Encoder.h>
    Encoder salad(3, 4 ); //inside joke
    LiquidCrystal lcd(12, 11 , 18, 17, 16, 15);
    int encoderCount = 0;
    const double pi = 3.14159;
    const double radius = 4.1; //millimeters
    const int totalSteps = 92; //number of clicks for one full rotation
    const int unitCyclePin = 0;
    const int resetPin = 5;
    int unitCount = 3;
    void setup(){
      pinMode(unitCyclePin, INPUT);
      pinMode(resetPin, INPUT);
      lcd.begin(16, 2);
      lcd.print("Analyzer 3000");
    void loop(){
      encoderCount =;
      int unitState = digitalRead(unitCyclePin);
      if(unitState == HIGH){
      if(unitCount == 5){
        unitCount = 0;
      updateDisplay(unitCount, calculateDistance(encoderCount, unitCount));
    void updateDisplay(int unit, double distance){
      if(unit == 0){
      if(unit == 1){
      if(unit == 2){
      if(unit == 3){
     0 = centimeters
     1 = meters
     2 = inches
     3 = feet
    double calculateDistance(int count, int unit){
      double radianCount = ((2 * pi) / totalSteps) * count;
      if(unit == 0){
        double radiusCent = radius / 10; //Change millimeters to centimeters
        return radiusCent * radianCount; //Arc length calculation
      if(unit == 1){
        double radiusMeter = radius / 100;
        return radiusMeter * radianCount;
      if(unit == 2){
        double radiusInch = radius * 0.039370; 
        return radiusInch * radianCount;
      if(unit == 3){
        double radiusFeet = (radius * 0.039370) / 12;
        return radiusFeet * radianCount;
      return 0;

    The reset and unit changer are as of now unimplemented. But for my first real arduino project it turned out pretty well.

  • Progress

    John Hamann01/04/2015 at 06:58 2 comments

    Well I've got about an hour an half left and so far I've managed to get the screen + trinket + battery working untethered. Now I only have to work the kinks out of my code. Because of the time crunch and lack of materials right now I have no power switch and there might be a tactile button floating around outside that changes units hopefully.

  • I've changed my mind

    John Hamann01/04/2015 at 00:06 0 comments

    I'm going to give this project my best effort on the last day. So disregard my last project log. I think instead I'll (try to) finish this and make an improved version with the teensy 2.0 in the future. I'm also in the midwest so time is on my side and I cranked out the the code in a car ride today so I'm confident that I figure something out. My only setback is a botched pro-trinket with header and a missing pot for my screen.

  • Jumped The Gun

    John Hamann01/02/2015 at 01:41 0 comments

    So I got a bit excited (after not doing anything because of finals/winter break) and just started putting things together and lo and behold it didn't work at all. This project won't be done before the deadline, but I think it's cool enough to keep working on it. I'd rather not embarrass myself by posting pictures of my horrible work. Either way it's since been dismantled and hopefully my salvage job works out and I can actually start prototyping on a breadboard (like I should have in the first place). So stay tuned folks.

    Edit: I think I'll ditch the pro-trinket in favor of the Teensy 2.0 because it has more available interrupt pins and would allow for more accurate measurements.

  • Parts!

    John Hamann12/04/2014 at 06:30 0 comments

    The components came in the mail today and I had to wait all day to work on them because of school/friends/etc. But here's a rough breadboard of the components aside from power management.

    I'm hoping to just not solder the headers on, because I would want them off for the finished product.

  • The Schematic

    John Hamann11/28/2014 at 06:28 0 comments

    Well this is actually my first electronic schematic ever. I downloaded eagle today and watched a few tutorials and messed around with it. I didn't know how to implement the actual Pro-Trinket board on the schematic so I just left it out and labeled where pins were going to go. For the actual components on the schematic I watched a few videos: Kevin Darrah's "Rotary Encoder Tutorial" and 000Plasma000's "How to Control LCD Displays | Arduino Tutorial". I think it turned out pretty decent, but I would love some feedback.

  • Initial Idea

    John Hamann11/26/2014 at 07:07 0 comments

    This is my first project on and I'm not a very experienced maker/hacker, but I think this project fits into the Pro-Trinket EDC idea and it'll be a good learning experience.

    The idea is to make a measuring device to measure linear distances easier than a measuring tape. The Altoids tin makes a great housing and it fits in the hand nicely. There is going to be an LCD on the lid of the tin as well as a reset button that clears the current measurement. The screen will be protruding from the face of the lid. The rotary encoder is going to be mounted facing down with the rod poking through the bottom. And the battery will go somewhere inside.

    The GUI will read out the measurements with units and then I might have another button that cycles through unit conversions.

    This idea is basically all in my head right now and it's like 1am and I still need to do homework, but obviously this is far more important.

View all 8 project logs

Enjoy this project?



ubergeekseven wrote 01/10/2015 at 16:56 point

this is funny, but I'm working on building another project someone showed recently. Theirs is a trinket hid caliper. I then suggested adding a rotary encoder, optical encoder to them do the hid output. As a community we can build an all in one accurate measuring device. Set up sensors on table saws, and you can have digital record of measurement and current position.

  Are you sure? yes | no

John Hamann wrote 01/11/2015 at 03:41 point

You'd probably want to use a more accurate encoder, optimistically my device should measure within a few millimeters, but most likely it'll be off by a couple centimeters.

  Are you sure? yes | no

John Hamann wrote 12/10/2014 at 07:22 point
Sorry about that....

  Are you sure? yes | no

shuflar wrote 12/10/2014 at 00:31 point
I wish you luck, my idea exactly... until I saw it posted here.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates