Connecting a Magnetic Encoder and a Hall Effect to TalonSrx

Hi all, we are trying to figure out how to connect a magnetic encoder to a fwd and revs hall effect. Do we have to use a Breakout board for the 5V input? Because the hall effect uses 5V input.
If so how do we connect it to a breakout board?

For sure, you want the 5V to come from the Talon (you didn’t say explicitly, but it looks as though you are using a Talon SRX). I don’t have one of these handy, but it looks as though you’ll have the Talon SRX, a cable, and the encoder. Given this, I’m not sure where you’d plug the breakout board in – you’d need a cable with three connectors on it, or a pass-thru connector somewhere.

Someone who has these on hand will be able to say for sure but, if this is correct, I’d look for somewhere on the encoder to solder a wire to get the 5V. Failing that, you should be able to use two breakouts and two cables – the idea would be to wire the two breakouts back-to-back, so that each signal is wired to the same signal on the other breakout. This would effectively be a tap, just to get the 5V out (you could also get GND and the limit inputs here).

Your question reads like you want to connect a sensor to a sensor. If what you want to do is use the SRX encoder to measure speed and use the Hall effect sensors as limit switches, you certainly could do it as @nuttle suggests, but if you have a custom circuits breaker on your PDP, I’d recommend using a small 5V regulator tapped from it to provide voltage for your sensors. This one’s under a buck, and there are even less expensive ones out there. I find these things quite useful for non-robotics projects as well, and keep about a dozen in my parts box. Note that the heat sink tab (which you won’t need for a couple of sensors, but will if your draw gets above a 100mA or so) is grounded, so insulate it from the metal of your chassis!

@GeeTwo sorry for not being clear enough, we want it to connect to a TalonSRX.
Edited title accordingly

@nuttle Yeah, breakout to breakout is indeed what we need to do, I don’t know why I did not think of that. We can use this right? We don’t have the other one if I remember correctly.

Btw the only way to extend a short Gadgeteer Data Cable is using this or two breakout boards right?

The breakout you use has to have all the pins (or at least the ones you want to tap plus those needed to connect the sensor). The kit for making your own cables (the one you linked) might be a good option, you should be able to put three connectors on a single cable, just pay attention to the way the connectors are oriented (all should be the on the same side and with the key facing the same way). But, now you’d need one breakout that let’s you get to the 5V.

For using the back-to-back breakouts, you need to ensure 5V makes it through (and be able to tap it). Since the original problem was not having access to 5V, you might have to use the other breakouts. Again, I don’t have these in front of me. I have looked at the documents, but I don’t want to appear to be certain when I am not.

Maybe someone from CTR will confirm – if so, go with what they say. If I were in a hurry, I’d order the other breakout (that exposes all the lines) and the make-your-own cable kit. That should give you full access in a pretty clean way.

What do you mean by “tap”?
The breakout I use has a 5V pin so why wouldn’t it work?
Look at page 23 (24 is the blue one we have)

This can work, but it’s probably not a good idea, especially for a motor controller. I’m sure it’s been done, and maybe it usually turns out OK – I don’t have any data on this.

The trouble is that, especially when you are drawing a significant amount of current, ground isn’t at the same potential everywhere. Let’s say the motor controller is on a 40A circuit and draws that amount. If the negative wiring between the PDP and the motor controller has a resistance of 0.01Ω, Ohm’s law says there’s a 0.4V voltage drop. Since the voltage regulator isn’t drawing nearly as much current, there’s much less of a drop there.

If you connect the grounds, you now have a different path where a lot of current may flow (and this won’t eliminate the drop). If you don’t connect them, the voltage drop offsets the voltages in the voltage regulator circuit. This may be OK, but it probably shouldn’t be legal (in the FRC rule book sense). Depending on the exact numbers, such offsets can put things out of specified tolerances. Also, if the 40A breaker trips, you can have the power to part of the circuit off but still having other parts of the circuit powered up. Sometimes this can cause problems.

