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.
This project is designed to be highly flexible, adaptable for accurate short-range and long-range measurements. Its core is an Arduino board, allowing users to modify the source code to change measurement units, add specific functions, or even change the display language on the screen themselves.
I explain how to make it in this video.
In-depth Look at Components and Engineering Operation
Building a reliable DRO requires an understanding of the main components and the interplay between hardware and software, as follows:
1. Sensor and Signal System (The Encoder)
The heart of distance measurement is an incremental rotary encoder, which converts mechanical motion into electrical signals (pulses). The sensor outputs two sets of signals: Channel A and Channel B, which are 90 degrees out of phase (quadrature signal).
- Engineering Insight: The fact that both signals are out of phase allows Arduino to analyze whether the direction of motion is forward or backward by checking which signal changes state first.
2. Processing Unit (Arduino Brain)
We use an Arduino (e.g., Nano or Uno) to receive pulse signals from the encoder, emphasizing the use of hardware interrupt pins (Pins 2 and 3) to ensure that every pulse generated by rapid movement is not missed, which is a common problem with inexpensive measuring devices.
3. Mechanical Linkage
To enable linear distance measurement, this system can utilize either a rack and pinion mechanism or a string-pull system, depending on the required measurement range and work precision.
- Durability: The casing is designed to be exceptionally strong (rugged design) to protect the electronic system from metal chips, oil, and dust from machinery.
Code Logic Analysis
The programming for this project focuses on simplicity yet power, with the following main operational processes:
- Interrupt Handling: The program is set to trigger a function immediately upon a state change at the interrupt pin (rising/falling edge) to increment (Count++) or decrement (Count--) the count according to the direction of the quadrature signal.
- Calibration Factor: This is a highlight of the project. You can define a "scale factor" in the code. For example, if the encoder rotates 1 revolution with 1000 pulses and moves a distance of 10 mm, the program will calculate the actual distance using the formula:
Distance = (Pulse Count / Total Pulses per Rev) * Distance per Rev - Display Refresh: The display logic is separated from the counting logic to prevent screen latency from interfering with pulse counting, ensuring smooth and real-time readings.
- Zeroing Function: A button is available to reset the value to zero at any position, providing convenience for setting a new datum point.
In summary, why should you build this DRO?
Beyond its cost-effectiveness, what you gain is insight into the operation of numerical position control systems, which can be extended to building CNC machines or other automation systems in the future. Furthermore, as an open source system, you can repair and improve it throughout its lifespan without relying solely on specific parts from major manufacturers.