From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Count pulses of a Arduino pin and displaying on a LabView display

Solved!
Go to solution

Hi!

I'm starting to use LabView and Arduino and I do not have much knowledge.

I want to count how many times I press a button on any digital input and display on a Labview display.

I try to do an example

Download All
Message 1 of 9
(13,715 Views)
Solution
Accepted by topic author Rizzieri

Solved

0 Kudos
Message 2 of 9
(9,590 Views)

how i can count the pulses please in labview arduino analog or digital pin

0 Kudos
Message 3 of 9
(9,590 Views)

LIFA does not have any built in capability for counting pulses.  However. you could use a non LIFA method.   I suggest you use Arduino to count the pulses and then use Labview's serial interface capability to transfer the data to Labview.

This link shows how to count pulses using interrupts.

<http://playground.arduino.cc/Main/EEM12L-32AKWhMonitoring>

This link mentions counting rates of 100,000 pulses per second can be obtained, 

<http://playground.arduino.cc/Main/TSL235R>

To make best use of Labview data acquisition capabilities you need to send a signal from Labview to Arduino when you want a reading and then let Labview read the data. This means you need to modify the code given in the examples given above.   In the examples Arduino controls when data is sent to abview.  Instead Labview needs to control when Ardjuino sends data,

hrh212

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

hi,

i'm very interesting to your Vi concerning frequency reading using arduino and labview.

I'm beguinner in arduino. I use quartz resonnator (quartz crystal microbalance)  for gas sensing in my reasearch.  the frequency  of the bare resonator is about 10 MHz. I use  two oscillators based on 74HCT14 and  differential mode between au bare resonator and functionalized resonator with specific membrane to detect gas (I use AD633 to measure the difference)

i use classic frequency counter (HP) but recently i use arduino and labview to measure the frequency schift between the two resonantors toward gas concentration. the total frequency shift in the differential mode is between 10 KHz and 100 KHz.

do you think with this Vi and arduino uno i can quantify the frequency shift with a precision of 1 Hz.

if OK, how i can enhance the resolution to 0.1 Hz.

thank you very much to your precipus help

0 Kudos
Message 5 of 9
(9,590 Views)

For best resolution I suggest you use Arduino's input capture capability to measure the period.  See section 18.8 Measuring pulses more accurately at the following Web Page.

<http://www.oreilly.de/catalog/arduinockbkger/Arduino_Kochbuch_englKap_18.pdf>

This input capture method is not compatible with LIFA.

hrh212

0 Kudos
Message 6 of 9
(9,590 Views)

thank you

however the Vi can not give the frequency and only the counts are given. how can i transform the Vi to visualize the frequency

best regards

0 Kudos
Message 7 of 9
(9,590 Views)

To transform your VI to measure frequency you need to count pulses for a fixed period of time.  Then use the formula (number of pulses) / ( counter time period) to calculate frequency.  Hence you need code running on your Arduino board to measure the number of counts and to control the counter time period.

A better choice for a micro controller for ,making frequency measurements is a Teensy 3.2  An Ardjuino Uno requires the tweaking of configuration registers for use as a frequency counter above approximately 20 KHz. and its top limit is approximately 100KHz.   Whereas as the Teensy 3.2 can make frequency measurements up to 65MHz. 

The following link provides helpful information on using the Freq Count Library. 

<https://www.pjrc.com/teensy/td_libs_FreqCount.html>

To obtain 0.1Hz resolution for 1ooKHz input frequencies you will need to use a longer Gate Interval than the 1000ms gate interval shown in the demo code.

The Teensy 3.2 uses the Arduino IDE and Arduino Libraries that have been  modified for use with Teensy 3.2.

For pricing and availability see:

<https://www.pjrc.com/store/teensy32_pins.html>

hrh212

0 Kudos
Message 8 of 9
(9,590 Views)

Hi,

many codes and lib for frequency counter are in the net .

in my project I measure frequencies lower than 100 KHz with 1 Hz resolution and in many cases of sensor applications 0. 1 Hz.

Where  i can find simple code and library for arduino uno without LCD display.

i try among 6 mounths

thank you very much for precious help

0 Kudos
Message 9 of 9
(9,590 Views)