loading

Angles and speed of Servo motors are controlled by programming . So this tutorial brings it on to your mouse click.

Here i show how to design a Graphical User Interface for controlling Speed and Angle of a DC servo motor using arduino. With this GUI you can add as many servos as you want and can control there speed and set them at any desired angle. Also you can veiw the real time Graphical parameters , can also set your own. in my tutorial i am analyzing AMPLITUDE vs TIME of servo motors in real time.

You can Also export your Real Time DATA on EXCEL sheets.

Step 1: YOU NEED

HARDWARE

1. Arduino Board [ from UNO to MEGA as per your no of servos].

2. D.C. SERVO MOTORS[ as many as you want]

SOFTWARE

1. Arduino IDE

2. NI LABVIEW [any from 2010 to latest upgraded] LINK: Download and install LABVIEW

3. LABVIEW INTERFACE FOR Arduino LINK: DOWNLOAD and Steps to Install LIFA

FREEWARES

1. Jumper Wires

2. Power Source for servo

Step 2: Interface Arduino With LABVIEW

This link shows you to interface your Arduino with LABVIEW for real time processing.

CLICK THIS LINK

steps to install LIFA

Step 3: GET FIRMWARE

This is very important step.

This Firmware is required for your servo communications with LABVIEW. if you do not Upload this Firmware your servos will not respond in real time.

This is LIFA BASE.

below are the following steps to upload firmware on Arduino IDE.

STEP 1. Uploading LIFA FIRMWARE FOR SERVO ON ARDUINO

1.

Click File»Open

2.

Browse to \vi.lib\LabVIEW Interface for Arduino\Firmware\LIFA_Base where is the LabVIEW directory (c:\Program Files\National Instruments\LabVIEW 20XX by default). 3. Select LIFA_Base.

Click Open. The LIFA Firmware Source is now visible in the Arduino IDE.

4.

Click Tools»Board» where is the type of Arduino hardware to deploy to.

LIFA was designed with and tested using an Arduino Uno, however most Arduino compatible hardware should work.

5.

Click Tools»Serial Port» where COMX is the COM Port associated with the Arduino (COM3 from the example above).

The Ports section of Windows Device Manager can be used to determine which COM port is associated with an Arduino.

6. Click the Upload button.

First the Arduino IDE builds the firmware from the source code. Next the Arduino IDE deploys firmware to the Arduino.

Also a special Firmware is added here for no of servos you want to use. Change your servo pinouts on arduino as per your need.

Attached is a sample programme you have to upload on Arduino

Step 4: HARDWARE SETUP

here i have used 2 servo motors and Arduino UNO

PIN LAYOUT:

servo1.: RED WIRE - + 5v

BLACK WIRE - GND

YELLOW - 10

servo 2.:

RED WIRE - + 5v BLACK WIRE - GND

YELLOW - 9


Also attached a fritzing file

Step 5: Designing GUI

STEP 1: LAUNCH LABVIEW

STEP 2:

Launch Blank VI

STEP 3:

Right Click

Arduino< Inst

STEP 4:

VI hierarchy

STEP 5: Arduino< Servo Write < Servo Read

STEP 6:

Connect All variables on a BUS

STEP 7:

Structures< While loop [ Set up a while loop]

STEP 8:

Declare pin configuration to arduino on Servo Pallet

STEP 9:

Write on Servo and Read input values from user.

STEP 10:

Connect them on Single Bus.

STEP 11:

Create Logic Inside while loop

STEP 12:

Insert Graph [ Controls< Graph< WaveForm Chart]

STEP 13:

Place this Graph in the FRONT PANNEL

STEP 14:

In BLOCK DIAGRAM connect graph to servo output

STEP 15:

Insert Sweep meter to Front Pannel

STEP 16:

Close the loop on Arduino Close

STEP 17:

Initialise error and Connect STOP with Arduino BUS

STEP 18: Checking for errors .[ If RUN symbol on top is break then either vi is not complete or there is some missconnection

STEP 19: SAVE

Step 6: DRIVING SERVOS

After making connections of servo motors with Arduino and developing GUI in LABVIEW this is time to play with them.

STEP 1: Go to the Bloc diagram of LABVIEW and make some changes

I have marked no on the vi attached below. make changes on those no. according to following steps.

Follow below given steps


1.

Initialize the Connection to the Arduino. If nothing is connected to the VISA source input the Init vi will attempt to the Auto Connect to the Arduino.

To speed up the connection or to connect wirelessly use a VISA source constant to specify the COM PORT to use

2.

Set the No of servos to use. This creates the zero indexed array on Arduino. After specifying the no of servos you want You can refer to them by No.(starting from 0).

3.

Configure the 2 servos by assigning then digital I/O pins.

4.

Write an angle to servo 0 based on the loop Iteration.

Servo zero will sweep to the user specified angle and repeat. This angle is also from the servo and displayed on the front panel.

5. Manually set the angle of servo 2. This angle is also read from the servo and displayed on the front panel.

GO TO FRONT PANNEL

STEP 2.:

After making changes click on the RUN Button Situated at the top in the Front pannel.

STEP 3.:

PLAY WITH YOUR SERVOS. CONTROL SPEEDS. SET AT ANY ANGLE AND DO MORE STUFF BY CHANGING THE GUI IN FRONT PANNEL.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TIRED WANNA STOP IT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

STEP3.: press the ABORT EXECUTION button just right to the RUN button.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PROCESS STOPS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Here is a File attached for controlling servo. RUN THIS GUI.

Step 7: Exporting Data on Excel

Wanna see what is ongoing procedure in this real time process. wanna save your data and file report. then follow these steps.

STEP 1. go to FRONT PANNEL of your GUI

STEP 2. RIGHT CLICK ON THE GRAPH SHOWN THERE

STEP 3. go to EXPORT

STEP4. click on export data to EXCEL

Right CLICK<< EXPORT<< EXPORT DATA TO EXCEL

Analyze all your servo data and parameters

<p>can u send me the controller please i don't have much time to make it.. here is my account: as808780@gmail.com</p>
<p> This tutorial can no longer be used in this way. LIFA (for some odd reason) has been discontinued and LINX has almost no VIs. Seems to me LIFA should still be downloadable and used.</p>
<p>LIFA has been replaced with LIFX. Just an FYI for people who want to use arduino with labview as LIFA doesn't recieve updates anymore.</p>
<p>yes LIFA has been replaced by LINX. but only few programs execute in it.</p><p>For this the program is uploaded by data is not communicated b/w pc and arduino.</p><p>LINX has to be modified. It does not give you desired results.</p>
<p>Thank you very much for this very good instructable. I always thought controlling an arduino peripheral (e.g., servo) from LabView would be cool. You provide all the necessary steps. I will keep this as a reference for the future if I need it.</p>

About This Instructable

13,204views

55favorites

License:

More by parulsharma1991:servo GUI 
Add instructable to: