DRO – New Version

The current madness in the world has given me the chance to spend more time updating some designs. I’ve been meaning to update the DRO files for a while now. Here’s the first part of the latest versions.

Starting with the single axis display.

This is another ATMega328p based board so you can treat it like an Arduino Uno. My previous designs have used the LS7366 Quadrature counter IC to off-load the pulse counting task from the 328p. It’s possible to count pulses with the ATMega328p PROVIDING you don’t try and count them too fast. I’ve made this optional on this board. There are two solder jumpers -SJ1 and SJ2, that switch the A + B quadrature signals to either an optional LS7366 OR the two ATMega328p interrupt pins D2 and D3. Options shown below:

Using the interrupts will work quite well providing you don’t try and move an axis faster than about 70mm/sec. More than this and it will skip steps. If you want to move the axis faster than this, then install the LS7366 on the PCB. (I recommend using the LS7366 in any case)

Here’s the circuit:

DRO Schematic

And the layout:

Note that a 20 MHz crystal is shown on the schematic for the LS7366. For best performance use a 40MHz.  I used what I had at the time.

The board supports either a SSD1309 1.5” 128×64 or SSD1305 2.2” 128×32 OLED displays. Other than this, you can use any other I2C display connected to the 4-pin header provided on the board.

A count reset and Unit (mm’s or inches) Toggle switch inputs are provided via the D4 and D5 pins on the PCB. There’s also a standard ICP connector with the Reset/SPI bus pin for installing the bootloader.

Finally, I got sick of using FTDI adapter boards to load sketches, so I’ve included an FT232RL for USB connection.

Eagle Schematic and layout files with the code can be found here:

The DRO requires a 4 wire connection to the AS5311 sensor board – A + B quadrature signals and GND and +5V.

Here’s the sensor board circuit:

Sensor Schematic

I’ve made this a general purpose board that breaks out all the AS5311 outputs should you wish to experiment or feel brave and write your own code for the serial interface to try and get that 0.5um resolution. I’ll stick to the 1.95um resolution that’s offered using the quadrature signals.

Note that the CS pin on the PCB needs to be pulled low to enable the encoder.

I’ll make the boards available at least in bare PCB form shortly. Maybe a small production run of built up boards depending on interest.

Example code uses the U8g2 Display library and Paul Stoffregen’s Encoder library for the interrupt version.

Next – the 3 Axis board….coming soon.

Prototype 3

More progress on the prototype DRO. Buttons are now working – Axis reset and Measurement toggle.
Also added a startup config option to allow default metric/imperial measurement and reverse axis options.

New board has been designed and back from the PCB house. I have added a header for S/W SPI port and select
lines in case anyone whats to use standard 7-segment displays via MAX7219/MAX7221 drivers.

display-p3 Display-p3-2

The board uses a surface mount TQFP ATMEGA328P. ICP and FTDI headers provided for Bootloader/Prog.
I managed to load the bootloader using either an UNO as a programmer or using a cheap USBASP programmer board.
Both worked. The board is treated as a Arduino Uno and must be set as this in the Arduino ADE for either bootloading or programming via FTDI.

Font still needs updating for the OLED display.

Sensors have been mounted in the aluminium cases I made earlier. I have potted these in epoxy resin and added armoured cable.

The top of the AS5311 sensor sits above the resin and casing by a small amount.


My small Taig mill will be the first recipient of the DRO. I’ve spent a few days making the mounting brackets for this.
Here’s the Z Axis sensor mounted and ready to go. The magnetic strip is mounted in a 16mm square aluminium U channel.

I’m in the process of mounting the X and Y sensors.


Next step is to mount the display board. For this I plan to mill the case from a solid block of one inch thick aluminium.

Encoder boards and casings.

Ok. So while I’m waiting for the prototype display board to come back from the PCB Fab.,
I’ll spend some time on the enclosures for the encoder boards. I ended up redesigning the encoder
board to be slightly smaller and to use the Molex pico-blade connectors rather than a 0.1″ header.
I also changed the crystal case and dropped one of the LEDS I used originally on the index line.
Not much point in putting an LED on this line. It pulses every 2mm travelled for 1uS. Barely visible.

