Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

MyRIO Encoder Drift

I'm new with myRIO and just started hooking it up to a laser for linear positioning measurements. My problem is I'm getting drift when the actuator isn't moving. I'm using the myRIO express VI for encoder measurements. (I have tried using the myRIO advanced IO encoder VI's and I get the same drift problem, but I also get repeated and occasional errors. This seems like a complicating case, not an enlightening one, so I'm going to focus on getting the express VI to work unless someone has a good reason not to work with it).

 

Unfortunately, I don't have a great datasheet for my laser setup, but from what I can see now I'm getting about 30,000 counts for my full range of movement which is about an inch. I know this because I can see a nice waveform from the encoder outputs when moving from end to end. So that's good - it works overall. However, every few seconds or so - and this isn't a periodic thing, I can't figure out that it happens regularly - the encoder counts will rapidly change value and lose a bunch of counts, usually around 50 or 100 at a time. 'Rapidly' meaning within about 50 counts of my loop running at 1k. Then it will hold steady (or track the motor position if I move things around) until a few more seconds and it will drift again. Sometimes a few drift occurrences will happen in a row, so the difference will be larger and a little slower. What I'm calling drift looks like a step change, not a ramp.

 

As far as I can tell, the drift is always negative. If I switch the A and B terminals, the drift is always positive. There are some slight components in the opposite direction, but nothing nearly as large/consistent.

 

If I turn the laser off, the reading is steady with no drift.

 

I'm pretty much at a loss right now for what the problem is/how to fix it. Since I'm able to read the encoder when the system is moving, I figure it's not an issue of processor speed since it can capture the faster encoder responses that happen when the system is moving. I don't know what else would cause the counting to get so messed up. Any thoughts?

 

For completeness, here's my basic VI:

Drift_BlockDiagram.png

 

And here's the front panel: around time 9000, I moved the actuator forward, but from zero until then, all that drifting is from this undesired encoder behavior.

Drift_Frontpanel.png

0 Kudos
Message 1 of 4
(6,902 Views)

Hey rmyUCLA,

 

When you first call the Encode Express VI a counter is enabled in the FPGA.  That counter increments or decrements each time an incoming pulse is read on the encoder channels.  Subsequent calls to the Encoder EVI simply read the count register on the FPGA.  The FPGA runs independent of your RT timed loop so the timed loop speed shouldn't have any effect on the 'drift' you're seeing.  

 

If you're encoder has about 30,000 ticks per inch were talking about 33 micro inches per tick.  The drift you're seeing is about 1500 ticks which is about .05 inches.  Is it possible the system is actually moving around this much?  Have you used this setup with another system reading the encoder values?

 

When you say the drift doesn't happen when the laser is off, do you mean the motor controlling the Laser or the beam?  Is it possible the beam causes vibration in the system?  Is the laser systems power tied to the myRIO power?  Its possible the laser causes the encoder power to become noise and generate bad pulse?

 

Let us know and we'll see what we can do to help.  Good luck!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 2 of 4
(6,888 Views)

Hi Sam,

 

Thanks for your response - it's helpful in me seeing the bigger picture. I think it was actually a hardware issue. I was able to use another processing box that generates the encoder counts from the laser, and that worked without any drift.

 

Cheers

0 Kudos
Message 3 of 4
(6,883 Views)

Can you post some info on the encoder and the other processor you're using.  It would help to compare the specs on each setup.

 

Can you also post a wiring diagram to show the connections you've made in your system.

 

Thanks!

 

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

 

0 Kudos
Message 4 of 4
(6,879 Views)