LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication with LabVIEW and Arduino without LVIFA_Base installed

Hi all

I'm in desperate need for advice. I have a cRIO 9073 and Arduino UNO that i'm using in a project. I would like to measure high RPM of up to 150 000 which translates to a frequency of 2.5kHz and control a stepper motor with my Arduino. The frequency measurement and stepper control should occur independently from one another. However I would like to measure and calculate the frequency on the Arduino and send the information to the cRIO via Serial commiunication. Is this at all possible? If so how would I go about doing such a thing?

TurboM

0 Kudos
Message 1 of 7
(6,989 Views)

Hey TurboM,

Are you doing both the frequency measurement (which I am guessing is an encoder measurement) and the encoder control on the Arduino and then just want to stream data to a cRIO?  If so this is definitely possible. Each analog sample on the Arduino takes about 10uS so depending on what else you have on your loop you can get some pretty fast measurements.  Streaming the data to the cRIO will just consist of writing out to the serial port and reading that on the cRIO side.  If you could provide some more details on your application I could probably give you a more concrete answer.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 7
(3,819 Views)

Hi Kevin. Thanx for replying

I 'm not sure what you mean by encoder. But here is a better description of my project. You see I have to build a cetrifugal compressor test bench for performance testing. At the moment I'm using a complete turbocharger unit. I'm currently to meaures the RPM (maximum being 150,000 RPM or 2.5 kHz) from the shaft of the compressor with an photo-interupter (basically a IR diode and phototransistor) This gives me a square wave with about 10% duty cycle. The frequency is very stable, even at higher RPMs. The stepper motor is basically used to control a valve that supplies high pressure air to the turbine side of the turbocharger.

Thus the RPM measurement will be used as feedback to the stepper motor in order to control the air flow and thus the RPM. So what I would like to do is measure the frequency, convert it to an RPM value send that to the cRIO via serial where I will compare the measured RPM to a set RPM. From there control signals for the stepper motor are sent via the NI 9207 to the Arduino which in controls the stepper.

I hope this makes sense to you? My problem at first is the actual communication with the Arduino and the cRIO.

Regards

TurboM

0 Kudos
Message 3 of 7
(3,819 Views)

Hey TurboM,

That makes sense.  You will need to set up a serial communication framework both on the Arduino and the cRIO to handle the communication between the two. You will just need the serial reads/writes on the Arduino and the Visa Reads/Writes on the cRIO.  How you structure the framework is mostly up to you.  I do think at the loop speeds you are going to need that you can't afford to just send a command and wait for a response (which is how we do it in the LIFA for most commands)- you will need some kind of streaming data going between the two sources.  You are also going to need a usb-serial converter for the Arduino. There should be a lot of options for that available.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 7
(3,819 Views)

You could also use the LIFA toolkit.  You can run the VI on the cRIO and attache the Arduino via RS232 (not usb).  You may want to look into something like this:

http://www.cutedigi.com/product_info.php?products_id=4329

-Sam K

LIFA Developer

0 Kudos
Message 5 of 7
(3,819 Views)

From reading your description it appears you don't need a fast sampling rate for your control loop.   Hence you could count the number of pulses commg from your photo-transistor in say a 0.1 second period.  With a 0.1 second sampling period you will have plenty of time to send the data to your CRIO, compare the frequency to a setpoint and then send a stepper motor control signal to an Arduino.

Howard

0 Kudos
Message 6 of 7
(3,819 Views)

Greetings, is a message out of time, if you want to communicate with the Arduino, you embed code into the arduino and use VISA on your computer to read this data  https://decibel.ni.com/content/thread/16912?tstart=0

0 Kudos
Message 7 of 7
(3,819 Views)