LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sine wave signal to Arduino to control Servo

Hello, I am new to Labview.

 

I would like to use Labview to control the position of a servo motor (which also has a separate cable for position feedback).

I found a video which uses an Arduino. This is what I intend to do as well: (Link) 

 

Instead of using a dial to manually change the position of the servo, I would like to push a button after which the servo rotates from 0 to 90 degrees (within a certain time).

To prevent large acceleration/torque spikes, I would like to gradually change the angle from 0 to 90 using a sine function:

nipost.PNG

 

Any help on how to implement this will be greatly appreciated!

0 Kudos
Message 1 of 3
(923 Views)

Well, I've done some "motion control" using what I called a "Position Trapezoid with constant acceleration".  It had three parameters -- the distance to travel, the speed (or "absolute value of velocity") of the movement, and the acceleration/deceleration at the ends of the velocity "steps".  Given a fixed sampling frequency, a little calculating (and simple algebra), you divide the "change in position" into "acceleration "steps" to reach the desired "constant velocity", a "constant velocity" section to get most of the way to the "new position", and a "deceleration" section mirroring the acceleration part.  It's been a bunch of years since I did this derivation, but it was a fun exercise in algebra -- you should be able to do the simple math.

 

Bob Schor

Message 2 of 3
(863 Views)

In general there are three ways of using LabVIEW with an Arduino

 

  1. Program the Arduino in the native Arduino language.
    1. LabVIEW can communicate with an Arduino using VISA just like any other instrument on a serial port.
    2. IMHO: This is the best way as you have full control over the communications protocol and access to all of the of Arduino libraries and LabVIEW toolkits that are already out there.
    3. I highly recommend watching this video on serial communications: VIWeek 2020/Proper way to communicate over serial
  2. Use LINX (LIFA has long since been deprecated)
    1. Full LabVIEW integration
    2. Limited amount of Arduino libraries and peripherals directly supported
    3. The Arduino basically becomes a USB DAQ device that always needs to be connected to a computer.
  3. TSXperts Arduino compiler for LabVIEW
    1. Actually turns LabVIEW into compiled Arduino code. (A real feat on its own)
    2. Limited subset of LabVIEW vi's and primitives
    3. Very limited support for Arduino libraries 
    4. Development seems to have stopped, so those annoying bugs are here to stay

 

========================
=== Engineer Ambiguously ===
========================
Message 3 of 3
(854 Views)