How to choose encoder resolution?

Obviously, “more is better” until the pulse frequency is too high to process. But my goal this time is absolute minimum cost. I’d say a $2 difference matters.

This is for an open source robotics project and it only makes sense to do the project if the cost is low.

My idea for an ultra-low cost encoder is to print out a bar code and wrap it around the outside of a spinning motor housing. Then count the bars with an optical sensor. These sensors cost about $1.50 each. Two required for quadrature.

This gets easier to build at lower resolutions. But the encoder is used for commutation. I don’t have a good feel for what resolution is needed

Check out 40 Cent sensing technique for the cheapest a community member has come up with. I’ve seen this work and it’s quite awesome :slight_smile:

I actually thought of this method. But I did not know if the resolution would be good enough. There are only 18 magnets and you have to interpolet the waveform.

Actualy, my plan was to make the sensor. Wind magnet wire around an iron shaft that is about 3mm diameter The varying magnetic field would induce voltage in the wire.

If you know how the pickup in an electric guitar works, it is kind of like that. You get a psuedo-sine wave out. Or if you know about a “tone wheel” in an old Hammond organ" it is more like that than a guitar.

But if hall effect sensor cost < $1, they are cheaper than magnet wire.

So we don’t really need much resolution?

No, the more resolution the better. Hall Sensors (digital style) are not super-accurate and it causes problems.
But the linear hall sensors, in a properly calibrated system, have the potential to be highly accurate… its just hard to set up, I’m guessing.
But they would give you potentially, theoretically, maybe, possibly :slight_smile: several times the ADC resolution within a single electrical rotation…

Inductive sensors, like the ones you describe but industrialised, are among the most accurate and expensive rotary position sensors - AFAIK people haven’t used them with SimpleFOC so far, but it should be quite possible. Its what high-end industrial robots and positioning systems use.

You also have to think about ease of use - the linear hall setup is super-cool, but its a big barrier for people to attach them to the motor in the right place, wire it all up, get reliable ADC working and then run complex calibration procedures.
So the cost savings of the 40c price-tag come with a hefty penalty in usability.

I personally find the magnetic sensors and optical encoders strike a good balance between usability and cost.

If we want to do a bit of math we could relate the PWM resolution, the motor’s pole-pairs and dimensions to the encoder resolutions required…

Perhaps I’ll get to that later to try to answer your question in a fully general way.

OK, I had hoped that someone had already done this long ago and they could just point me to the answer.

Or, I could just read the code and see how the encoder data is used.