Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Filtering of 9411 Encoder Input in FPGA

Hello, I am using a cRIO embedded system running in Hybrid mode.  I have the stepper motor and NI motor/encoder hardware wired to the NI Drive.  I am piggy backing the encoder signal from the P7000 series connectivity breakout board into the 9411 which is configured in FPGA.  The FPGA implements an Quad Encoder routine to track the position of the encoder.  I then use a photoeye to locate a part on the conveyor and track it using the encoder count.

 

I am observing noise in the encoder which is translating to incorrect position of the part as it is tracked down the conveyor.  For instance, I trigger a vision system as the part passes by the camera.  I observe that the part jumps a substantial amount in the camera's FOV while the conveyor is being powered (or while the system's feeder bowl is active).  If I turn the conveyor by hand or using a battery drill, the part is very repeatable in the FOV.

 

I am looking for a way to digitally filter the input signal.  I have tried writing code that basically requires X number of scans for an input to be stable before the signal can change states.  For instance, if I set the scans to 50, then there must be 50 scans in a row before the signal is considered true or false.  This has not helped much.

 

From a hardware standpoint, I have installed better shielding on the encoder cable and the motor cable, but haven't had much luck in reducing this issue.  The 9411 card seems to be susceptible to noise and I am looking for ideas on how to reduce its sensitivity to noise.

 

I do not believe that digital filters is available in FPGA on the 9411 itself.

 

Any suggestions either hardware related or software related.

 

Thanks.

Message 1 of 10
(8,583 Views)

are you using a differential encoder?  is the FPGA loop running as SCTL?

I have been sucessful before using the filter technique you describe.  I wonder is there is something else going on.  when you run the conveyor by hand, is it the same speed as under motor control?

Stu
Message 2 of 10
(8,579 Views)

Hello Stu, Thanks for the quick reply.  Yes I am using a differential encoder from NI.  Below is a list of actual hardware I am using from NI.

 

I have been working on this noise issue for quite some time.  Originally, I thought the noise was exclusively being produced from the NI Danaher Drive, but I have evidence that the feeder bowl is creating noise as well.

 

When I run the system with the electric drill, I do attempt to keep it at near the same speed that the conveyor runs under normal operation.  I have several inspections occuring at different points of the conveyor all being controlled by the FPGA based on the encoder count that I am obtaining from the 9411 card.  I have noticed that the stations further down the conveyor seem to have more jitter.  For instance, Camera #1 is located about 12 inches from the trigger point and Camera #2 is located about 16 inches from the trigger point.  I believe that the system experiences more noise before the part arrives at Camera #2 and hence Camera #2 shows more visual jump of the part.  It is almost always additional encoder counts being detected because the part is always shifted towards the input side of the FOV.

 

We have tried new cables and replaced every component in the control system except for the cRIO backplane (ie. MTR, ENC, DRV, and Cables).

 

Thanks for your insight.

 

NI 779005-01 #9411 6-CH DIFF INPUT MODUL
NI 779012-01 #9263 4-CH ANALOG OUTPUT MO
NI 779517-01 #9477 32-CH SINK OUTPUT MOD
NI 779944-01 #9512 STEPPER CONTROL CARD
NI 780030-01 #9426 32-CH SOURCE INPUT MO
NI 780086-01 N31HRLG-LEK-M2-00 STEP MTR,
NI 780098-01 #P70360 STEPPER DRIVE 120-2
NI 780252-01 15T-14SA-1000-N5RHV-F00-CE
NI 780471-01 cRIO-9073 PROGRAMMABLE AUTO
NI 780552-01 9512 to P7000 CONNECTIVITY

0 Kudos
Message 3 of 10
(8,573 Views)

as a differntial encoder, this should eliminate most of the noise that you are seeing.  you have connect A and A-NOT, B and B-NOT etc. right?  is your code SCTL?  what is the nominal RPM of the encoder?

Stu
0 Kudos
Message 4 of 10
(8,567 Views)
Yes I do have the encoder connected in differential mode (ie A and A-). I am running the quadencoder logic in an SCTL but obviously the actual io node is outside of the SCTL. I have been adding filter logic to these signals before they enter the SCTL. The code and hardware work properly when running the hardware with a battery powered drill. However when either the bowl or convert stepper motor are powered, I get incorrect encoder counts.

As a side note, I am feeding the encoder signals into the 9512 card. The 9512 card is running in scan engine mode. Occassionally I get a position error because the encoder has not tracked properly due to noise. Basically the 9512 is used to run tge conveyor at a given speed. I run it in velocity mode rather the point to point moves. Sonas tge conveyor runs for maybe a hour or too, the error accumulates a little. I opened up the window to minimize these errors stopping the system.

It is noteworthy that the amount of error on the 9512 card seems less then on the fpga input. Maybe there is some signal conditioning on the 9512 card.

I wouldn't need the 9411 card but I could not get the encoder count from the 9512 card since it is running in scan engine mode. I was not able to get the 9512 card to run in fpga mode properly.

My encoder is running around 4-6 rps.

I am planning to make a new cable that runs directly from the encoder to the 9411 card and run the 9512 card in open loop mode (since the encoder won't feed onto the 9512 card any more).

I am also adding logic to sample the 9411 inputs for x cycles. If the signal is on for more then half the scans then I will pass through the on signal.

Any other suggestions.

Thanks again, Rick.
0 Kudos
Message 5 of 10
(8,564 Views)

the 9411 i/o node can be placed in a SCTL.  i have attached a test case with deglitch filter for you to try.  take the code and put into your project, fixup the i/o node reference and give it a try.  let me know how it works out.

Stu
Message 6 of 10
(8,559 Views)

Stu, Thanks for the help.  I will incorporate that code into my FPGA and let you know what happens.  I am offsite from the hardware but will compile the code and test in the very near future.  The filter is quite a bit different from what I was implementing.  Is it necessary to have the the two conditional disable structures in the final code.  Thanks, Rick 

0 Kudos
Message 7 of 10
(8,550 Views)

No, i put the conditional disable code in there to test under windows interactively.  it can be taken out.

Stu
0 Kudos
Message 8 of 10
(8,546 Views)

I know it has been quite awhile since this thread was posted but I am having the same exact issue and was wondering if you ever came up with a final solution.

 

Thanks.

0 Kudos
Message 9 of 10
(5,286 Views)

Since this post is several years old, it might be beneficial to create a new post where it will be more visible to the community.

Matt G.
Product Manager
National Instruments
0 Kudos
Message 10 of 10
(5,269 Views)