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….



  1. Hi,

    Neat project! I have been looking for a way to read encoders reliably, are you planing on sharing the arduino code?




    1. Thanks Dennis. Yes. I plan to share the code. I need to make a few mods first. I plan to install on my Mill in a few days so this should be the ultimate test. Peter.


  2. Peter,

    With this setup there is almost no high limit to the resolution of the linear encoder as long as its under 40 MHz in pulses correct?



    1. Hi, If I am reading the LS7366 datasheet correctly, the crystal frequency needs to be 4x max frequency of the ‘A’ quadrature output.
      In my case I am using a 20Mhz Crystal. (the max is 40Mhz for 5V operation. I used 20Mhz just in case I powered from 3V) With a 20Mhz crystal, the quadrature frequency is limited to 5Mhz. Since I get a 512 pulses per 2mm with the AS5311 encoders. The AS5311 has a limit of 650mm/s so at this speed the pulse frequency is 166.4Khz if my calculations are correct! Should be fast enough for my application.
      I guess it depends on what you plan to mount your encoders on….i.e. how fast it moves. The internal pulse counter is also limited to a 32bit number.


  3. Peter, really interesting project! I have a Taig lathe and recently purchased a CNC Taig mill. Would like to add digital readouts some day, so watching patiently. Thanks, matt.


    1. Thanks Matt, I’ll post more on the Taig mill setup once I have the display board mounted. I plan to do a small lathe version. I no longer have my Taig lathe but have a Unimat 4 about the same size. I will re-design the encoder boards (to make them smaller) for the small lathe version and make a 2 axis display board. Most likely using a 2.2″ blue LED display. Peter.


  4. Hi Peter, Looks like you have made quite a bit of progress on this high-resolution readout (Prototype 3 looks great). Very exciting that you got successful results.

    What gap are you using between the sensor and the magnetic strip? I’ve read that this being as small as possible is critical.

    Also, can you open-source any of your work/code? Would be helpful to use it as a reference during implementation for my own build (I’m slowly getting better and better at programming!)

    Either way, kudos on inspiring me to get started with this IC in the first place!



    1. Hi Thomas, According to the AS5311 specs, the gap should be less than half the pole width. In this case using 1mm pitch magnetic strip, so gap should be less than 0.5mm.
      When I mounted my encoders I just made sure I could see a gap between the encoder and tape but as close as possible. The biggest problem is keeping the strip protected against anything that may get between the encoder and strip.
      This is why I have mounted my strips in ‘U’ shaped aluminium extrusion. Depends on you application I guess.
      I plan to make the code available once I have ‘refined’ it a little more. Reading the encoders is quite easy. I had more problems driving the OLED display.
      I have built a few more versions of or this DROs since these posts and plan to post some updates shortly.

      Thanks for your comments.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s