OK, yeah that should be good. It looks as though it breaks out 7 lines (of 10 total). The three that are not broken out (according to the docs) are “Quadrature Index”, “Analog Input”, and “DO NOT CONNECT”. If you only need an incremental (not absolute) encoder, with limit switches, this should be fine.

Great thanks!
We do have another system which uses an abs encoder, I think we are using the analog one (see page 11) I will need to check, but then we need to use the analog breakout board?

Probably so. If you do the thing with three connectors on a make-your-own cable, you are guaranteed all lines are connected everywhere, so you only have to be sure the breakout has the lines you need brought out. If you use two cables and two breakouts (“back-to-back”), you have to be sure the lines you need are brought out – plus all the lines needed by the sensor you are using are connected. This means those lines have to be there on the breakout you use.

This chart (from SRX manual) is key:
image

I hope this all makes sense. If not, I can check the exact combination you plan to use.

With the Abs encoder i will only need one breakout board because it doesnt uses data cables like the magnetic one, so I think one analog breakout will be enough(?)

Yeah – I just opened that link. :slight_smile:

Many thanks!!

1 Like

I haven’t been able to find out about the Hall Effect sensor OP is using. The WCP page only talks about magnets. Now that I’m at home, I see that the board pictured only has three pins - the Hall Effect sensor I used a few years ago had separate power and switching due to an integrated optical isolator. This could easily be done here by adding such an isolator for each Hall Effect sensor. That is, the HE sensors and the input side of the isolators would be on the CUSTOM CIRCUITS circuit, and the output side of the isolators would be wired to the solder pads on the encoder board. Here’s a two channel version (meaning it could do both limit switches) with a breakout for $5.

If you do this, remember that most isolators invert your normally open/normally closed sense. The board I linked above includes components to invert back to what you’d naively expect.

Added:

I think someone above said this, but if you use this or the CTRE analog breakout or the AM SRX breakout, it connects to only one of the Talon SRX motor controller OR the SRX encoder. You need the bus to get to both. The Gadgeteer extender doesn’t have any readily accessible solder pads, so unless you’re really into detail soldering, the only breakout answer I know is two of the gadgeteer breakouts.

Also, a bit of history that totally supports what @nuttle said above before I added optical isolation, at least in principle (you have to read a dozen or so posts in to get the story, but FRC changed the rules because of what was apparently a non-isolated control):

1 Like

This is all very unnecessary. The talon can easily supply the sensor using it’s own 5v supply.

Just use 2 of the generic gadgeteer breakout boards from CTRE. Connect all the pins together with short wires. Then connect the limit switch, 5v, and GND pins to the WCP hall effect. One gadgeteer breakout cable goes to the Talon, and the other cable goes to the mag encoder. I’ll draw this up tonight.

Alternatively, just wire the hall effect sensor to a RoboRIO DIO port and manually turn off the motor controller when it is triggered.

EDIT: Wiring diagram

But we can use the blue breakout board I mentioned right? It’s only missing the “Quadrature Index”, “Analog Input”, and “DO NOT CONNECT” pins as Nuttle said…

You would still need 2 of them, right? And because it doesn’t break out the PWM/Index pin, you lost absolute positioning.

Using the basic gadgeteer breakouts will be slightly cheaper and provide more utility.

We made breakout boards with SWD (2x5 1.27mm) Cable Breakout Board : ID 2743 : $2.95 : Adafruit Industries, Unique & fun DIY electronics and kits, not realizing there were official options. But at $3 each times 6 boards we saved a few bucks, and our electronics guy said making those custom circuits was among the more fun things he did this season.

1 Like

Wait, the magnetic encoder supports absolute positon?
btw the wiring can be simplified than what you draw, only 4 pins (GND, 5V or 3V, A CH, and B CH) are needed between the two boards, the HE can be connected directly to the board that is connected to the Talon SRX

Correct, although I believe you need to supply 5V and not 3.3V as per the datasheet.

The mag encoder outputs a 0-4095us pulse on the index pin reflecting the absolute position of the magnet. Presto, absolute position sensing. So you’ll want to connect 5v, gnd, a, b, and I/PWM.