-
New Beginnings
01/19/2015 at 01:06 • 0 commentsSo 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
01/04/2015 at 08:20 • 0 commentsSo 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("Distance"); lcd.setCursor(0,1); lcd.print("Analyzer 3000"); delay(2000); } void loop(){ encoderCount = salad.read(); int unitState = digitalRead(unitCyclePin); if(unitState == HIGH){ unitCount++; } if(unitCount == 5){ unitCount = 0; } updateDisplay(unitCount, calculateDistance(encoderCount, unitCount)); } void updateDisplay(int unit, double distance){ lcd.clear(); lcd.setCursor(0,0); lcd.print(distance); if(unit == 0){ lcd.setCursor(0,1); lcd.print("cm"); } if(unit == 1){ lcd.setCursor(0,1); lcd.print("m"); } if(unit == 2){ lcd.setCursor(0,1); lcd.print("in"); } if(unit == 3){ lcd.setCursor(0,1); lcd.print("ft"); } } /* 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
01/04/2015 at 06:58 • 2 commentsWell 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
01/04/2015 at 00:06 • 0 commentsI'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
01/02/2015 at 01:41 • 0 commentsSo 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!
12/04/2014 at 06:30 • 0 commentsThe 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
11/28/2014 at 06:28 • 0 commentsWell 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
11/26/2014 at 07:07 • 0 commentsThis is my first project on hackaday.io 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.