# Attaching an optical rotary encoder to a bicycle wheel

I am currently working on a Sixth-Form experimental physics project, the end goal of which is to build a simplified Malkus Waterwheel, and to see whether chaotic synchronization can be achieved between the recorded motion of this and a modified form of the Lorenz Equations. Whilst I am confident with the mechanical and programmatic elements of this project, I am uncertain how to translate the wheel's motion into digital measurements of angular displacement/velocity.

Given the low-budget nature of the project, I will be using a bicycle wheel for the frame of the waterwheel. Answers to a previous question, Adding Rotary Encoders to an Electronic Wheel Chair, suggest to me that an optical rotary encoder is the best type of sensor to measure the motion of this. However, given that lack of non-technical material online, I would very much appreciate clarification on one key point:

Since my bicycle wheel's axle will remain stationary whilst the wheel spins, how is it possible to mount an optical rotary encoder's disc to the bicycle wheel in such a manner that its angular motion will mirror that of the wheel?

• use friction drive Commented Jul 1, 2021 at 19:05

## 1 Answer

I'm coming at this question from more of a, "How do rotary encoders work?" than anything specific to your question.

how is it possible to mount an optical rotary encoder's disc to the bicycle wheel in such a manner that its angular motion will mirror that of the wheel?

Welcome to engineering, haha.

A rotary encoder typically has to parts: an encoder disk and the reader. The general principle is that there is something "special" on the encoder disk that the reader can detect, and the detector converts that special mark to an output given the prior knowledge of what that mark means.

Typically the reader will be optical or magnetic (for a Hall effect sensor), and the encoder disk will be a series of lines, or holes, or magnets on a disk.

How accurate the encoder is depends on how many marks there are on the disk. For example, on my 1989 Pontiac Bonneville, there's only one magnet, which means the engine is only able to tell if the camshaft is in that position or not that position.

An optical encoder disk might have half the disc black and half white, which would make it a one-bit encoder. It could alternate quadrants black and white, which would make it a two-bit encoder. If it has 256 marks, it's an 8-bit encoder.

If the reader can detect 256 transitions per revolution, then it's an 8-bit encoder, but if it can't distinguish one transition from the other then it's a relative encoder. If you power the system on for the first time, it doesn't know the absolute position of the encoder wheel. To get around this, some encoders have multiple sections and multiple readers - one reads the 1-bit encoding section, one reads the 2-bit encoding section, etc., and you wind up with a wheel that, when read, reads out its position in binary. Here's a 3-bit encoder and here's what looks like a 10-bit encoder (1024 marks per revolution).

It's also possible to have a quadrature encoder which is a kind of 2-bit relative encoder that is capable of sensing direction because the bits both have the same encoder resolution, but they're offset to overlap. If channel A goes positive and then channel B goes positive then you're moving in one direction, and the opposite is true when you're moving in the other direction.

Now, finally, more to your question, the way these are mounted depends on your target application and there's basically a different style for every conceivable way you could use one.

Some encoders have a housing you would mount to a frame and a shaft you would couple to your rotating object. The housing, with the read head inside, stays still and the shaft spins an encoder disk inside. This wouldn't work for your application, because the shaft you would couple with will also remain stationary.

Some encoders have a "hollow shaft" and are meant to be installed over an existing shaft. The encoder is literally hollow in the middle and it makes a ring shape. You choose the diameter you want and the "hollow shaft" or sleeve is held to the driven shaft typically with a setscrew. Again, for you isn't not a matter of how you couple to the shaft, because the shaft in your case isn't rotating.

Finally, some encoders come essentially in two pieces - you get the encoder disk and the read head as two separate pieces, and then it's up to you to mount them how you want. This is probably the most appropriate for you because then you can attach the encoder disk to the wheel hub and mount the read head to whatever frame you're attaching the wheel.

I'm not affiliated with any of these sites, but you can generally find items like this or this by searching for "encoder disc" or "encoder disk" or "encoder wheel," but honestly you could also probably just make one yourself by printing off a pattern to a piece of cardstock and using an IR proximity sensor with a notecard wrapped around it to make a shroud. The rangefinder would get more reflection ("closer!") when shining on a white mark and less reflection ("farther!") when shining on a dark mark, and you could implement your own encoder looking for those reading variations.

• Thank you very much for this detailed response. Commented Jul 8, 2021 at 19:42