LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Mesurer la fréquence d'un signal carré

Bonjour à tout le monde. Je suis en deuxième année BTS électrotechnique et je travaille sur un projet. Ma problématique c'est arriver à lire des impulsions générer par un compteur d'eau. La Fréquence des impulsions est proportionnelle au débit. Ma fréquence max est de 14 Hz d'après la doc du constructeur ; J'arrive à lire le signal en passant par labview (evidement j'utilise une Arduino mega), j'utilise LINX. Mon problème c'est de mesurer la fréquence de signal pour pouvoir avoir le débit instantané. J’espère que vous aurez une solution pour que je puisse avoir la fréquence. Je joins le programme que j’ai fait. Ce qui est entouré c'est le bloc que d'apres l'aide peut lire la frequence d'un signal. Mais apres quand je lance le programme il me dit erreur. Merci d'avance à tout le monde.

Capture.PNGdgdh.PNG

0 Kudos
Message 1 of 9
(6,047 Views)

You are trying to get the statistics for a single value i.e. a single value does not have an amplitude or frequency.  You need to gather a set of data over a period of time (where the data points are obtained at a constant frequency that is greating than the nyquist frequency).

However, for an application like this, I highly recommend that you implement the frequency calculation on the Arduino using interrupts.  Then, you would use a LINX custom command to get the current value of the calculated frequency.

For further questions regarding LINX, please post on the LINX forums.

0 Kudos
Message 2 of 9
(4,648 Views)

Thank you for your answer. So, if I understand, I must Use a digital read to read a pulse. And after How I can read the frequency??
Thank You !!

0 Kudos
Message 3 of 9
(4,648 Views)

No, that is not what I said.  Here is a document that I found that talks about measuring frequency using the Arduino.

0 Kudos
Message 4 of 9
(4,648 Views)

But this he can't help for write a code with Labview software For my project i must use Labview like an Human Machine Interface. I did lots of research on the internet, look for example at what insipirer me ... But Nothing Pleas Heeeelp

0 Kudos
Message 5 of 9
(4,648 Views)

You would still be using LabVIEW with LINX.  The link that I gave you shows you how to calculate the frequency of the sensor.

Using the first option shown, you can actually do without modifying LINX at all since you have access to the pulseIn() function via LINX.  In LINX it's called Digital Read Pulse Width.

You can also do the second option listed on that page.  It requires writing implementing the interrupt in custom firmware to calculate the frequency.  Then, you would create a LINX custom command to access that value.  If you opt for this method, I'd recommend making a LINX custom command that simply reads a digital pin so that you 1) get the custom LINX firmware set up and 2) verify that your new custom command works.  After getting that to work, you would add the interrupt code to the custom firmware and thento return the frequency value to LabVIEW.

0 Kudos
Message 6 of 9
(4,648 Views)

I test The digital pulse width; I saw somthing in the Waveform. But I don't understand how exactly this foncton work; The Pin Pulse Width (uS), what kind of information tell me. If I understand is the time between the pulse?? No??

Thank you again! And sorry for my bad English

0 Kudos
Message 7 of 9
(4,648 Views)

To understand how that function works, you can take a look at the documenation for the function used on the Arduion:  pulseIn().  If your sensor does not output a 50% duty cycle square wave, you'll probably need to use the interrupt method.

0 Kudos
Message 8 of 9
(4,648 Views)

Thank you!

You know the name of the fonction Millis in Labview??

Thanks again

0 Kudos
Message 9 of 9
(4,648 Views)