![]() |
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! |
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). |
Re: Encoder Wiring Help Needed
Quote:
|
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.
|
Re: Encoder Wiring Help Needed
Is there a point to access both channels?
|
Re: Encoder Wiring Help Needed
Quote:
|
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?
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
Code:
Encoder(UINT32 aChannel, UINT32 bChannel, bool reverseDirection=false, EncodingType encodingType = k4X); |
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
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.
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
I dont recall doing that, but no it wasn't to your two part question.
|
Re: Encoder Wiring Help Needed
Wait...
I just found a different class module (GearTooth class). This one accepts one channel. So it does support counting one channel. I suppose you can connect the A channel to one digital input and use the GearTooth class to access the count. |
Re: Encoder Wiring Help Needed
To honest with you I know nothing about code. The most i know is that we use Java lol. I'm more of a mechanical/ electrical guy.:rolleyes:
|
Re: Encoder Wiring Help Needed
Interesting...
From reading the source code of the GearTooth class, it seems the GearTooth sensor can even tell the direction. It supports different pulse widths on different directions. I wonder how does that work? But I am sure it is only specific to the GearTooth sensor. If you use one channel of the optical encoder, since the pulse width doesn't change in both direction (except for changing speed), it cannot decode the direction from the pulse width. |
Re: Encoder Wiring Help Needed
Quote:
http://www.chiefdelphi.com/forums/sh...d.php?t=101587 |
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
|
Another issue with encoders to keep in mind is the "sense" of forward and backwards. Especially if using the encoders with jaguar PID loops, but even with cRIO PID loops, the encoders need to be increasing when the motor is going forward, and the control input sense of forward needs to match the encoder. And the jaguar's sense of positive voltage needs to match also. You may need to reverse the A and B lines of the encoder, or the polarity of the motor, to get these things all having the same definition of "forward". If you add limit switches to the mix, the forward and reverse limit switches must also correspond.
|
Re: Encoder Wiring Help Needed
Quote:
Thanks guys.:D |
Re: Encoder Wiring Help Needed
Not sure where to go. I have wired these encoders using the 2 channels on the sidecar. When I do, the robot goes nuts. It spins one side drive backwards and the second side does nothing and never works. Have wired +5, gnd, signal A to first channel and signal b to second channel on both sides. Anyone have an explanation as to what is going on.
|
Re: Encoder Wiring Help Needed
Quote:
For you Labview programmers only interested in looking at one input to count pulses to determine the rate of rotation, the WPI counter library works great. Just make sure you take the time to read the help file on the counter VIs thoroughly. When I got to the shop earlier today the team programmer complained that the software based counter he had built couldn't keep up at high motor speeds. I explained how the FPGA offloaded this work to the hardware and the counter VIs in the WPI library took advantage of this capability. We tried them and they worked all the way up to the 4000 RPM speed with no problem. We found it helpful to use one of the low-pass filters from the PID library. |
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
Quote:
Quote:
Quote:
|
Re: Encoder Wiring Help Needed
Are you supposed to wire the encoders to the sidecar or the Analog Breakout?
|
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
I'm on the same team as gnichols.
The encoder is wired into 2 digital I/O ports on the digital sidecar, with careful attention made to plugging in gnd and signal to one port and 5v and signal to other port. The hardware connection is correct. With the encoder wired, when the code is enabled, and in teleop mode, the motors start to run, with no joystick input. With the encoder unplugged, everything works as expected, with no movement until the joystick is moved. We are using C++ and this happens even when deploying the FRC Default Program (current with imaging tool), which when loaded into workbench is titled BuiltinDefaultCode. That code does not explicitly reference digital input ports or the encoder classes at all, neither does the custom code we have created when first discovering this problem. One other problem we are having is that the signal light we have connected to the digital sidecar is not lighting, though the small led on the sidecar next to the DSL port is lighting. What voltage should we see there? |
Re: Encoder Wiring Help Needed
We are also having encoder issues. We have the E4P wired as described in the previous posts (2 digital IO ports using PWM cables - one has signal A, +5, GND and the other signal B). I've checked the output with a multimeter - the +5 and GND are good (the red light on the encoder is on) and when I slightly move the wheel I can see the A and B channels vary from 0 to 5v. When the motor is moving the voltage of the A and B channels is 2.5-2.6v. In the software, we create an Encoder - assign the ports in the constructor, but when we output distance, rate, or raw when motor is moving we get 0 for all. I triple checked the port numbers (tried 1,2 and 7,8) but no joy.
One thing I wonder about... is that the our motor shaft is slightly less than 1/4" so we had to crimp the encoder wheel slightly. I wobbles ever so slightly when the motor turns. Could this be it? |
Re: Encoder Wiring Help Needed
Quote:
Are the BAT, 5V, and 6V LEDs lit? |
Re: Encoder Wiring Help Needed
Quote:
|
Re: Encoder Wiring Help Needed
I'm going out on a limb here, but have you guys (gnichols, alb4h) checked your DB37 cable assembly as per FIRST's directions?
If the problem persists, I would suggest posting copies of your code and pictures of the relevant connections so it's easier to isolate the problem. |
Re: Encoder Wiring Help Needed
hello all,
my team (1325) is still unsure as to the wiring of our E4p encoders if anyone could supply a diagram that would be great! Thank You |
Re: Encoder Wiring Help Needed
Quote:
In short, connect encoder common, power, and output A to (-), +5, and signal of one DIO on the Digital Sidecar. Connect encoder output B to the signal of another DIO. |
Re: Encoder Wiring Help Needed
Quote:
Fixed the problem... you need to call encoder.start() before you get any readings. Also, the disk does wobble slightly but it's well within the tolerance of the optical reader. Another poster did suggest a better idea of using paper or plastic shims, but crimping the wheel (ever so slightly) was actually on the manufacturers instructions. We are reading motor turns - yeah! |
| All times are GMT -5. The time now is 05:45. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi