Swerve encoder problem, we need your help

Hello I am from team 5987 Galaxia in memory of David Zohar, this year we are trying to build swerve, if you want to see the design you can click here.

We can’t connect our encoder to the talonSRX because we are missing analog breakout boards and our encoder can’t send PWM so we can’t solder it into our talon, so we wanted to ask if you know any ways we can connect the encoder into the talon without analog breakout board.
Thanks for your help.

1 Like

You could always connect your encoders to the analog inputs on the Roborio, however you will only be able to connect 4 encoders. You would have to run the PID control loop on the roborio.

Do you have the Talon encoder cables (grey ribbon cable)? You could cut that and splice the specific wires to the wires of the cable that came with the encoder.

1 Like

That sound really promising, Do you know which cables we need to splice in the ribbon cable in order to do so?
Thank you very much for your help.

Here’s the connector pinout from the Talon manual. Do keep in mind that your analog encoder would have to work using 3.3V instead of 5V (the breakout board includes a resistor divider).

1 Like

Thank you very much. :smiley:

1 Like

We had a similar issue this year: we wanted to use mag encoders but didn’t have Talon SRX. So, here’s a guide I made to explain how to modify the grey ribbon cable. I’m glad to know I’m not the only one who tried to do that. And I hope this will help you because I really struggled to figure out which cable matches which pin.

English version: Connect a Mag Encoder with the Roborio.pdf (752.2 KB)
French version: Connecter un Mag Encoder avec le Roborio.pdf (752.8 KB)

@Romi You said the encoder should use 3.3V instead of 5V. Is this true for the Mag Encoder too ? (If it is I should modify my guide)

1 Like

If the mag encoder is connected directly to the talon, it should be fine. The guide you sent also looks good. According to the mag encoder manual, it needs 5V. The issue is that for other analogue encoders, without a breakout board, the Talon SRX can only get signals up to 3.3v, the Roborio can handle signals up to 5V.

It looks from your module design thread that you are using a MA3 absolute encoder for steering position, and I assume these are the encoders you are asking about since the drive appears to be running with a Falcon and the integrated controller/encoder.

If you are using MA3 encoders, they need a 5V input to operate. I don’t believe that you can power them with 3.3V. This would mean powering them with pins 2 and 10 from the Talon SRX data port. The output from the encoder needs to come in to pin 3 on the data port, but it has to be scaled from 5V to 3.3V first. If the encoder output is not scaled, the Talon will not be able to read voltages from 3.3V to 5V so encoder positions from 238 degrees to 360 degrees will all read 238 degrees and swerve steering will not work. I’m not sure if a pin 3 voltage above 3.3V could damage the Talon, but even if it does not, the voltage scaling is necessary for proper operation.

To do the scaling without a breakout board that has integrated scaling circuitry, you can use a voltage divider made from resistors. With resistor tolerances and a finite selection of resistor values, it will be hard to scale exactly from 5V to 3.3V, but you should be able to get close enough to create something workable. You may want to look at an online voltage divider site to get some ideas on the voltage divider circuit and possible resistor values. If you could get R1 = 1000 ohms and R2 = 2000 ohms, you ought to be in the right range.

As others have mentioned, the 5V to 3.3V analog signal scaling needs to be addressed to connect to the ma3 to Talons SRX. In 2018 we used the CTRE analog breakout boards to connect the ma3s to our Talon SRXs for our MK1 modules. They worked quite well. I would recommend these if you can get them.

Another option is to wire the ma3s directly to the analog input ports of the RIO. This is what people typically do with the SDS MK2 modules. However, programming is a bit more complicated when not taking advantage of the onboard Talon PID.

1 Like

We tried connecting the resistors today after the we connected the ribbon cable to the encoder. We connected the resistors on the cable of pin 3(analog input) but we havn’t got any signal from the encoder the other 2 cables were connected to the ground and 5V. Do you have any idea why it didn’t work?
Thanks for your help

We have only 3 analog breakout boards from previous years and we want to connect the fourth encoder to the talon due to the fact that the talon pid loop iterates once every 10 milliseconds and the roborio code iterates once every 20 milliseconds which isn’t very significant, but this was the reason we used talonSRX instead of victorSPX

We’ve used those the past 3 years. They’re awesome for the MA3 encoders.

Also whenever someone mentions the MA3 encoders, I always link this: How to measure angles larger than 360 degrees by MA3 encoder? - #12 by retrodaredevil

That talks about how you won’t be able to do the PID for the MA3 encoders on the talon themselves because the signal makes a huge jump when it loops around. So you’re going to have to do the PID for MA3 encoders on the roborio either way.

I’d say, hook them into the talon if it’s more convenient, otherwise, hook them into the RIO.

We have two encoders on each of our swerve modules. The MA3 encoders “zero” our quad encoders, then we use the Talon’s PID control with the quad encoders. We could have a single MA3 on each swerve module and do the PID on the RoboRIO, but we’ve decided to stay consistent with what works.

1 Like

Not sure what you may have already tried for troubleshooting. Hopefully you have access to a multi-meter.

Are you sure that you understand the mapping from the 5x2 pins in the data port to the 10x1 wires in the ribbon (i.e. have you attached to the correct ribbon wires?)

Is pin 2 from the data port ribbon connected to the orange wire on the MA3?
Is pin 10 from the data port ribbon connected to the brown wire on the MA3?

Is one end of R1 connected to the blue wire on the MA3?
Is the other end of R1 connected to pin 3 on the data port ribbon?
Is one end of R2 connected to pin 3 on the data port ribbon?
Is the other end of R2 connected to the brown wire/pin 10 junction?

When powered, is the Talon putting out +5V between pins 2 and 10 on the data port as measured with a multi-meter in voltage mode?

If you have small enough probes on the multi-meter (or can tape pins to the probe ends), check for +5V between the orange and brown wires on the microconnector that plugs into the MA3 (microconnector removed from MA3, ribbon cable plugged in to Talon data port, Talon powered).

Are the pins straight on the MA3 end of the microconnector such that they insert properly into the microconnector plug with the wires?

With the microconnector plugged into the MA3 and the Talon powered, check the voltage output between the blue and brown wires using the multi-meter. You may have to touch the multi-meter probes to the blue and brown wires where they are connected to R1 and the ribbon cable respectively. The voltage should vary between a few tenths of a volt and 5V as the encoder shaft is rotated.

Is there voltage between the end of R1 attached to the ribbon and the end of R2 attached to the ribbon? This voltage should vary from a few tenths to 3.3V as the encoder shaft is rotated.

1 Like

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