So recently I’ve been working on designing a swerve drive, and I’m at the point where I need to make a decision on what encoder I want to use for steering. The two main options I’ve looked into have been the CTRE Mag Encoder and the MA3 Encoder. My team has not had experience with any of the two encoders. From a design perspective, the MA3 seems better since it is significantly simpler to mount and a little more compact, but unfortunately I do not know much about the programming aspect of the encoders, so I can’t make a confident decision here. Any help here is appreciated. Thanks!
Both the MA3 and the CTRE Mag encoders are very good. The CTRE encoder supports both quadrature and absolute modes, while the MA3 only supports absolute information. This shouldn’t be an issue, as you’d be using an absolute encoder for both.
The MA3 encoder has a set of analog outputs. This means that it is typically wired to the RoboRIO, although the Talon SRX does support analog sensors using a breakout board. The primary benefits of the MA3 are the easy mounting and rigid coupling to the system. Additionally, there is no sensor drift using the MA3, but there may be mechanical drift if the mounting is not secure.
The CTRE Mag encoder has the same 10-pin I/O as other CTRE motor controllers, so they are “plug-and-play” with regards to using builtin motion profiling software on those controllers. This can be very convenient if you want to use builtin libraries. While the lack of a mechanical coupling means there is no risk for mechanical drift on the sensor, if the depthing of the magnet is improper, there is risk of electrical drift while the robot is powered off. Therefore, you have to be able to precisely depth and adjust the magnet for the CTRE encoder if you want to fully take advantage of its benefits.
I’m a big fan of the Lamprey encoder that 221 Systems came out with just before the 2020 season kickoff. It packages well for applications like a swerve module. AndyMark also sells it.
Nick: Have you seen the “resetting” issue with the Lamprey and did you remove the 2 pins per this post: Problem with Lamprey Encoder Resetting?
We only tested our modules with the Lamprey for a brief time and did not encounter the issue, but we elected to not go swerve this year, but plan to get back to testing them soon(ish).
Since CTRE came out with the Hex Bore Mag Encoder Housing just before this season began, these have become our go-to encoder for everything. We were already using Talons for motor control, so it made sense. Now that it’s easy to position the encoder on a shaft and the housing keeps the magnet in the perfect position all the time without worries about depthing, there’s just nothing else on the market that compares. No mechanical or electrical drift, very accurate, and direct I/O interface with your Talons. Combine this with CTRE’s other advantages (Motion Magic, for instance, which makes programming PID loops much easier) and you have a system that will give you the best possible use out of your encoders.
I’ll look into it. Thanks!
I really like the Lamprey encoder. The hollow bore magnet is a godsend.
I was referring to the mag encoder itself as being incomparable, but okay, I’ll bite. Rev’s hex bore encoder has nowhere near the ease of use or functionality of the CTRE encoder mounted in the hex bore housing, in hardware but especially on the software end of things. So no, it’s a similar but by no means comparable product in my experience with using both. And the 3D printable mount for CTRE encoders is lovely…if you have a 3D printer, which a lot of teams don’t have, ours included. I’d be very interested to see if it has the precision of CTRE’s housing, but since I can’t print one to test that, I’ll have to leave it to others.
If your team is completely in the CTRE ecosystem, sure. However, that’s not the case for every team, and while the REV product is a bit more difficult to hook up to a Talon or a Spark MAX in brushless mode, the REV connector is far more durable (we used the CTRE hex bore this year and damaged 3 Mag Encoders and about as many cables, and although most of that was just poor mounting, the orientation and profile of the REV connector means it wouldn’t have been damaged there). It’s also easier to connect to the RIO, which means that the absolute position can be read and used to seed a Falcon 500 or NEO/NEO 550 integrated encoder (This actually means that the REV encoder is easier to use with the flagship CTRE motor in this particular application). Another benefit of the REV Hex Bore Encoder is the zero mark on the housing, which means that every swerve module can be zeroed the same, so you don’t need to keep track of that in code and can easily swap modules if needed. Also, REV has pretty much hit software parity and has an equivalent feature to Motion Magic.
To bring this thread back on topic, I haven’t seen either of the hex bore encoders used in this application - they tend to be too large to package well. The MA3 and Mag Encoder can both connect to a Talon SRX and work well in absolute mode. One thing to consider is that the Mag Encoder needs a lathe or clever 3D printing to put the magnet in the shaft if you can’t make the housing package, which might not be an option for every team.
Another option that hasn’t been mentioned here is the CANCoder, which is probably the best option if you plan to use a Falcon 500 for steering, since the Falcon can use the sensor output as if it was connected by the 10-wire cable in absolute mode. It also has a configurable zero, which solves the issue of needing to zero every module in code. This is the same sensor as the Mag Encoder, just connected over CAN, so does have the drawback of needing to mount the magnet or use the housing.
At this point the Lamprey seems like the best option for swerve. It is really compact and the hollow magnet bore makes it super easy to integrate with module steering. BTW, the current plan is to drive steering with a 775.
Definitely get a 3D printer, it’ll save you way more money in the long run than almost anything. $10 for a hex encoder housing isn’t bad, but it could be < $1 if you print it.
I’ve had some poor experiences with the MA3 in the past, but my experiences seem to have been the exception and not the rule. Mechanical robustness and incorrectly counting turns are what I’ve seen before.
More importantly, the MA3 is a 5V device, whereas the Mag Encoder is a 3.3V device. This means that the former needs a 5V to 3.3V converter to attach to a Talon SRX if you use it in Analog mode. If you use the PWM version, you can use the pulse width input of a Talon SRX without problems. The Mag Encoder will be natively compatible with the Talon SRX without needing any breakout boards or special wiring.
My vote is for the Mag Encoder due to lower price, mechanical reliability, and ease of use with a Talon SRX. If you’re plugging the encoder into the RoboRIO, however, the analog on there is 0-5V IIRC, which means it will be pretty easy to use the MA3 and capitalize on the shafted interface and analog output.
Yeah, we’re working on it, but we’ve had…issues. The big one is that we’ve spent the last two years working out of what’s basically a storage closet at our school while our new building was being built, so we’ve had no room to speak of. We lost our old workshop (which had been the school’s woodshop once upon a time) to the construction. We’ve been promised a new shop room in the new building, but we’re still waiting to find out exactly how big it’s going to be and thus how much space we’ll have. There are several space-occupying tools that we’d like to add (especially as we’ve gotten some grant money for that purpose this year), but it all depends on where we can put them. Our big purchase this year was something that’s been on the team wish list for three years: a MIG welder with an aluminum setup, and boy howdy did we have fun finding a space to keep it (and it’s mobile.) We’d love both a good 3D printer and a CNC router, as well as a cut-off saw and maybe even a small table saw, but stationary tools were just out in our current space. If we have the room in the new shop, it will be all those, but if we’re tight for space I’ll be letting the team vote to see which things we choose. It’s their robot, so they need to decide what they most need to build.
Second the mention of the CANCoder. We used them for our flywheel, and the accuracy of the sensor gave us some of the most consistent shooting speeds. They are extremely easy to use, and are easy to access. Only difficulty is that you must solder each unit, but thats a one time thing.
If you use an AM-3495 to hook the MA3 to a Talon, then no conversion is necessary. The AM-3495 has a jumper setting to rescale the 0-5V analog to 0-3.3V. It also insures that ALL the inputs are 5V tolerant.
This is an additional $18 cost on top of the $49 for MA3 + cable on Andymark, for a total of $67 vs. $40 for an SRX Mag Encoder.
I’m a little confused on how these encoders work with motor controllers. Could I just hook up the MA3 to a spark Max and run the control loop on the motor controller? Or does it have to go to the Rio? It looks like the MA3 encoder cable wouldn’t fit in the spark.
You would need to break out the Spark Max data port and then convert the 5V signal from the MA3 into a 3.3V one. Does the Spark Max support analog input as a closed-loop option?
You might be better off doing the control loops on the RIO.
I believe you can get a breakout board from rev to do this.
Here’s the link:
It does support closed loop control on the analog sensor, and the breakout board has a built-in 5V to 3.3V amplifier circuit.