SPARK MAX - Firmware Release v1.5.0 - Alternate Encoder & USB-to-CAN Bridge

Ok, thanks for the info. Is there a method for setting hard limits in software using a limit switch plugged into the Rio?

Yes, you would create two CANEncoder objects in your code, one using GetAlternateEncoder() and one using GetEncoder().

1 Like

Absolutely. Nothing special or unique to our APIs or firmware. You would just need to write logic in your code that disables movement when the limit switch is triggered.

Oh ok. I was more asking if there was a “Method” in your api for setting it with a single line but I can work with that for sure. Still very worth it to have that external encoder support.

Note also that if you’re interested in reducing long wiring runs, you could connect the limit switch to a CANifier or similar device on the CAN bus. Unless the alternate encoder software supports external CAN limit switches, you’d still have to write code for it.

Great, we were waiting for this :blush:
Can we use absolute encoder with pwm signal output? e.g Ma3-p12-250-b?
12 bit pwm signal… 4mSec cycle, 1uSec resolution
Thanks

1 Like

We are looking into this feature and you can check its progress on our public Trello board under: Timer-based absolute position sensor support.

1 Like

Is this release compatible with the roboRIO beta image? Just want to make sure before updating all our motor controllers.

Yes, it is. Make sure to have all of them up to 1.5.0, update the vendordeps and you’ll be good to go.

1 Like

Note that the 1.5.0 API has not yet been published yet for beta 4, we should have it ready by Monday, this will include a few of the changes for 2020. The released beta API will work for now with 1.5.0.

1 Like

Is there a way to configure a remote alternate encoder that exists in the CAN bus, such as a CANCoder or an encoder wired to a CANifier when a Spark MAX is in brushless mode?

1 Like

We do not currently support remote CAN encoders in any mode on the SPARK MAX. Below is a summary of the encoder possibilities as of firmware version 1.5.0:

  • Brushed Mode
    • 0 encoders
      • Run any compatible brushed motor open-loop.
    • 1 external encoder
      • Connected to the front 6-pin Encoder Port or the top 10-pin Data Port in its default configuration.
    • 2 external encoders *
      • 1 encoder connected to the front 6-pin Encoder Port.
      • 1 encoder connected to the reconfigured Data Port in Alternate Encoder Mode.
  • Brushless Mode
    • 1 internal encoder
      • Internal NEO Hall effect sensor connected to the front 6-pin Encoder Port (required).
    • 1 internal + 1 external encoder *
      • Internal NEO Hall effect sensor conencted to the front 6-pin Encoder Port (required).
      • External encoder connected to the reconfigured Data Port in Alternate Encoder Mode.

If your application requires additional encoders or a different configuration, you can always connect the encoders to the roboRIO.

*Internal control loops can only be configured with one feedback device at a time. In Brushless Mode, the motor commutation is always using the internal hall effect sensor regardless of the configured closed-loop feedback device.

2 Likes

Do you have an update on a board that will allow the Through Bore Encoder to interface with the Data Port on the Spark Max?

1 Like

The encoder comes with a cable to plug it into the JST port if you’re using a brushed motor. For brushless, you should be able to plug the A and B lines of the DuPont style cable into the limit switch pins of AM’s breakout. You will also need to plug in the analog cable so it has power, since only signal and ground are exposed on the limit switch pins.

In the future, it would be great if REV (or someone) sold a “crossover cable” for 10 pin encoders that would change the pins over for preexisting boards with those ports.

I don’t have an update yet. We hope to have it ready to go very early in the 2020 build season.

In the mean time you can do the following:

  • When in Brushed Mode
    • Plug the Through Bore Encoder directly into the 6-pin Encoder Port on the front of the MAX like @bobbysq mentioned.
  • When in Brushless Mode and configured for Alternate Encoder Mode
    • Use one of the many available breakout boards (REV, AM - linked above, etc.) to connect the Power, Ground, A, and B wires to the appropriate Data Port pins as described in the User’s Manual here.

We originally looked at creating a crossover cable (the ‘swizzled’ ribbon cable I mentioned before), but it wasn’t feasible.

1 Like

Good morning. We’re trying to use two Sparkmax plus with NEO Brushless motors mounted on the same Gearbox (Andymark Toughbox mini)
The idea is to mount an external encoder to the GBox in order to run the motors in position mode.

This would probably require to run one of the motors as master and the other as follower.

My questions are:

  • Is this setup feasible?
  • Do we connect the external encoder on both Spark max controllers or just one?
    Do you have any advice on this?

Here is a graphic of how we could connect.

The idea is to mount an external encoder to the GBox in order to run the motors in position mode.

Why not just use the NEO’s encoder to do the position control? Why do you need the external encoder in the first place?

Regardless, if you choose to use an external encoder for the position control, it only needs to be connected to the SPARK MAX leader. Make sure to follow the alternate encoder bring-up procedures that REV has documented here.

It it’s something that requires precision, the through bore encoder would be a lot better. The internal NEO encoder isn’t that good as it’s only 42 count per revolution. If it’s something that requires greater precision like a swerve or a turret, then the external encoder would be better suited.

1 Like

It depends on gearbox reduction, amount of moving mass, and target length of travel - but there are certain scenarios where a higher resolution is necessary for basic control. For example, to rotate the final end effector by 12 degrees, with a 10.71:1 toughbox the motor would rotate 128 degrees, or only 15 ticks of the NEO encoder. This would be very difficult to tune by itself. The encoder that is directly attached to the shaft would give 136 ticks for a 4096 tick/rev encoder in that scenario. However, that scenario can also be solved by using a higher-reduction gearbox like 100:1 total reduction (which would then also provide greater mechanical response overall for an arm, depending on the mass).

It is possible to set one NEO to follow a ‘master’, and then control the ‘master’ from code. In this case, you would want to run all code against the master controller. Only the master needs the external encoder connection if you’re running the code from the robot. If you want to tune 2xNEOs at once from the REV utility, I have heard that it is best to set the MAX’s up in code (master/follower, encoder config, etc), run the burnFlash() method on both controllers and then plug in the USB cable into the ‘master’.

1 Like

Neo’s encoders are on 42ppr, which is limiting.
We’re running bench tests to see what are the possibilities and limitations of the Sparkmax controller with or without external encoders. Since documentation is limited to minimal details on the subject, we need those tests to determine our options for different sections of the robot.

Running master slave systems, is something I regularly do in the industries. But it does need to be done right.