Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   Encoder Wiring Help Needed (http://www.chiefdelphi.com/forums/showthread.php?t=101888)

gurdy2 03-02-2012 18:29

Encoder Wiring Help Needed
 
This is our team's first time using encoders and we are encountering issues as to where on the robot/cRio we should be connecting the encoder wires. If anyone can please help and show what part of the robot we should wire our encoders to (electrically) and more specifically how.

Please Note: we are using the kit of parts E4p encoders for our shooter.

Thanks in advance!

mikets 03-02-2012 18:49

Re: Encoder Wiring Help Needed
 
The encoders in the KOP have 4 wires. +5, GND, A and B. You can connect the encoders either to the Jaguars directly (if you are using the Jaguars as your motor controllers) or to the digital input channels on the digital sidecar.

For connecting to the Jaguar, crimp a 5-pin header connector with the 4 wires ("+" goes to +5, "-" goes to GND, "A" goes to A and "B" goes to B, "I" has no connection).

If connecting to the cRIO, each encoder needs two digital channels. On the first digital channel, "+" goes to +5 (red), "Gnd" goes to "GND" (black) and "A" goes to signal (white). For the second digital channel, "B" goes to signal (white).

nitneylion452 03-02-2012 18:58

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by mikets (Post 1119384)
The encoders in the KOP have 4 wires. +5, GND, A and B. You can connect the encoders either to the Jaguars directly (if you are using the Jaguars as your motor controllers) or to the digital input channels on the digital sidecar.

For connecting to the Jaguar, crimp a 5-pin header connector with the 4 wires ("+" goes to +5, "-" goes to GND, "A" goes to A and "B" goes to B, "I" has no connection).

If connecting to the cRIO, each encoder needs two digital channels. On the first digital channel, "+" goes to +5 (red), "Gnd" goes to "GND" (black) and "A" goes to signal (white). For the second digital channel, "B" goes to signal (white).

Is there any advantage to wiring the encoders one way over the other? I only ask because we used encoders last year and had no idea they could go to the jags.

mikets 03-02-2012 19:00

Re: Encoder Wiring Help Needed
 
If you wire the encoders to the Jags, you must use CAN or you can't access them. The benefits are pretty much the CAN versus PWM arguments such as: cleaner wiring, not taking 2 digital channels per encoder, can optionally use the Jag's built-in PID control etc.

its da PAT!!! 03-02-2012 19:22

Re: Encoder Wiring Help Needed
 
Is there a point to access both channels?

mikets 03-02-2012 19:25

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by its da PAT!!! (Post 1119409)
Is there a point to access both channels?

Don't understand your question. What channels? Are you talking about the two digital input channels? If so, you need two channels per encoder in order to determine the position/speed as well as the direction of the rotation. the FPGA will handle the two channels and give you the resulting count and direction.

its da PAT!!! 03-02-2012 19:27

Re: Encoder Wiring Help Needed
 
Yes that's what I mean. But if you use PWM and use either A or B channel is it less accurate?

Ether 03-02-2012 19:28

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by its da PAT!!! (Post 1119414)
Yes that's what I mean. But if you use PWM and use either A or B channel is it less accurate?

What are you going to use it for?


its da PAT!!! 03-02-2012 19:33

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by mikets (Post 1119384)
If connecting to the cRIO, each encoder needs two digital channels. On the first digital channel, "+" goes to +5 (red), "Gnd" goes to "GND" (black) and "A" goes to signal (white). For the second digital channel, "B" goes to signal (white).

Just as a general question. But I may have miss read he post. Do A and B both go to white or is it one or the other?

mikets 03-02-2012 19:33

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by its da PAT!!! (Post 1119414)
Yes that's what I mean. But if you use PWM and use either A or B channel is it less accurate?

It's not a matter of accuracy, without two channels, it won't know the direction of rotation. Besides, unless you are writing code to "count" the pulses from the one digital channel yourself, the Encoder module provided by the WPI library expects both A and B channels.
Code:

Encoder(UINT32 aChannel, UINT32 bChannel, bool reverseDirection=false, EncodingType encodingType = k4X);

mikets 03-02-2012 19:36

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by its da PAT!!! (Post 1119420)
Just as a general question. But I may have miss read he post. Do A and B both go to white or is it one or the other?

A and B goes to the white of a different digital input channel.

Ether 03-02-2012 19:37

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by mikets (Post 1119421)
unless you are writing code to "count" the pulses from the one digital channel yourself, the Encoder module provided by the WPI library expects both A and B channels.

Are you saying the FPGA running the FRC firmware cannot be configured to count pulses on one channel and make that count available to the CPU? Or just that the high-level encoder class is not designed to do that?


its da PAT!!! 03-02-2012 19:40

Re: Encoder Wiring Help Needed
 
Makes sense to me. My team since i've been involved, never really used anything more than just a limit switch. So I just figured I ask for future.

mikets 03-02-2012 19:44

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by Ether (Post 1119427)
Are you saying the FPGA running the FRC firmware cannot be configured to count pulses on one channel and make that count available to the CPU? Or just that the high-level encoder class is not designed to do that?

I am not sure if it can or cannot. After all, the FPGA is programmable, the firmware can configure it anyway it could. My understanding is that the FPGA implements the counter for the encoders and the Encoder module in the WPI library is expecting both channel A and B. There is no method in the Encoder module that accepts only one channel. So I am making a speculation that it does not support one channel. However, it is probably possible to implement a software counter. But I don't know the innards of the FPGA enough to be able to do that.

Ether 03-02-2012 19:44

Re: Encoder Wiring Help Needed
 
Quote:

Originally Posted by its da PAT!!! (Post 1119429)
Makes sense to me.

You linked your response to my two-question post#12. Was that intentional? If so, not sure what part made sense to you.



All times are GMT -5. The time now is 11:03.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi