Sending Commands to Arduino using LabVIEW

Hello all,

I have been delivered a motor controller that is arduino-based, but that I did not make. With it I have been given a list of commands to control the motor, for example:

"forward.x" - runs the motor forward by x steps
"stop" - stops the motor

and similar.

My task is to create an interface to control the motor in LabVIEW. I need to be able to create a button that I can press on the LabVIEW interface that will deliver a certain command to the arduino to trigger the corresponding action, i.e., a "FORWARD" button that will deliver the command "forward.1".

However, I am having difficulty understanding how I can deliver such a command to the arduino via LabVIEW. There are plenty of examples online for controlling individual pins, for reading/writing data and so on, but not for delivering commands to an already-installed sketch on the board. Is it just a case of a serial write of the command to the board?

If anyone has any idea where to start, I would really appreciate your help. Many thanks, Sam

I think that you first need to get an RS232 to UART converter to connect the Arduino to your computer.
RS232 to UART
You may also need a USB to RS232 converter if your PC does not already have an RS232 port.

As far as the LabVIEW software is involved, I think you are correct in thinking that you just need to send the command to the serial interface (assuming you have already set the baud rate first).

(It might even be possible to connect by USB, but I don't know how you would do that).

You might get better advice on the NI forum

Maybe the previous post jumped the gun a little (I don't know anything about labview). Can the board not simply be connected to the PC via USB?

That is quite possible, but I don't know how you can control a USB interface in LabVIEW.

That is why I suggested asking on the NI forum.

I have only ever used RS232 or Ethernet to connect a PC to other equipment using LabView.
Using an Ethernet shield would be another option.

Thank you, the box as delivered has a converter to USB so I am fine on that count. I will press on with treating the commands as strings for serial write and see how I get on from there!

Yes it can!

have you seen program-arduino-labview-example ?

I haven't, but I have seen similar. I will take a look at this. Thank you!

The final stage on that webpage is " Upload Labview Generated Arduino Code to Arduino Board", which is something smallen has said he doesn't want to do.
He has to preserve the motor control code on the Arduino.