LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Servomotor connected and controlled only by arduino but monitorization the pulse in labview

Solved!
Go to solution

Hello,

I'm doing a project where I'm going to have a servomotor with a pulsating cycle and strain gauges. My goal is to put the arduino to control the servomotor but be able to connect the strain gauges and the arduino to the labview to be able to monitor both things at the same time.
I would like to control the servomotor only by arduino but see the servomotor pulse and strain gauges deformation in the same graph in labview. It's possible?

0 Kudos
Message 1 of 7
(3,476 Views)
Solution
Accepted by topic author inescruz32

hey, inescruz32

if i understand correctly, the control and data acquisition routines will be in your arduino program (sketch) and you will have that data somewhere in your arduino code (such variables and so on).

if that is right, you do not need LIFA or LINX or Hobbyist Toolkit to connect to LabVIEW. Just send that data over Serial and read in LabVIEW. This way you can plot data, view in indicators, save in files and do whatever you want.


Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 2 of 7
(3,437 Views)

Hi Jorgemondadori,

 

I had problems in my arduino code but I already solved them. I've also managed to make this transition from arduino data to labview.
Thank you 🙂

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

Hey Jorge,

 

I apologize for bothering you again. I already managed to get the arduino to give me the angle value of the servomotor but when I ask Labview to read that data either they do not appear or there is an error in the Visa Read.
Is it because the arduino data is too fast?
Can you help me?
My Labview code is attached.

 

Thanks in advance 🙂

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

@inescruz32 wrote:

Hey Jorge,

I apologize for bothering you again. I already managed to get the arduino to give me the angle value of the servomotor but when I ask Labview to read that data either they do not appear or there is an error in the Visa Read.
Is it because the arduino data is too fast?
Can you help me?
My Labview code is attached.

 

Thanks in advance 🙂


No problem at all. 

assuming that your daq and write to file parts of the code are ok, you just need to adjust your serial communication.

can you read your data from arduino in the serial monitor?
if you can, then half of the work is done.

then i really recommend you watching this video:
https://www.youtube.com/watch?v=J8zw0sS6i1c&list=FLPSMswA_nDW1zpoIzrS7t-g&index=2

it is the best documentation on serial communication for LabVIEW.

Edit1:
would you mind sharing your arduino code?

Edit2:
in your code, you need to open serial communication after VISA configuration

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 5 of 7
(3,373 Views)

Hi, thanks for the recommendation, I'll take a look. In the meantime, I leave my arduino code to take a peek.

I think I put a VISA Configure Serial Port , do I need to put something else? (I have attached photo of my labview program).


#include
<Servo.h>

Servo servo1; // Create servo object to control a servo

// Variable to store the servo position

int pos = 0;

void setup()

{

// Attaches the servo on pin 6 to the servo object

  servo1.attach(6);

  Serial.begin(9600);

}

void loop() {

  for(pos = 90; pos < 180; pos += 1) // Goes from 0 degrees to 20 degress in steps of 1 degree

  {

    servo1.write(pos); // Tell servo to go to position in variable 'pos'

    delay(20); // Waits 20ms for the servo reach the position

    Serial.println(pos); // Show in serial monitor teh position of servo

  }

  for(pos = 179; pos > 90; pos = pos-1) // Goes from 20 degrees to 90 degress in steps of 1 degree

  {

    servo1.write(pos); // Tell servo to go to position in variable 'pos'

    delay(20); // Waits 20ms for the servo reach the position

    Serial.println(pos); // Show in serial monitor teh position of servo

  }

}
0 Kudos
Message 6 of 7
(3,360 Views)
Solution
Accepted by topic author inescruz32

Tested your code, it is working fine.

Add a "open serial" to your LabVIEW code.
Use Chart for reading inside a loop instead of graph

Servo reading.png

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 7 of 7
(3,354 Views)