LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Clock from Numerical Position Output of Digital Encoder

Hey everyone,

 

I'm trying to sample a voltage (pressure inside an engine) with my NI USB-6212 against a rotary encoder position (crankshaft angle). For some brief background, I'm using a producer/consumer structure and my rotary encoder has proprietary VIs from the manufacture to interface. It's from US Digital and it's an HD25A. It makes the most sense to use my rotary encoder as a sample clock so I wind up with a sampled point of pressure data for each crankshaft angle. This makes it far easier to average pressure traces together and work with the data.

 

I've found quite a few threads on this (links at the end of my post) but they all rely on having a pulse output from the digital encoder which is then wired into a counter input on their board. I don't have a pulse output, my encoder is outputting a numeric value between 0 and my chosen resolution (currently 3600, so 0 to 3599).

 

My question is how can I take this changing numerical output and make a sample clock pulse for each time the value changes? Does this need to be turned into a task to use as a sample clock? I'm essentially using the data acquistion program from the example program Cont Acq&Graph Voltage-Ext Clk.vi.

 

Thanks in advance for any help you can lend me and my apologies if I missed a prior thread on this topic. My search-fu wasn't able to turn anything up.

 

Some relevant links I found, though I couldn't quite make enough sense of them to get the fog to lift:

http://forums.ni.com/t5/Counter-Timer/How-to-reset-a-counter-on-external-signal-in-LabView/td-p/1521...

https://decibel.ni.com/content/docs/DOC-12106

http://ni.lithium.com/t5/Multifunction-DAQ/Rotary-encoder-data-acquired-simultaneously-with-analog-i...

0 Kudos
Message 1 of 7
(2,498 Views)

How fast can this numerical output change? (sample clock frequency)?

0 Kudos
Message 2 of 7
(2,466 Views)

I'm looking for 3600 samples per revolution at 3600 RPM so about 216 kHz.

0 Kudos
Message 3 of 7
(2,459 Views)

I don't think there is anyway you are going to make this work like you think you can.  The US digital encoders I have worked with and their VI's were based on reading the current encoder count through a serial port connection.  To do what you want, you are going to need to read the encoder every time the count changes.  At 216 kHz, a serial connection is not going to be able to do that.  Even if it could, you would essentially still have some latency between when the count changed and when the VI would be able to request a reading and get a response that showed the count had changed.

 

You need to use an encoder that has a digital pulse output that you could use as a sample clock on a data acquisition card.

0 Kudos
Message 4 of 7
(2,457 Views)

Do you think I would have more luck with the analog output? I had previously been running that and found the data to be too noisy to use as a sample clock. I suppose I could try to sample both the analog signals (pressure and angle) on a fixed timing to get my lined up points of data.

 

If that won't work I'll just buy a Kislter crank angle sensor that has a pulse output.

0 Kudos
Message 5 of 7
(2,454 Views)

That's what I would do.  Do you really need 3600 readings per revolution?  That is a lot of data.

 

If it puts out an analog output, and it is something like 0 volts for 0 degrees, 5 volts for 180 degrees, and 10 volts for just short of 360 degrees, then all you need to do is acquire both that voltage and your other analog input in the same task.  The data will already be lined up with each other.  And the voltage will be a direct measurement of your angle.  Since I doubt you really need 3600 pressure readings per revolution, you could sample at a much lower rate (such as 360 samples/rev.  Perhaps event 72 or 36 would be every 5 or 10 degrees.)

0 Kudos
Message 6 of 7
(2,452 Views)

I need 3600 smaples per revolution minimum. I'm developing a graph of pressure vs crank angle which spikes around the combustion event. This is a fast event and I want to capture the peak so I can compare different fuels. Here's a pressure trace:

 

http://www.intechopen.com/source/html/17591/media/image32.jpeg

 

I found analog not to be fast enough.

0 Kudos
Message 7 of 7
(2,449 Views)