High Resolution Absolute Encoder - Arduino & Pi

Bourns ACE-128 Absolute Contacting Encoder - 128 positions - with I2C interface - Arduino & Raspberry Pi libraries

Similar projects worth following
This is a an I2C backpack and Arduino library for the Bourns ACE-128 Absolute Contacting Encoder

In layman's terms, it's a digital control knob that has 8 data pins which will give you 128 unique results around a full circle. It is designed as a control panel knob, but can be adopted for other uses. It is, as far as I know, the smallest and cheapest gray code absolute encoder available today. The product listed here combines this with an I2C backpack and library code so you can add several of these to your Arduino or Raspberry Pi project.

What is it?

A digital control knob providing 128 unique results evenly spaced around a full circle. It is designed as a control panel knob and includes a nut and washer, but can be adopted for other uses. The module communicates via the I2C bus with 16 addresses available.

This is an alternative to using a potentiometer and analog pin, allowing full-turn and multi-turn operation, and is not impacted by temperature variations. The library includes optional automatic saving of logical zero and multiturn offset to EEPROM so that the system will remember these settings after power down or reset.

Now also supported on the Raspberry Pi.

It differs from the more common incremental rotary encoder which has only two or four values in a rotation and is designed to measure full rotations and direction. This measures angles.

From the datasheet

Until now, the choice of an absolute encoder meant an expensive, and larger sized product. Through the use of combinatorial mathematics, the absolute code pattern of the Bourns® Absolute Contacting Encoder (ACE™) is placed on a single track for a very economical, energy efficient and compact product. Bourns® ACE™ provides an absolute digital output that will also retain its last position in the event of a power failure. An intelligent alternative to incremental encoders and potentiometers, the Bourns® ACE™ is ideally suited for many industrial, automotive, medical and consumer product applications.

It is, as far as I know, the smallest and cheapest gray code absolute encoder available today.

Why did you make it?

I used these to build a head-following mechanism for my Dalek dome and eye, using hand-made pcbs. I found the sensor online and say it could provide the rotational position sensing I needed, but there was no Arduino support, so I developed the code to support that.

Two were used to convert wiper motors into high powered servos

wiper motor servo

A third was used to detect the operator's head rotation in a motion control headset

enter image description here

A fourth is now installed in a control module and is used to enter PID tuning variables.

To support the ACE128 I wrote an arduino library to handle the I2C communications and gray code translation. The device itself generates gray code which has to be converted to normal numbers before use, and that takes some binary math - especially if you connect the pins in a different order from the datasheet.

My hobby is progressing to manufactured PCBs and SMD soldering, so I pulled this design out and made some up. To my delight, the first batch all work!

What makes it special?

The ACE-128 is the smallest and cheapest absolute encoder available today. It uses some really ingenious mathematics in its design. This library and package are a unique solution for easily including digital knobs into Arduino projects.

You may prefer this to using a potentiometer and analog pin in applications where:

  • temperature sensitivity of the potentiometer is causing the value to drift. As the device uses mechanical contacts it is not susceptible to environmental variations and will retain its value when powered down.
  • you need full turn angular measurement
  • you need multiple turns for a wider range
  • you need precise control - with approx 3 degrees between positions and a very slight tactile feedback you can get the number you want without overshoot.

You may prefer this to using a rotary encoder where:

  • absolute position is important (rotary encoders sense relative movement - typically full rotations and direction only)
  • you need the system to remember the relative zero when powered down
  • finer resolution than incremental rotary encoders (most measure 90 degree increments)

What's this doing on Hackaday?

I'm selling these on Tindie and Hackaday seems like the right place to put support documentation. I haven't used Hackaday before so we'll see how it goes.

I sell on Tindie

View all 3 project logs

  • 1
    Step 1

    How to run the ACE128test sketch to verify your device is good and the software it set up right.

  • 2
    Step 2

    Overview of the I2C backpack available on Tindie

  • 3
    Step 3

    Making a custom encoder map

View all 4 instructions

Enjoy this project?



Alastair Young wrote 06/06/2017 at 19:05 point

Sorry for the late response - I'm not used to folks actually commenting on my stuff! :-)

The original through-hole design files for the MCP23008 prototype got lost somewhere  - I made those back on 2011. The latest board revision for SMD with PCF8574 are up to date at

I've stuck the OSH symbol on it and the MIT license so have at it. 

  Are you sure? yes | no

anna wrote 04/20/2017 at 18:10 point

Thank you so much! Your documentation and library have been very helpful. Do you have an EAGLE file that uses the ACE128 encoder? The files attached on github won't download properly. I've found a library that includes the I2C chip, but cannot find the encoder. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates