05-23-2013 05:13 PM
Hi,
I am using arduino UNO to control servo motor. I am using 2 servos operating on 5v of arduino. I have installed everything required for interfacing arduino with LABVIEW. I have assigned com3 for it.
After uploading LIFA_BASE on arduino when i run my vi file my servos starts vibrating and shrinking. When i enter some angle it responds after a delay . But the main problem is when i stop my vi file the there is ahuge delay in stopping the process and when i upload another programme on arduino it shows 'com3 not found'. and it works again after i disconnect arduino from computer and remove all connections.While running the servo example in help nothing such happens.
Please solve it.
05-24-2013 09:51 AM
Hey Chakslord,
You're problem is most likely due to the fact that you branch (split) the Arduino reference wire. The reference wire contains the VISA Resource (among other things). When you branch the wire and call two Arduino VIs in parallel you are potentially giving the Arduino two commands at once. The firmware on the Arduino epects to receive one command, respond to it, receive another command, respond to it, etc. Similarly LV expects to send a command, get a response, send a command, get a response...
You should never split the Arduino reference wire. Instead you can perform muliple operations in series.
Let us know if that helps.
Thanks!
-Sam K
LIFA Developer
05-24-2013 09:56 AM
Hey Chakslord,
I also wanted to mention that we have a pretty active LabVIEW Interface for Arduino community at www.ni.com/arduino .
Thanks,
-Sam K
LIFA Developer
05-24-2013 10:21 AM
Hi chakslord
The other problem of com port busy, is due to the fact that the arduino needs to be reset for it to connect again.
If u stop a vi on ur comp. the life base code still runs on the micro controller.
It is only in the beginning of the code when it establishes the connection. Thus u need to reset ur controller.
What u are doing by removing and plugging it back in is resetting it.
U can do that by pressing a reset on ur arduino board that will work as well.
And SammyK has solved ur major code problem.
Cheers!
Akshay
05-24-2013 10:40 AM
Akshay,
That's not quite true. The firmware does continue to run on the Arduino, even after you stop your LabVIEW VI. This is why some things (such as the Piezo buzzer or PWM outputs for example) continue to run/output on the Arduino even after LabVIEW is closed. That being said you can reconnect to the Arduino with LabVIEW without resetting the Arduino itself. I specifically added this feature when working with Xbee and Bluetooth. The interesting thing is that when you're connected to the Arduino via USB the Arduino actually does get reset every time you call the Arduino Init VI in LabVIEW. The reason this happens is because the Init VI calls the VISA Configure Serial VI which toggles the serial DTR line. The Arduino resets itself when this line is toggled. This is a feature added to the Uno and newer boards so that the Arduino IDE can reset the board automatically when you click Deploy (before this you had to manually reset the Arduino every time you want to deploy new firmware).
The real problem you are most likley solving by unplugging and reconnecting the Arduino is that something has reserved the Arduino. For example if you call the Arduino Init VI but never call the Close vi LabVIEW / Windows doesn't know that you're done with it when your main VI stops. When you try to run the VI again you can't open the VISA resource because windows / LabVIEW thinks something else is still using it. If this happens the VISA Resource drop down will show a little gold box next to the COM Port. This can also happen if something else truely is using the port such as the Arduino IDE to program the Arduino.
TL;DR
You can connect to the Arduino without resetting it each time, but not if windows / LabVIEW thinks it is in use.
-Sam K
LIFA Developer
05-24-2013 10:56 AM
Hi Sam
I did know that the firmware still runs on the arduino, as i had seen that practically.
I had been having this reset issue from a year or so. But found a manual method of reset when ever this happened
Thanks u are clarifying.
(So it is the windows fault.)
Can this also be due to use of freeduino instead of arduino which is based on the old arduino board design or a modified version of the old design.
Thanks
Akshay
05-24-2013 11:20 AM
I'm not sure about the freeduino but a quick look at a schematic looks like it should reset with the DRT toggle. You can test it by runing a VISA configure serial, then a VISA close and see if it resets the Arduino.
-Sam K
LIFA Developer