New products: Magnetic quadrature encoders for micro metal gearmotors
Everyone wants encoders on their motors. If you think you don’t, you just don’t know it yet. I think the main reason is that we really just want motors to do what we tell them to do, but they don’t. One of the most common beginner questions we get is some variation of, “why doesn’t my robot go straight?” or “I got two of the same motor but they do not go the same speed; is something wrong with one of them?” More seasoned robot builders know that since there will always be variations in everything that contributes to a motor’s performance, our best hope is to put a sensor on the motor to monitor what is actually happening and then adjust the motor control to make reality better match our desires.
Consequently, we get a lot of requests for encoder options for products like our 3pi robot. Unfortunately, encoders can be expensive or difficult to make. Many high-quality or industrial motors are readily available with encoders, but they might have resolutions that are overkill for small robots and overburden their limited computing power. We have been working on various solutions for our favorite micro metal gearmotors for years, dating back to one of our first custom wheels, where we incorporated teeth in the white hub to contrast with the black tires:
Encoder for Pololu wheel 42×19mm with wheel, motor, and bracket.
That approach has various limitations, including working only with one particular wheel. One drawback that we did not expect was that the variations in the sensors and the geometry of their alignment relative to the wheel made the raw outputs of the sensors unusable without individual calibration. We have to set the two little potentiometers on each board to the right spot for each unit we make, which is time consuming and makes the product cost go up.
We made substantial progress on this problem with the optical encoders we released last year, which involved putting sensors on the back of the motor in a more traditional encoder arrangement:
The raw output of the sensors is much better than on the older encoders, to the point that it can sometimes be used without any extra conditioning electronics (though we do not recommend it):
5V encoder version, motor approx. 30k RPM: 5-tooth wheel at optimal distance from sensors.
One of many Kickstarter projects to incorporate Pololu components.
Longtime observers of Pololu have probably noticed that we have a bottom-up product development approach, where we first develop components we need for the robots we want to make before developing the final robots. So, for instance, you could buy the track set that we were developing for the Zumo robot long before the complete robot was available, and we developed and released the switching regulators used in our A-Star Mini programmable microcontroller boards long before we released the A-Stars. These intermediate products let us distribute our development costs and limit the chances that some unexpected challenge will derail a much larger project. It’s gratifying to see our components make it into so many other robots that we do not make, which is especially common now with Kickstarter-type projects.
The same strategy is in play with the encoders, where we tried to develop an intermediate product that would be useful on its own while serving as a stepping stone toward our bigger goals. That is one reason we made the PCB fit within the motor profile, with the half-hole pads along the edge. The idea was that this would make the motor with encoder a module that could be soldered directly onto another main PCB, the way the motors are on the 3pi robot.
However, I wasn’t quite happy with that solution since it required an extra PCB, and I kept looking for ways to get an encoder on these motors without needing any intermediate circuit boards. One avenue we pursued was with U-shaped, slot-type IR sensors. These were quite common on computer mice when they still had balls and rollers instead of cameras, and an encoder wheel blocking a light beam should give more consistent results than a wheel reflecting some light. I found a few sensors small enough for the motors, and we injection-molded some encoder discs:
Prototype encoder wheels for interrupter-style sensor solution for micro metal gearmotor encoder.
The solution was still somewhat unwieldy from an assembly perspective since the U-shaped sensor locked the encoder disc and motor into position. I am sure we could have made this work somehow, but I also wanted a solution that would not be too complicated to assemble since I want to have kit versions of our robots.
So we continued exploring other avenues. Many of our larger gearmotors are available with magnetic encoders, so we started exploring getting our own custom magnetic discs made, in the hopes that we could make this kind of arrangement work:
Pololu magnetic encoder concept drawing.
As I hope you have guessed if you have read this far, we now have those magnetic encoder wheels available! It will still be a while before we have them integrated into a robot with built-in encoder support, but as usual, we want to make these components available for others to start using in their own robots. We have also made small boards like the optical encoders so that people looking for encoders without designing their own PCBs can get up and running right away; these are available with the magnetic discs in our new magnetic encoder pair kit. We got some negative feedback about the difficulty of soldering to those half-holes on the edge of the PCB, so we decided to make these new boards a little bigger and include full holes. (If you want that flush-mount option, you should be able to get it by grinding off a bit of the board.)
Magnetic Encoder Pair Kit for Micro Metal Gearmotors, 12 CPR, 2.7-18V (old version).
One of the great features of the new encoders is that the hall effect sensors they use have built-in circuitry to provide hysteresis and digital outputs, which can connect directly to a microcontroller or other digital logic. Check out that beautiful quadrature!
Encoder A and B outputs of a magnetic encoder on a high-power (HP) micro metal gearmotor running at 6 V.
As we continue working on these, we expect to update the product pages with sensors we have verified work and with the proper geometry of the sensors to make the 3pi-style motor mount work.
Magnetic encoder test board for sensor geometry evaluation.