Project tutorial

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

• 6,475 views
• 1 comment
• 11 respects

## Components and supplies

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

## Apps and online services

 Arduino IDE

I decided to build an inexpensive rugged custom digital read out for myself and for other hobbyists. My DRO design is fairly simple. It can be modified to measure short and very long lengths. It also allows the user to modify an Arduino sketch for personal measuring preferences and for the language of their choice.

I explain how to make it in this video.

## Code

##### X and Z AxisPlain 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.
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");
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.

}
```

## Schematics

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

#### Author

##### PracticeMakesBetter
• 3 projects
• 1 follower

• Music "irie" by Quincas Moreira

#### Published on

December 27, 2019

#### Members who respect this project

and 8 others

See similar projects
you might like

#### Digital Clock with Mirrored Display Driven by Accelerometers

Project tutorial by LAGSILVA

• 16,442 views
• 42 respects

• 946 views
• 6 respects

#### Digital 3D Printer Filament Counter Using PS/2 Mouse

Project in progress by ArtSuzhou

• 10,358 views
• 36 respects

#### Digital Clock with Arduino, RTC and Shift Register 74HC595

Project tutorial by LAGSILVA

• 33,226 views
• 75 respects

#### Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

• 21,317 views