Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

engine speed and position sensor using an encoder

Hi! 

I am trying to vary spark timing on a spark ignition engine.  I am using encoder (59 small tooth, one long tooth) for position sensing.   The NI instrument is a PCI 6733.  I need to run the engine over a range of 0-3000 RPM.  Does anyone have code already written for a similar application?

Suggestions?

Thanks

Juice
0 Kudos
Message 1 of 7
(4,386 Views)

Hi Juice,

I’m sorry but I don’t understand too clear what you are trying to accomplish. Do you want to measure the RPM of your motor? If so, are you using a sensor to measure the encoder rotations? What type of signal is the output of the sensor? A pulse train signal? In that case one option would be to measure frequency with one of the counters of the card and calculate the RPM. On the other hand, if you want to control the variation of the spark timing, then how many cylinders does your motor have? What timing parameter do you want to implement? Are you planning on controlling the time to spark with the analog outputs of the card? It is probable that we don’t have code that does exactly what you are trying to develop but we can point you to some helpful examples to get started. It would be helpful if you can give us a little bit more information about what you are trying to accomplish with the PCI-6733.

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 2 of 7
(4,358 Views)

Hi Ana,

Thanks so much for your response.  I appreciate your help. 

>> Do you want to measure the RPM of your motor? If so, are you using a sensor to measure the encoder rotations?

Overall goal is to modify spark timing for spark-ignition engine.  To do this I need to know position of the crank.  The encoder has 60 teeth on it -- with one of the teeth being extra long (double size).  So I need to be able to identify that long pulse as well as count the small pulses.  The long pulse identifies a particular position on the crank (TDC of one of the cylinders for example).

>>
What type of signal is the output of the sensor? A pulse train signal? In that case one option would be to measure frequency with one of the counters of the card and calculate the RPM

The sensor produces a 5V pulse train.  I can't just measure frequency because of the issue of finding the long pulse. 

>>
On the other hand, if you want to control the variation of the spark timing, then how many cylinders does your motor have?

Yes I want to very spark timing.  I have a 2 cylinder engine.

>>
What timing parameter do you want to implement?

I want to be able to vary spark timing between -20 and +20 degrees relative to TDC for both cylinders.

>> Are you planning on controlling the time to spark with the analog outputs of the card?

No, digital output signal.

Thanks again for your assistance.  I hope this makes clearer what I am trying to do. 

Cheers,

Juice



0 Kudos
Message 3 of 7
(4,351 Views)

Hi Juice,

I understand that you want to control the spark timing depending on the position of the crank. So you’ll be continuously reading the position of the encoder and determining the Digital Outputs (to control the spark timing) based on the encoder readings. I think that you could use Pulse Width Measurement in order to find the long pulse. These are some helpful links:

-          Pulse-Width Measurement with a Counter

-          Measuring Period, Semi-Period, Pulse Width, and Two-Edge Separation

And, if I understand correctly, you’ll still need to count the pulses in order to determine the exact position. To do that, I suggest that you have a look at some Count Edge examples. What programming language are you using? And what DAQ drivers are you using in this application? Assuming that you'll be using LabVIEW and you have the DAQmx drivers, you can find these examples going to Help > Find Examples > Hardware Input and Output > DAQmx > Counter Measurement. If my assumptions are mistaken please post back. I hope this is helpful,

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 4 of 7
(4,299 Views)

Juice,

 

Just wondering if you wrote this VI?  I actually need to do the exact same thing.  Please let me know if you would be able to share that code with me.

 

Thanks,

Jeremy

Jeremy Backer
CLAD
0 Kudos
Message 5 of 7
(4,066 Views)
Hi Jeremy,
After much discussion, NI agreed that they were unable to do this operation with my NI card.  They suggested their FPGA unit might be able to accomplish this ($3000-4000).  For $500, we bought a XDI system that had some issues getting it up and running but did work.  I would suggest checking out the XDI system.
 Good Luck,
 Juice 
 

JMBacker wrote:

Juice,

 

Just wondering if you wrote this VI?  I actually need to do the exact same thing.  Please let me know if you would be able to share that code with me.

 

Thanks,

Jeremy


 

0 Kudos
Message 6 of 7
(4,060 Views)

Thanks for the info, I will check them out.

Jeremy Backer
CLAD
0 Kudos
Message 7 of 7
(4,041 Views)