From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling analog voltage input from a quadrature angular encoder

I have a USB 6212 board and Labview 11. I'm attempting to create pressure traces of pressure vs crank angle for combustion engine research. I have an engine with a PCB piezo pressure transducer in the head and a US Digital HD25 rotary encoder. I did have an HD25A, an absolute model, but it proved impossible to collect the data I need with that. I want to be able to easily average together multiple pressure traces so I would like to assign index numbers for sample points, such as 0-359, and pass a 2D array of pressure traces and numerical angle in degrees on to my consumer loop where I can average them easily. Sampling them by time instead of angle was very difficult to average as there were different numbers of data points per revolution and they need to line up.

 

Right now I'm trying to figure out how to use my encoder as a sample clock for the transducer (analog voltage). I would like to not be sampling pressure by time but by revolution, so one sample per degree for example. Right now I have a producer consumer loop with DAQmx functions that read in pressure similar to the example Cont Acq&Graph Voltage-Ext Clk.vi and angular position similar to Measure Angular Position.vi. My encoder has an index channel, if that would be useful.

 

How do I use the angular position as a sample clock?

0 Kudos
Message 1 of 10
(3,628 Views)
Assuming it is a 360 pulse per rev encoder, that signal is your external clock. In addition you should have a once er rev index pulse. Align the encode such that that pulse occurs at a known location like TDC on cylinder 1. Use that as the trigger.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 10
(3,623 Views)

It's not, it's a 2500 cycles per revolution encoder. I want to sample closer to that rate using X4 quadrature. What kind of input would I run my encoder output into? Because I couldn't make it work on a PFI for some reason.

0 Kudos
Message 3 of 10
(3,619 Views)
It should still work the same way.

What do you mean exactly that it doesn't work? Also are you sure that the encoder outputs are nice and clean with no overshoot or undershoot? Have you looked at the encoder output with a scope? Is the signal level correct for a TTL input?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 10
(3,611 Views)

The specifications for the encoder include a 700-980 ns rise time. That is quite slow for some digital inputs.  It appears that the USB-6212 has hystersis on the digital and PFI inputs, so it should be OK, but the specs do not list a minimum rise time.

 

If you have an oscilloscope, look at the signal at the PFI input.  Look closely at the transitions to see what the rise and fall times are and whether there are any irregualrities, bumps, or noise on the transitions.

 

If you do not have an oscilloscope, try driving the PFI line from a logic circuit which runs at about the same frequency.  Of course it will not be synchronized with your engine, but if it triggers reliably, it would indicate that the signal quality coming from the encoder is not good enough.

 

Lynn

0 Kudos
Message 5 of 10
(3,608 Views)

Here's the thing, I'm building a program for other combustion researchers to use, all of whom will need different sample rates and resolutions. Ideally I would like to be able to specify a sample rate based on revolution or angle, so you could request one pressure point per revolution or two per, so on and so forth. So right now I have VIs reading the quadrature and I would like to take the DBL data, analyze it based on my chosen revolution, and output that to my sample clock. I've attached my code if someone else would like to look at it, I have some random VIs floating around in there and the consumer loop isn't programmed at all yet.

 

First question, is this possible or plausible? If not, then I'll start taking a look using a PFI input as a sample clock directly but I'd prefer the above method. I've tried that in my curent program and it samples a few times per revolution so I assume the signal isn't clear enough or something like that.

0 Kudos
Message 6 of 10
(3,568 Views)

I think I see what you are trying to do, but using the encoder as the sample clock will be a lot easier and a lot more reliable. Remember that you are using a nondeterministic OS so your timing will never be really accurate. In addition, a crankshaft doesn't really spin at a constant rate. It is constantly speeding up and slowing down depending upon what is happening in all the cylinders.

 

If you use the encoder pulses as your sample clock all the variability goes away. Your researchers can extract the pressure at any point in the rotation plus/minus 1/2500th of a rotation.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 7 of 10
(3,560 Views)

Mike, thanks for your response. I'll put a scope on it and see what the output looks like. After I posted my last message I thought that I might be able to use an event structure but I doubt it could keep up with the speeds. 2500 samples per rev should be enough though.

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

Hi !

Were you successful with your project?

thank you

0 Kudos
Message 9 of 10
(3,098 Views)

Hi CUA,

 

Since this post is from a couple of years ago you may not get a reply.  It also appears that xander18 has not been active for a few years.

 

Furthermore,  If you do not hear back and still have a question on this then feel free to create a new forum post at this link

0 Kudos
Message 10 of 10
(3,071 Views)