So here’s the encoder board – front and back.

sensor2 sensor1

LEDs and resistors for the A and B incremental lines are not installed. Nice to have them blinking away while testing, but otherwise pretty useless. LEDS installed for power and Mag Dec/Inc. these should be visible through some 1mm holes in the case.

For the enclosure/casing, I’ve used a piece of 10mm aluminium bar, milled a pocket for the PCB with four mounting points.
(using a 1/4″ end mill) The PCB sits 0.1″ from the surface, leaving the top of the sensor chip flush with the surface.
Once the PCB is installed I’ll encase it in resin, leaving the sensor chip flush with the top.
There’s probably not much point in actually installing the LEDS on the sensor board unless you plan to make them visible
through a few small holes. The LEDS were useful when testing the code.

Here’s the case…

sensor3 sensor4

After many magic words to assist in crimping the pico-blade connectors on a test lead (these are small!), I’m not sure I will continue using these. Maybe a few holes in the PCB and the wires mounted directly is the best way to go. Once the board is epoxied in place, it won’t be going anywhere.

While I have tapped the mounting holes M2, I probably won’t use these except for temporarily mounting of the board before potting in epoxy.

Encoder case looks like a good candidate for some home anodizing….and since the main PCB still hasn’t turned up, that’s next…

Prototype 1

The prototype encoder PCB has been made and tested with an Arduino Nano.

You will notice in the photo that I’m using 7 segment displays and a small OLED display.

I plan to support a number of different displays. One version with the ‘traditional’ 7 segment displays and one version with a large OLED display showing all data. I tend to favour the OLED displays. They have low power consumption, fantastic contrast, excellent refresh rate and easy to use.


The LED display shown in the photo is connected via SPI. The display board is based on the MAX7221. Current per segment has been limited to less than 5mA per segment since I’m powering it from the USB port.

The small 1″ OLED is connected via I2C so only requires two I/O ports on the Arduino.  This particular board is labelled ‘CRIUS’ and used on multicopter controller boards commonly available off Ebay for a few bucks. If you buy one of these CRIUS boards, make sure you buy the version 1.2 board. The earlier boards don’t work well with the Arduino without modification.(adding a resistor/capacitor on the reset line). I used the U8glib library for this display.

The 300mm magnetic strip for the encoder is visible at the bottom of the breadboard.

Code needs to be refined more with X,Y,Z axis and reset/unit switches.  Hopefully this will fit in the Arduino ATMega328 code space.

Next prototype will use a 2.4″ green I2C OLED display based on the SSD1305 controller. This display is 128×64 pixel and should be big enough to display all X,Y,Z readings with a metric or imperial unit indicator. Unfortunately this display isn’t current supported by the U8glib library. It is very similar to the SSD1306 based displays so should be easy enough to modify the library.  Waiting on a Display PCB to arrive to test this….

DIY Digital readouts

I have a few machines in my home workshop. I guess most people like me have found that the cost of the machine is small compared to the accessories you need… So I spend most of my time making accessories. I’d like some digital readouts for my machines. Problem is that they cost lots for lots of machines… Why not make some. How hard can it be? Magnetic scales seem to be the easiest way to go for the serious DIY’er Small in size, scalable to any size simply by cutting the magnetic strip and of course, relatively cheap. Austrian Micro Systems make a range of linear encoders suitable for this project. I’ve picked the AS5311 device. This device has a resolution of about 0.5um. It also has quadrature output that provides a resolution of 1.95um 1.95um is good enough for me. 0.00195mm So, how am I going to read these devices? The Arduino was my first thought. Cheap and easy to program. The Quadrature output of the AS5311 gives 1024 pulse per 2mm magnetic pole pair. I want my project to have at least 3 axis capacity. I don’t think the Arduino would cope with this on three separate inputs. After some searching for quadrature counters, I came across the LS7366R from LSI. This is a 32bit Quadrature counter with a SPI interface. Perfect. So, my sensor consists on an AS5311 and a LS7366R to count the pulses. Then, it’s just a matter of reading the pulse counter on the LS7366R and displaying the results. This should allow me to use the Arduino to process the counts and drive a display. Here’s my circuit: Encoder Circuit board time.