Inside the Bourns ACE-128 Absolute Encoder

Inside the Bourns ACE-128

The Bourns ACE-128 Absolute Contacting Encoder is a mechanical knob providing an 8-bit gray code output with 128 unique values per rotation. When I first started using them I assumed there was a single track on the rotating part and 8 little contacts attached to the pins. The track on the rotating part would match the 128-bit pattern you can read vertically from the datasheet. If you check the table closely, you will see that each vertical colummn is offset 16 positions – one eighth of a rotation from the next.

One day, while testing my backpack modules, I came across a unit that was operating intermittently and felt loose. I suspect it was missing an internal spring washer to maintain pressure on the contacts. Rather than going through the hassle of trying to return it, I decided to open it up and see what was inside. What I found was exactly not what I expected. It is simpler and smarter.

The circuit board has no contacts attached to it. Instead there are two tracks. The inner track is continuous and connected to the common/ground pins. The outer track is gapped evenly – 8 sections of equal size with gaps between of equal size.

With 128 positions in the circle, each pad or gap represents 8 positions.

On the rotating part there are contacts which will bridge between the inner and outer tracks. These contacts are spaced in a very special way.

If we observe the binary track from pin 1 in the datasheet:


If you look closely you will see that while the ones appear to be in randomly sized blocks, the zeroes are always in blocks of 8. As we are grounding the common pin, the zeroes are where any contact is touching a pad, the ones are where no contacts are touching. The contacts are spaced enough apart that only one can touch any pad at any time. To get the gray code – only one contact transitions on or off at any position change – the contacts need to be spaced in such a way that this occurs.

With 8 positions for each pad/gap and 8 contacts this works as follows.

For each pin, take the offset position and divide by 8.

The remainder – the modulus – should be different for each contact.

The offsets of the first zero in each block are 2, 20, 35, 72, 86, 97, 109, 119.

The moduli of these values are 2, 4, 3, 0, 6, 1, 5, 7.

Which is all the values from 0 to 7.

Before I figured this out I thought it was to do with the size of the gaps between the contacts, so I mapped it all out against a 128 position compass rose. This was entertaining but ultimately not the right approach.

I’m very impressed with the ingenuity that went into this sensor.

My I2C backpack modules are available on Tindie, if you want to integrate these into your next Arduino or Raspberry Pi project.



The OctoSonarX2 is an expanded version of the popular OctoSonar, which allows you to drive 16 inexpensive HC-SR04 ultrasonic sensors from the I2C bus and one additional pin on your Arduino.

Compatible with 5V and 3.3V controllers.

Check it out at my Tindie Store

OctoSonar V2

OctoSonar 2.1

The OctoSonar 2.1 is an improved version of the popular OctoSonar, which allows you to drive 8 inexpensive HC-SR04 ultrasonic sensors from the I2C bus and one additional pin on your Arduino.

Improvements include:

Redesigned echo signal handling, eliminating interference from misbehaving sensors. Address pull-down resistors and larger address jumpers Compatible with […]

Absolute Encoder for the Raspberry Pi

I have published a python module to support my Bourns ACE-128 modules on the Raspberry Pi. The functionality of the Arduino library has been mapped into python. EEPROM state retention uses files, and the encoder map is generated on the fly. Support for the MCP23008 chip is not included.

Get the code on GitHub


Permalinks on Tindie

Update: Tindie have added the “shortlinks” on the product list page in the store.

Tindie is an online store where electronics hobbyists sell their widgets and doohickeys. I recently started selling a couple of my products on this site and I am very pleased with the service they provide.

When selling your stuff online […]