LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get RPM measurements from a TTL signal

Hi all!

 

Im new to LabView and this forum.

 

I am having problems with getting RPM reading from a TTL signal.

I am getting the TTL signal from an externak device, which reads the data from the ECU (and also displays the RPM and SPEED of the vehicle) and then passes this data on thru TTL signals, to the NI cDAQ-9172 chasis, NI 9402 modul, and then to my computer to a vi.

But all i am getting on the vi are 1's and 0's.

The RPM is defined as the frequency between those 1's, but I am having problem to get to that frequency.

I am getting the data on the vi with DAQ assistant, and am gettin only boolean type of data.

Any ideas how to get this frequency out?

I am very new to all this, so i would like to ask you for some example vi's for easier understanding.

 

Nice day! Smiley Happy

0 Kudos
Message 1 of 6
(2,392 Views)

Hi,

 

you could create a counter to count rising edges over a period of time and then calculate the average speed every n seconds. Or you could initialise a timer on each rising edge and determine the speed directly.

 

What frequency are you expecting the TTL signal to be coming in at? With the cDAQ I would be concerned that you miss the transitions coming in if the frequency is to high.

David
www.controlsoftwaresolutions.com
0 Kudos
Message 2 of 6
(2,390 Views)

It looks like the attached link might help you detect the rising edges - you just need to add some timing functionality to work out the time between edges and from that the frequency

 

http://controlsoftwaresolutions.com/CoreLibrary.aspx

David
www.controlsoftwaresolutions.com
Message 3 of 6
(2,384 Views)

I would recommend you start learning about the DAQmx API. While the express VI's are capable of RPM, you'll be happier in the long run if you get out of that habit sooner rather than later.

 

Start with creating a counter input task. Be sure to input realistic upper and lower rpm limits so that it knows which sample clock to use. Use the implicit polymorphic timing .vi and set it to continuous samples than call the start task .vi. Start reading your channel inside your while loop, the output from that channel will be a DBL of how many ticks it's counting per second, or frequency in Hz. Just multiply that by 60 (if it's one count per rev, if it's more than one count per rev, divide 60 by however many counts per rev and multiply by that number, i.e. 4 counts per rev means 60/4=15, so multiply freq * 15 to get RPM) to get your RPM.

 

I included a snippet of code to get you started.

 

Good luck.

Message 4 of 6
(2,375 Views)

Thanks for your answers, they are very helpfull.

The problem is, I can read the data only on digital input, when i set it on a counter input, everything stands stil, or some errors show up.

0 Kudos
Message 5 of 6
(2,354 Views)

Share the code and by more specific what type of error occurs. Maybe someone is able to help you.

 

If it works with DI it must also work with the Counter. Check again the connections and measure with a oscilloscope directly on the NI Board pins in order to be sure that you have the signals at the Counter Input.

 

Paul

0 Kudos
Message 6 of 6
(2,347 Views)