DC Motor Control with LabVIEW and Arduino - Tutorial 3 (original) (raw)

dc motor speed control with Labview and Arduino

In this tutorial, we are going to look at DC motor Speed Control through LabVIEW and Arduino. In today’s tutorial, we will see how we can control the speed of a DC motor through LabView and Arduino. We will start building VI from scratch and then control the speed and direction of the DC motor from the LabVIEW graphical user interface. If you do not know about LabVIEW, I suggest you check out this post on Getting Started with LabVIEW and Arduino with LabVIEW.

Hardware Components – DC Motor Speed Control with LabVIEW

Hardware requirements for this project are as follows:

Note: Make sure to use a 5V DC motor as it can get directly powered from the Arduino; otherwise, you might have to modify the motor driving circuit for high current and voltage to drive the motor. Another thing to make sure of is that if you are using an Arduino motor driver shield (with integrated chips) instead of the L293D motor driver, a little modification of the code is required for the LabVIEW program to run with the L293D motor driver shield.

Software Requirements:

In this section, we will list the software used in this tutorial.

Note: If you have not installed the software mentioned above, please refer to our previous article where we programmed Arduino with LabVIEW. In the previous tutorial, we wrote our first program to control the LED connected to pin 13 of the Arduino UNO board with a push button created in LabView.

Schematic Diagram

In this section, we will show a step-by-step process to wire the circuit correctly. Below is the pin configuration of motor driver L293D.

Put the motor driver L293D chip in the middle of the breadboard. This ensures that pins on both sides are not shorted together.

Follow the table below to connect the L293D motor driver with the Arduino Board:

Motor Driver L293D pins Arduino UNO board pins
8 and 16 5V or VIN
4 and 5 GND
7 4
2 5
1 6

Table 1: Connection between Motor driver and Arduino

Now we will move on to connecting the motor with the L293D driver chip. The connections are as follows:

Motor Driver L293D pins 5V DC motor pins
3 Terminal 1
6 Terminal 2

Table 2: Connection between motor driver and DC motor

We are done with the hardware connections of the circuit for this project; now we can move on to the next step, which is the programming part in LabVIEW.

LabVIEW Program for Controlling DC Motor Speed and Direction

In this section, we will write a LabVIEW Program to control the speed and direction of a DC motor.

Initializing the LabVIEW Program

Using Arduino Components in Labview

Setting Void Setup Function in LabVIEW

Setting Void Loop function in LabVIEW

Using Digital and PWM Write Functions in LabVIEW

Similarly, place the second “Digital Write”. Place the “PWM write pin” Block on the LabVIEW “Block Diagram” panel.

Making Connections in the LabVIEW Program

Opening LabVIEW program in Arduino IDE

Video Demo:

In summary:

In this tutorial, we learned DC motor control with LabVIEW and Arduino and how to interface LabVIEW with Arduino to precisely regulate DC motor speed and direction.

You may also like to read:

Arduino Components Amazon Links
Arduino Starter Kit Buy Now
Arduino Development Kit Buy Now
Arduino Smart Robot Car Kit V4 Buy Now
Arduino Sensors Kit Buy Now