4272 Shaft Encoder (And maybe a few other PCB designs eventually)

I’ve hinted at this project in a couple other other threads and there were a few teams interested. Thought it would be fun to share our work.

Last year we ran a CANcoder on our swerve module. It worked well (no issues) but it added another 4 devices to our CAN bus, and required a 12V input. That adds a lot of wires to the robot, and we felt that there was room for improvement.

While digging into the features of the SparkMax, we found there was a seemingly underutilized feature where there was a 0-3.3V input and a 3.3V power output. This seemed really convenient since the Spark Maxes are always mounted near our Neos. The problem is there were no 3.3V analog output absolute encoders on the market (kinda).

We also had a student interested in PCB design and a mentor excited to teach it. This seemed like a really neat project to take on.

Link to design

The idea here is that 3 wires can be soldered on (with some strain relief built in) and then connectors can be added to the wire. We like using Molex SL connectors. We have also been working on a custom Spark Max breakout board (will release once we are 100% happy with the design).

All said and done, we have a Spark Max breakout board that is held on by M3 screws to our Spark Max Mount. Then only 3 wires go to the Spark Max. You can see the clean solution below.

As far as testing…we have made 1 that works, and mounted it to our spare swerve module. We haven’t run it on the robot yet (mostly due to our programmers having other priorities). It works great on the bench though, and we are fairly confident it will work fine on the robot.

As an added bonus, the total cost of 1 complete encoder (assuming we don’t mess up with the soldering) is $6.07. Still requires the CTRE case, so total it is $12.06 with the case and magnet.

If a team likes this concept, but custom PCBs are too much, there is a way to do something similar with COTS parts. The Rev Spark Max Breakout allows for a 0-5V analog input. The TTB Encoder should be able to interface with it. This still requires a little soldering, but far less than a custom PCB. We considered this solution (even tested it out a bit). Our solution we think is a little bit cleaner over all, but took a lot more time.

Feel free to reach out with any questions.

25 Likes

Well. Time to show-off/open-source the rest of our designs. Very proud of our students - All this open sourcing took a lot longer than usual :slight_smile:

Spark Max Breakout and Mount

This is our solution to make the SPARK MAX easier for us to use, and hopefully more reliable. Inspired by the REV Mount, this is intended to allow easier interfacing with the data port. We also added zip-tie mounts for the encoder and can plug to add more mechanical retention. It has the same bolt pattern as the REV Mount. The model can be found on Printables.

image

This is designed to interface with our custom Spark MAX Breakout PCB. This gives us 3 sensor inputs on the Spark MAX. We get to use the:

  • 0-3.3V analog input (3 pin Molex SL)
  • Limit switch input (4 pin Molex SL)
  • Alternative Encoder (5 pin Molex SL)

Our team already standardizes to Molex SL connectors, so this makes it really easy to add sensors to our SPARK MAX. Because we usually mount the motor controller near the motor. This means we have a ton of points on our robot to attach as sensor and get that data on the CAN bus. Because the PCB mounts with M3 bolts, we think this is going to be a very reliable connection on our robot. The latest version of this board hasn’t been tested quite yet, but we have some on order.

image

MXP Breakout

Our team generally makes a custom MXB board for our roboRIO with a perf-board every year. We want all low-power connectors to be MolexSL connectors, which is why we do this. We decided we wanted to be extra-fancy this season and design a more professional looking setup with more options. We added a place to put an LED on each of our digital inputs so we have a quick visual on what’s going on. We also made sure each pin was select-able between 3.3V and 5V with a 0 ohm resistor. This was probably our most advanced PCB of the season, and it turned out pretty impressive. We are excited to use this for 2023. Note: we haven’t built a prototype of this board, partly because it is expensive, and partly because we ran out of time. We are doing many checks and are fairly confident it will work, but haven’t gotten to test it. Plan to place our order on kickoff to be compliant with the rules.

MolexSL Power Breakout

Our final, and simplest board, is a simple power breakout (using Molex SL connectors). We have had several situations where we need to break out 5V power to a few different sensors. This seems like a nice solution here. Haven’t tested this one either, but it’s simple enough we feel pretty good about it.

image

All of the KICAD files for everything are on our team Github. Feel free to reach out with questions.

13 Likes

While I am by no means an EE, I am a hobbyist that has dabled into this realm and understand the learning curve and effort it takes to get there. Thank being said, well done to the students and those that helped them make this a full reality. Congrats!

1 Like

We made an update on the encoder based on Rev’s news saying the Spark MAX would be able to do Position PID on an absolute PWM input.

The AS5600 encoder chip we are using the ability to output PWM, but that requires configuring it with the i2C port. We added test points to our board to make it easy to program, and now can configure it with the programmer in this kit. You could also do this with an Arduino, but the GUI with this programmer makes things easy. The programmer works great with the included dev board, and also seems to work on other products on the market that use the AS5600.

This should give is a really nice position feedback on our SDS modules, and it keeps the wiring nice and clean.

5 Likes

I wonder if anyone has tried using this (from Amazon)?

Same chip. Good chance it will work fine.

I bought some of these to mess around with a bit now that I have the programmer.

2 Likes

Not that the AS5600 does not do 0-100% PWM, it’s more like 1-99%. You have to check the datasheet to see the exact waveform.

Also, those breakout boards will need R1 and possibly R4 removed. R4 puts it in programming mode with no output, and R1 puts it in 3.3V mode.

1 Like

We’ll have to wait and see if that is acceptable with the new REV firmware. Don’t have enough details about it yet, other than it exclusively requires PWM input.

We’ve been running everything in 3.3V mode so far (and that is also how our encoder is configured).

Based on the warning message here, im hesitant to try anything with 5V on those pins. Yeah…it will work, but it seems too easy to damage the Spark MAX.

1 Like

…given the inconsistency reported in getting the configuration saved to the sparkmax, definitely going to heed the warning and stick to 3.3v. Thank you!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.