Close

Absolute encoders

A project log for Apartment HVAC IoT

Bringing analog hvac system into home automation.

pydrewPyDrew 10/29/2020 at 18:000 Comments

I had done quite a bit of research into rotary encoders during a digital read-out project for my vertical mill. The most available (and lower cost) varieties were shaft-based encoders -- either with specific detents (left) or in fairly large packaging (middle) -- are difficult to integrate where two shafts are already connected. The next best alternative is the AMT-102 which, at $20, slips nicely over an existing shaft-to-shaft connection and has remarkable precision (up to 0.08 degrees of accuracy).

But all of those are incremental encoders and, at best, have a single index point per revolution. Upon startup of the microcontroller, determining where that index position is without hitting the limit of the 270 degree arc couldn't be guaranteed. It could, perhaps, work with the mode selector since you could do a full revolution at startup, but aligning the encoder with the heat-cool mode select knob is not without its challenges. 

Options for oiff-the-shelf absolute encoders were even more limited than incremental, most exceeding any sort of reasonable budget ($100+). I did find a reasonably priced magnetic position sensor which had potential, but with only a surface mount package, it was a little out of reach for my limited fabrication tools. Perhaps for the next project.

Left with building my own absolute encoders seemed like a possible solution. Typical designs seemed to follow an optical pattern of alternating light-dark pattern with each ring offset by some set of degrees to differentiate the position. With multiple sensors, one positioned at each ring, it creates a binary code for each location: black representing zero, white a one.

Additionally, the infrared sensor (far-right) is ubiquitous in most beginner sensor kits for line following; it contains an IR led / photo-diode pair along with a comparator and variable resistor to tune the IR reflection. Mostly used for line following robot exercises, it worked as a tachometer reflecting off a printed piece of paper for my lathe DRO project quite well.

Not compact enough for the tight spaced HVAC console, but closer to a solution. My second iteration's attempt was to put the IR led and photo-diode opposite each other with a slotted disc (left) which followed the optical pattern.

While this provided the necessary number of index points, the resolution meant that the position could be within a 22.5 degree range. For this application, I really needed to know at specific positions and then "don't cares" for the ranges in between.

The next iteration (middle) fixed this problem but with equally sized slots for each ring, as the disk rotated, the inner most slot illuminated its photo-diode before the middle and outer slots. From this picture, you can see that the vertical white line showing up in the lower slot but not in the upper.

Final design (right) created openings that were "pizza" shaped improved the situation, although some software "debouncing" was still required to make sure that the photo-diodes were all being exposed to their respective IR LEDs at the same time.  I'll cover in a future post the software for signal debouncing that was still required.

It was also interesting, although perhaps not surprising, that different colors of the PLA were not necessarily opaque to IR wavelengths, hence the change to the darker colors.

Discussions