![]() |
Encoder problems
1 Attachment(s)
During the preperations for our off season competition I encounterd a problem with our shooter encoder.
At the competition we worked with the E4P optic encoder but when I checked the data after the competition I discoverd it isn't right, the encoder was mounted directly on the miniCIM's shaft that was connected directly to the wheel that spins the shooting belt, at low RPM (to measure RPM I enterd at the BEGIN.vi 1/6 to the distance) the data was good but as we got into bigger range (3000+) the input from the encoder went crazy, sometimes there was a 1000+ differnce between two continous readings. I decided to change the encoder because I was sure that the problem is hardware, we changed it into a AS5145B Magnetic Encoder, we connected the encoder just like the manual and WPI (http://wpilib.screenstepslive.com/s/...control-system) said. I changed the BEGIN again to match it to the example (encoding with 4X mode) but the same problem reacured. I placed the reading from the encoder in the Timedtasks.vi at a different loop with a 100ms delay. Added here is the graph of the rate that I got from the encoder when I gave the motor full power. |
Re: Encoder problems
There are two calculations you should be making when matching an encoder to a task:
1) Calculate the maximum samples per second that an encoder will support. e.g.,
3000rpm/60 = 50 revs per second |
Re: Encoder problems
Thank you for the explanation and information, but, is there a way to read RPM around the range of 4000-6000?
|
Re: Encoder problems
Quote:
1) Calculate the maximum samples per second that the encoders must support.
|
Re: Encoder problems
Quote:
|
Re: Encoder problems
Thank you both very much.
I'll try to change it to a counter and let you know if it worked as soon as i can :) |
Re: Encoder problems
1 Attachment(s)
The FPGA has a 40 MHz clock. The digital inputs are sampled every 261 cycles of the 40 MHz clock: 40MHz/261 = 153,256.705 samples per second per digital input.If edge transitions (rising and falling) occur faster than this on any given input channel, the FPGA sampling will not be able to detect and count them properly. Furthermore, for quadrature decoding, cross-channel edge transitions must be greater than 1/153,256.705 = 6.525 microseconds apart or the FPGA will not be able to determine which edge came first. Example: A US Digital 360 CPR E4P encoder outputs 2*360 = 720 total edges (360 rising + 360 falling) per rotation on each channel. So for each channel, an edge transition occurs every 1/720 of a rotation, if the symmetry is perfect (see attached excerpt from datasheet). When using just a single channel of this encoder as a counter, and assuming perfect phase symmetry, speeds greater than (1/720)/(6.525e-6) = 212.9 rotations/sec = 12,771 RPM would cause a problem for the FPGA1. But the symmetry is not perfect. According to the datasheet, the symmetry across the range of recommended mounting tolerance can be off by as much as 75 electrical degrees. So instead of being (1/720) of a rotation apart, some of the edges in a channel could be as close as (1/720)*((180-75)/180) of a rotation apart. So speeds greater than (1/720)*((180-75)/180)/(6.525e-6) = 124.2 rotations/sec = 7,450 RPM would cause a problem for the FPGA. Assuming perfect phase alignment between channels A and B, the cross-channel edges are (1/720)/2 of a rotation apart. So for quadrature decoding, speeds greater than ((1/720)/2)/(6.525e-6) = 106.4 rotations/sec = 6,386 RPM would cause a problem. However, for this model encoder, the phase tolerance of the the 2 channels is rather sloppy. According to the datasheet, the quadrature delay across the range of recommended mounting tolerance can be off by as much as 60 electrical degrees. So instead of being (1/720)/2 of a rotation apart, some of the edges across 2 channels could be as close as ((1/720)/2)*((90-60)/90) of a rotation apart. So speeds greater than ((1/720)/2)*((90-60)/90)/(6.525e-6) = 35.48 rotations/sec = 2,129 RPM would cause a problem for the FPGA. So as Mark and Joe mentioned in earlier posts, for measuring shooter wheel speed it may better to use just only one channel of the encoder (depending on the encoder and its tolerances). To reduce the signal noise, you should also consider setting the FPGA sample averaging as discussed here. 1the electronics in the 360 CPR E4P are limited to 10,000 RPM |
Re: Encoder problems
I Changed our counter so it will now work with a counter instead of the encoder and I'm taking 20 samples now.
Thank you all |
Re: Encoder problems
Quote:
Quote:
|
Re: Encoder problems
I actually read it but I wasn't sure what to do with that because up until now when changing the average value to around that area helped getting more accurate readings (we compared the data to a Tachometer).
|
Re: Encoder problems
Quote:
Also, could you post a PNG screenshot of the LabVIEW code you use to set up and read the counter? |
Re: Encoder problems
1 Attachment(s)
about the bolded: when we worked with the E4P encoder one of our team graduated member checked with me the parameters in the config timer, when we set the number 21 to Number of samples to average we got the best readings, so I thought it will be the same here.
|
Re: Encoder problems
There is another option you can consider. I did this with a different team than my own and it worked rather well.
We used the closed loop functions of the Jaguar via CAN. We used E4P's in 4x mode spinning at 5K & 6K RPM connected directly to the Jaguar without an issue. The Jaguar is capable of 1M pulses per second. The hardest part was tuning the PID values for the JAG. **They opted to do this because they had Jaguars, & extra E4P's on hand so they didn't require any additional purchases in their tiny budget for this season** |
Re: Encoder problems
Quote:
Why did you choose the semi-period mode? |
Re: Encoder problems
I want to get the RPM, according to the help from the get it is only seconds.
I wasn't sure what to chose that was the one that seemed suited for my needs, I know that I will test it soon to see which one is the right one, but if you could help me it would be amazing |
Re: Encoder problems
Quote:
|
Re: Encoder problems
Quote:
Quote:
Quote:
The LabVIEW example linked below shows how to do that, and how to convert Counter.get to RPM: Quote:
Use your desired FPGA sample averaging value instead of "5". |
Re: Encoder problems
All has been changed.
Thank you very much! |
Re: Encoder problems
1 Attachment(s)
Does anybody know what the default Cycles Per Rev per channel is for the AS5145B in incremental mode? |
Re: Encoder problems
1 Attachment(s)
According to WPI (http://wpilib.screenstepslive.com/s/...control-system) it is 1024
|
Re: Encoder problems
1 Attachment(s)
"The AS5145B is the equivalent of an optical encoder with a 1024 count disc, meaning it will output 1024 pulses per channel per revolution. In 4x decoding mode, this will yield 4096 ticks per revolution." In that context, "pulses" seems to mean "cycles" (whereas US Signal uses "pulses" to mean "edge transitions"). Assuming that is correct, there are 1024 rising and 1024 falling edges per rev on each channel. Let's do the math. There are 2*1024 = 2048 edge transitions per rev on each channel. So the edges are 1/2048 of a rotation apart, assuming the best case of perfect symmetry. So the max speed the FPGA can handle for a single channel of that encoder before it starts to get weird is (1/2048)/6.525e-6 = 74.8 rotations per second = 4490 RPM. So that will not work for your desired 6000 RPM. Use a different encoder with fewer cycles per rev. |
Re: Encoder problems
So I will try again the E4P as a counter.
Thank you very much |
Re: Encoder problems
Quote:
http://content.vexrobotics.com/docs/...e_20130215.pdf In your case, I would use the SERIAL to CAN adapter setup for your testing, learning, developmental purposes. There is a bit of a learning curve to get the environment setup. You'll need to load FIRMWARE and set ID's on the JAGS. All the documentation you need can be found here: http://www.vexrobotics.com/vexpro/mo.../217-3367.html There are also good examples in LABVIEW, for CAN Jaguar and Encoder that you can look at to get a better understanding of how to setup the environment. |
Re: Encoder problems
Quote:
|
Re: Encoder problems
Ether, I will check on Sunday and post what will happen..
|
Re: Encoder problems
Phalanx, do you have any tips / important notes for working with the CAN?
I will probably test that after our offseason competition and I want to make sure I will have all the information needed. |
Re: Encoder problems
Quote:
1) Make sure you have good termination. Poor terminating has been the cause of more nightmares and headaches than anything else. 2) Don't overtax the CPU on the CRIO. When than happens the serial port bogs down, responses get slow, CAN errors tend to crop up. 3) Don't send the run at xxxx speed every loop (20ms) in teleop. I find that that adds too much traffic and floods the serial port. Just set it once, and then check it in a periodic loop (I like the 100ms loop for that). The Jaguar will do it's best to maintain that speed for you. You only need to tell it when you want to change it. It's kind of like, set it once and forget it. |
Re: Encoder problems
I will probably ask more questions when I will work on the CAN but thank you very much!
|
Re: Encoder problems
3 Attachment(s)
I finally got a chance to test the encoder as a counter (you can see the images attached for the beahaviour of the counter and the begin and readings of the counter).
The math wasn't far from the truth but the tachometer reading showed that the shooter spined at 4800 - 5200 RPM which the counter couldn't read. Should I replace back the encoder to the E4P that probably will work around those speeds? |
Re: Encoder problems
Quote:
|
Re: Encoder problems
Quote:
|
Re: Encoder problems
Quote:
A US Digital 360 CPR E4P encoder outputs 2*360 = 720 total edges (360 rising + 360 falling) per rotation on each channel. So for each channel, an edge transition occurs every 1/720 of a rotation, if the symmetry is perfect (see attached excerpt from datasheet). |
Re: Encoder problems
I'm still using the AS5145B and as you can see in the graph we reached the limit, When I will change it back to the E4P there won't be any problem.
Thank you very much for all the help and knowledge! |
| All times are GMT -5. The time now is 01:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi