12-04-2022 05:10 AM
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?
Solved! Go to Solution.
12-05-2022 07:46 AM
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.
12-08-2022 12:47 PM
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 🙂
12-12-2022 03:46 PM
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 🙂
12-13-2022 05:40 AM - edited 12-13-2022 05:59 AM
@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
12-13-2022 06:44 AM
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
}
}
12-13-2022 07:07 AM
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