PracticeMakesBetter
Published © GPL3+

Do It Yourself Digital Read Out

Make your own custom DRO that measures distance for lathes, milling machines, woodworking tools, cut-off saws and other purposes.

BeginnerFull instructions provided14,017
Do It Yourself Digital Read Out

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Alphanumeric LCD, 20 x 4
Alphanumeric LCD, 20 x 4
IC 2, 20 x 4 LCD Display
×1
Sensor Cable, Encoder
Sensor Cable, Encoder
Rotary quadrature encoder 600 pulses/revolution
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Encoder wiring diagram

It is a diagram that shows how to connect an encoder to an Arduino UNO.

Code

X and Z Axis

Plain text
These are the sketches for measuring distances in my DRO project and displaying the results on a LCD screen
// Z Axis Sketch 

// James Rovere 2019 Z Axis
// A Digital Readout using a quaduture rotary encoder,an IC2 LCD display
// and a GT2-16 pulley, 16 teeth spaced 2 mm apart; .37" outside Diameter.
#include <Encoder.h>// Encoder library.
Encoder myEnc(2,3);// Connected to Digital pins 2 and 3.
#include <LiquidCrystal_I2C.h> //IC2 LCD library.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup() {
  lcd.begin(20, 4); // My display has 20 Columns, 4 Rows.
}
long oldPosition = -999;
void loop() {
  const float Wv = (.1 * PI) / 600; // Math formula for .37" diameter pulley
                                    //and 600 pulse/revolution encoder.

  lcd.setCursor(7, 0); // (Column 7,ROW 0) (Column #0-19,Row #0-3)
  lcd.print("Z Axis");
  lcd.setCursor(2, 1);
  lcd.print("inch");
  lcd.setCursor(14, 1);
  lcd.print("mm");
  lcd.setCursor(8, 2);
  lcd.print("<->");// Graphic symbols for a Z axis left and right travel.
  long newPosition = myEnc.read();
  if (newPosition != oldPosition)
  lcd.setCursor (0, 0);
  lcd.print (newPosition); // Display number of pulses, 1"~=1902.2 pulses.                       
  lcd.setCursor(2, 3);
  lcd.print(Wv * newPosition, 3);//Math formula * Encoder reading ,3 decimals
  lcd.setCursor(9, 1);
  lcd.print("|");// Graphic symbol to separate imperial and metric display.
  lcd.setCursor(9, 3);
  lcd.print("|");
  lcd.setCursor(11, 3);
  lcd.print(Wv * newPosition * 25.4, 2); // Formula to convert imperial
                                         // and metric, 2 decimals.
}


// ______________________________________________________________________

// X Axis Sketch

// James Rovere 2019 Lathe X Axis
// A Digital Readout using a quaduture rotary encoder,an IC2 LCD display
// and a GT2-16 pulley, 16 teeth spaced 2 mm apart; .37 outside Diameter.
#include <Encoder.h>// Encoder library.
Encoder myEnc(2, 3);// Connected to Digital pins 2 and 3.
#include <LiquidCrystal_I2C.h> //IC2 LCD library.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
 
void setup() {
  lcd.begin(20,4);// 20 Columns, 4 Rows.
  }
long oldPosition= -999;
  
  
void loop() {
  const float Wv =(.1 * PI)/600; // Formula to set the linear distance travelled in one pulse.
    
    lcd.setCursor(8,0); //(Column 8, Row 0)
    lcd.print("X Axis");
    lcd.setCursor(3,1);
    lcd.print("inch");
    lcd.setCursor(14,1);
    lcd.print("mm");
    lcd.setCursor(9,1);
    lcd.print(":");
    lcd.setCursor(9,2);
    lcd.print("|");
    lcd.setCursor(9,3);
    lcd.print(":");
    lcd.setCursor(3,2);
    lcd.print("D");
  long newPosition = myEnc.read();
  if (newPosition != oldPosition)
    lcd.setCursor (0,0);
    lcd.print (newPosition);// Display pulse count.   
    lcd.setCursor(2,2);
    lcd.print(Wv*newPosition*2,3);//Diameter multiply by 2, 3 decimal places
    lcd.setCursor(0,2);
    lcd.print("D");
    lcd.setCursor(11,2);
    lcd.print("D");
    lcd.setCursor(11,3);
    lcd.print("R");
    lcd.setCursor(0,3 );
    lcd.print("R");
    lcd.setCursor(13,2);
    lcd.print(Wv*newPosition*25.4*2,2);// mm Diameter multiply by 2, 2     //decimal places.
    lcd.setCursor(2,3);
    lcd.print(Wv*newPosition,3);// inch Raidius of workpiece.
    lcd.setCursor(13,3);
    lcd.print(Wv*newPosition*25.4,2);// mm Raidius of workpiece.
          
}

Credits

PracticeMakesBetter

PracticeMakesBetter

0 projects • 12 followers

Comments