0% found this document useful (0 votes)
6 views53 pages

LabVIEW Manual

This document is a manual for a Modelling and Simulation Lab course, detailing the design of a water level indicator and a guess-the-number game using LabVIEW. It provides step-by-step instructions for creating virtual instruments (VIs) to simulate these projects, including the use of controls, indicators, and block diagrams. Additionally, it includes exercises to reinforce learning and concludes with a tutorial on designing a half-adder circuit in LabVIEW.

Uploaded by

HABTU BEYENE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views53 pages

LabVIEW Manual

This document is a manual for a Modelling and Simulation Lab course, detailing the design of a water level indicator and a guess-the-number game using LabVIEW. It provides step-by-step instructions for creating virtual instruments (VIs) to simulate these projects, including the use of controls, indicators, and block diagrams. Additionally, it includes exercises to reinforce learning and concludes with a tutorial on designing a half-adder circuit in LabVIEW.

Uploaded by

HABTU BEYENE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 53

MODELLING AND SIMULATION LAB

MANUAL
Subject: Modelling and Simulation
Subject Code: McENG 4066
BSc.Semester 2

Department of Mechatronics Engineering


Wollo University Kombolcha Institute of Technology
Water Level Indicator in
LabVIEW:
In this tutorial, we will learn to design a mini-project in LabView that will give us
an indication of the water level in a water tank. When the water level goes
beyond a certain minimum or maximum limit we have specified, an LED will turn
on. We will install two LEDs, one of which will turn on if the water level is less
than the minimum limit and the other if the water level is greater than the
maximum limit. At the end of the tutorial, you are provided with an exercise to do
by yourself, and in the next tutorials, we will assume that you have done those
exercises, and we will not explain the concept regarding them.

Water Level Indicator


A water level indicator is a device designed to measure and display the water
level within a container, tank, or reservoir. It uses sensors or probes that are
placed at different levels to detect the height of the water’s surface. These
sensors then send signals to a control unit, which processes the information and
translates it into a visual or audible output, indicating the current water level. This
is quite valuable in preventing overflow or underflow situations, optimizing
resource management, and ensuring a steady supply of water. Fortunately, this
water level indication system can be simulated in LabVIEW.

We can use water level indicators in various sectors, such as agriculture,


industry, and domestic settings. In agriculture, they provide efficient irrigation
management by ensuring optimal water levels in fields, while these indicators
regulate liquid storage for production purposes in industries. Additionally, we can
use water level indicators in households to prevent overflows in tanks, ensuring a
consistent water supply and preventing waste. The compact design and ease of
use make water level indicators a practical solution for maintaining control over
water resources.

Water level indicator in LabView example


VI
We will now design a VI in LabView. This will give us an indication in the
following scenarios:

 The tank’s water level decreases below a specified lower limit.


 The tank’s water level increases above a specified upper limit.
To do so, first of all, create a VI as we have discussed in Tutorial 1 and save it
for future use by pressing <Ctrl+S>. From the Control Palette on the front panel,
select Numeric and then select Tank, as shown in the figure below.

Tank placement
Place the tank on the front panel and adjust its size according to your needs.
Now from the Control Palette on the front panel, select Numeric and then
select Vertical Pointer Slide, as shown in the figure below.
Pointer slide placement

Tank and Controls


Place three similar vertical slide bars on the front panel. These vertical pointers
are of type control, and one of them is used to control the minimum limit or lower
limit of water level in the tank; one is used to control the maximum limit or upper
level of water level in the tank; and the third is used to control the water level in
the tank present on the front panel of LabVIEW’s VI. The resulting three slides
and a tank are shown in the figure below.
Tank and controls
Now for the indication of maximum and minimum levels, we need two indicators,
i.e., LEDs for visual indication. From the Control Palette on the front panel,
select Boolean and then select Round LED, as shown in the figure below.

LED placement
Front Panel
Place two such LEDs below the vertical pointer in LabVIEW’s VI, one for the
indication of the lower limit of water level in the tank and the other for the
indication of the upper limit of water level in the tank, as shown in the figure
below.

Front panel
Now let’s move toward the block diagram part. First, connect the tank control to
the tank indicator directly, as shown in the figure below.

Tank control and


indicator
Now we have to design a VI in LabVIEW that will compare the current value of
the water level with the specified upper and lower limits. From the function
palette on the block diagram window, select comparison, and then
select greater or equal. As shown in the figure below.
Greater or
equal ? block placement
If we have any ambiguity regarding the working of any block, we can refer to the
LabView help center and see its working in detail.

At the input side of this block, connect the tank level control on the upper input,
and at the lower input, connect the maximum limit control, and at the output,
connect the maximum level indicator, i.e., the round LED, as shown in the figure
below.

Maximum condition block


Do the same for the minimum condition indication too. From the function
palette on the block diagram window, select comparison, and then select less
or equal. As shown in the figure below.
Less than or equal
to block placement
At the input side of this block, connect the tank level control on the lower input,
and at the lower input, connect the minimum limit control, and at the output,
connect the minimum level indicator, i.e., the round LED, as shown in the figure
below.

Minimum condition block

Block Diagram
The complete block diagram for water level detection in LabVIEW is shown in the
figure below.
Block diagram
This block diagram will only run once; if we want it to run continuously, we can
use a while loop and place the whole block diagram inside it. From the Function
Palette, select Structures and then select While Loop. This while loop will then
be dragged to the outer boundary of the block diagram. Refer to the figure below.

While loop structure


After placing the while loop, the block diagram will look like the one shown in the
figure below.
Whi
le loop placed
Now, to add the termination condition for the while loop, click right on the red
button, and from the dropdown menu select create control, as shown in the figure
below.

While loop termination control

Minimum and Maximum Values


This will create a stop button. When we press it during the runtime, the loop will
terminate. Now set the lower and upper limits of the tank as shown in the figure
below.
Minimum and maximum values
Remember that the lower limit should always be less than the upper limit. Now
run the VI and change the level of the water tank from the tank level control. If
the level of the tank is below the lower limit, the minimum LED will turn on, as
shown in the figure below.

Less
than minimum value
If the water level on LabVIEW’s VI is between the maximum and minimum
values, then both LEDs will be off, as shown in the figure below.
With
in range
And if the water level on LabVIEW’s VI is higher than the upper limit, the
maximum LED will turn on, as shown in the figure below.

Gre
ater than maximum value
Exercise
 Update the VI provided above to display the water level in a numeric
indicator, and both the minimum and maximum limits of the water level are
also displayed in a numeric indicator.
Conclusion
In conclusion, this tutorial has provided a comprehensive overview of the
importance of water level indicators and how to build them in LabVIEW. This also
covers step-by-step procedures for designing a block diagram of this water level
indicator in LabVIEW’s VI purpose. This helps us understand the principle of
level detection for application. You can utilize this concept in various applications,
including level indication for a specific task. Lastly, an exercise is provided to
reinforce the concept of water level indication in LabVIEW. We hope that this
tutorial has been helpful in expanding your knowledge of LabVIEW programming.

Guess the Number Game in LabVIEW


Example
Now let’s design a VI that performs the operation described above. First of all,
create a VI as we have done in Tutorial 1 and save it for future use, as we have
been doing in the entire previous tutorial.
The VI we are going to design will generate random numbers within the range of
0 to 10, and it will compare the input value of the user with the randomly
generated number; if they are the same, the indicator LED will turn on; otherwise,
it will remain off.

From the Function Palette on the block diagram, select Numeric, and then
select Random Number, as shown in the figure below.
Rando
m generator
The problem here is that the built-in random number generator generates
random numbers within the range of 0–1, and it generates floating-point random
numbers, whereas we want to compare them with integers. Hence, first we have
to somehow manipulate the range of the random number generator to 0-10.

We can do this simply by multiplying the output of the random number generator
by 10. From the Function Palette on the block diagram, select Numeric, and
then select Multiply, as shown in the figure below.
Multiply block
Connect one input side of this block with the output of the random generator, and
on the other input side, create a constant as shown in the figure below and give it
a value of 10.

Constant placement

Random Number Generator


After doing so, the block diagram thus formed will generate random numbers
within the range of 0–10, but the numbers will be of type float, as shown in the
figure below.
Floating random number
Now if we want to convert this random number from floating point to integer, we
will use a built-in block of LabView. From the function palette on the block
diagram, select numeric, then select conversion,and then select long integer, as
shown in the figure below.

Using an integer block


This block will apply the ceil function and change the floating point number to its
next integer. At the output of this block, create an indicator to keep track of the
number to guess, as shown in the figure below.
Indicator creation
Now from the Control Palette on the front panel, select Numeric and then
select Control, as shown in the figure below.

Creating control
This control will take the input value from the user, compare it with the randomly
generated value, and display the correct guess in the form of an LED indicator.

Don’t forget to name or label every control and indicator according to their work
in the VI. Now for the comparison portion of the VI, from the Function
Palette, select Comparison, and then select Equal. As shown in the figure
below,
Comparison block placement
At one input of this block, connect the output of the ‘to integer’ block that was
generating random numbers, and at the other input, connect the numeric control
whose values are taken from the user as a guess.

Comparison Block
This block will compare both values; if they are equal, the output of the block will
be returned as true and false otherwise. The comparison block diagram is shown
in the figure below.

Comparison block
At the output node of this block, press right-click, and from the drop-down menu,
select Create, and then select Indicator, as shown in the figure below.
LED indicator for correction

Block Diagram
This will create an LED indicator to show the correctness of your answer. The
complete block diagram of your VI is shown in the figure below.

Block diagram

Output
Finally, enter a value in the control and run the VI. If the guess matches the
number generated, the LED will turn on, as shown in the figure below.
Correct guess
If the number generated by LabVIEW is different from the number guessed by
the player. Then the LED will remain off, as shown in the figure below.

Guess is incorrect
Now, in order to keep the randomly generated number a secret, we will delete
the numeric indicator from the block diagram and run the VI. The correct and
incorrect conditions are shown in the figure below.

Incorrect guess
Correct guess

Exercise:
 Create a guess number game that will allow you to guess numbers in the
range 2–8 instead of 0–10.
Conclusion
In conclusion, this tutorial provides an in-depth overview of how to develop a
guess-the-number game in LabVIEW. This tutorial also provides a step-by-step
procedure for developing the game. You can utilize this concept and add more
rules and functionalities as you like. At the end, an exercise is also provided to
reinforce the concept of the guess the number game in LabVIEW. Hopefully, this
tutorial was helpful in expanding your knowledge of LabVIEW.

Half-Adder Circuit Design in


LabVIEW: Tutorial 31
In this tutorial, we will learn how to design a half-adder circuit using LabVIEW. Prior
knowledge of LabVIEW is assumed, so if you’re unfamiliar with it, we recommend reviewing
some introductory materials first.

For those already acquainted with digital logic design, you likely know the purpose and
workings of a half-adder in the context of digital systems. In this tutorial, we will design a VI
(Virtual Instrument) that accepts two logic inputs (0 or 1) from the user and returns the sum and
carry when these inputs are added together. We’ll begin with a brief introduction to the half-
adder, followed by the step-by-step process of designing the VI for performing the half-adder
operations.

Introduction to Half-Adder Circuit


An electronic or digital circuit that performs the addition of two binary numbers and is a type of
adder is known as a half-adder. Two single binary digits are added in a half-adder, and it is able
to return the output with a carry value. A simple half-adder has two inputs, called A and B, and
two outputs, S (sum) and C (carry). The common representation uses an XOR logic gate and an
AND logic gate.

How to Design Half-Adder Circuit in


LabVIEW
Let’s design a VI that will do a simple half-adder operation in LabView. First of all, create a VI
as we have discussed in Tutorial 1, and save it for future use, as we have been doing in all the
previous tutorials.
Now we have to set the Boolean inputs for the input values A and B to be added and the two
Boolean outputs to display sum and carry. For Boolean inputs, we will use Boolean control, i.e.,
a push button. On the front panel, press right-click, and from the Control
Palette, select Boolean, and then select Push Button, as shown in the figure below.

Boolean control placement

Place two such push buttons for two binary single-digit inputs. Now, in order to place an
indicator for the binary output indication, we have to place LEDs. On the front panel, press right-
click, and from the Control Palette, select Boolean, and then select Square LED as shown in
the figure below.
Boolean indicator

Controls and Indicators


Place two indicators to display the sum and carry on the output. The resulting controls and
indicators are shown in the figure below.

Controls and
indicators

Never forget to name the blocks accordingly. Now move to the block diagram for XOR and
AND gate placement. From the Function Palette on the block diagram window,
select Boolean and then select “Exclusive Or”, as shown in the figure below.
Exclusive Or placement

Summing Block
This block will return the sum of the half-adder output. At the input of this block, connect the
two Boolean controls created previously, and at the output of it, connect the Boolean indicator,
i.e., the square LED you created and named sum previously, as shown in the figure below.

Summing block

To design the carry operation, we have to use an AND gate. From the Function Palette on the
block diagram window, select Boolean and then select AND, as shown in the figure below.
AND block placement

Carry Block Diagram


This block will return the carry of the half-adder output. At the input of this block, connect the
two Boolean controls created previously, and at the output of it, connect the Boolean indicator,
i.e., the square LED you created and named carry previously, as shown in the figure below.

Carry block diagram

Block Diagram
The complete block diagram of a half-adder is shown in the figure below.
Block diagram

The output of the half adder should be according to the table given below:

A B Sum Carry

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

Now on the front panel, set the values of both A and B to 0 and run the VI. Both the LEDs will
remain on according to the above table, as shown in the figure below.

Output 1
Now change the value of A to 1 and keep the value of B to zero, and again run the VI. According
to the table, the sum LED will turn ON and the carry will remain OFF, as shown in the figure
below.

Output 2

Now change the value of A to 0 and the value of B to 1, and again run the VI. According to the
table, the sum LED will turn ON and the carry LED will remain OFF, as shown in the figure
below.

Output 3

Set the values of both A and B to 1 and again run the VI. The carry LED will now turn ON, the
sum LED will turn OFF, and the output will again be in accordance with the above table, as
shown in the figure below.
Output 4

Conclusion
In conclusion, this tutorial provides an in-depth overview of designing a half-adder circuit in
LabVIEW’s VI. It also covers a step-by-step procedure explanation of each part of the example
in detail. This helps us better understand the concept of designing a half-adder circuit in
LabVIEW’s VI. You can utilize and improve this tutorial’s concept to design a full adder circuit
in LabVIEW as well. Hopefully, this tutorial was helpful in expanding your knowledge of
LabVIEW

Design Full Adder Circuit in


Labview: Tutorial 32
In the last tutorial, we saw how to design a half adder circuit in LabVIEW. In this tutorial, you
will learn how to design a full adder circuit in LabVIEW. If you are familiar with digital logic
design, you should know the purpose and working of a full adder in digital logic design or digital
systems. It is similar to the half-adder we discussed in the previous tutorial. I will help you
design a VI that will take two binary inputs from the user and return the sum and carry after
adding them. At the beginning, a brief introduction to the full adder is provided. After that, a VI
is designed to perform the full adder operation for three binary inputs. At the end of the tutorial,
you are provided with an exercise to do on your own.
Design Full Adder Circuit in LabVIEW
In order to add three binary digits, we will need an adder, namely a full adder circuit. This
adder will take three binary digits as input and, at the output, it will return two outputs named
sum and carry. The implementation of a full adder is a little more difficult than a half adder, as
you will see shortly in the programming portion. A full adder has three inputs and two outputs,
whereas a half adder has two inputs and two outputs. This is the main difference between a half
adder and a full adder.
Full Adder Circuit in LabVIEW
Example
First of all, create a VI as we have discussed in tutorial 1 and save it for future use, as we have
been doing in all the previous tutorials. Now we need to set three Boolean inputs for the values
A, B, and C that will be added, and two Boolean outputs to display the sum and carry. For the
Boolean inputs, we will use a Boolean control, specifically a push button. On the front panel,
right-click and select Boolean from the control palette, then choose Push button, as shown in
the figure below:

Figure 1: Boolean controls placement

Place three push buttons for two binary single-digit inputs. Now, in order to place an indicator
for the binary output indication, we have to add LEDs. On the front panel, right-click and from
the control palette, select Boolean. Then, choose Round LED as shown in the figure below.
Figure 2: Boolean indicator

Place two indicators, also display the sum, and carry on the output. The resulting controls and
indicators are shown in the figure below.
Figure 3: Control and indicators

Now move to the block diagram for XOR, OR, and AND gate placement. From the function
palette on the block diagram window select Boolean and then select Exclusive Or as shown in
the figure below,

Figure 4: Exclusive Or placement

Place two such blocks as we are interested to do the XOR operation on three inputs. The output
of these blocks will return the sum of the full adder output.

At the input of the first block, connect the two Boolean controls A and B. Connect its output to
the input of the next XOR block. Then, connect the C control to the remaining input node of the
second XOR gate. At the output of the second XOR gate, connect the Boolean indicator (the
round LED) that you have previously created and named as “sum.” The figure below shows the
correct connections:
Figure 5: Summing block of full adder

To do the carry operation we have to use two AND and one OR gates. From the function
palette on the block diagram window select Boolean and then select AND as shown in the figure
below,

Figure 6: And block placement

At the input of this AND gate, connect the output of the first XOR gate and the C control. Place
another AND gate with inputs connected to A and B control. Now, from the function palette on
the block diagram window, select Boolean and then select OR as shown in the figure below:
Figure 7: Or block placement

At the inputs of these or blocks connect the output from the two and gates and at the output node
of this block connect the indication of output carry as shown in the figure below,

Figure 8: Carry block of full adder

The complete block diagram of a full adder is shown in the figure below,
Figure 9: Block diagram

The output of the full adder should be according to the table given below:

A B C Sum Carry

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 1

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1
Now on the front panel, set the values of both A, B, and C as 0 and run the VI, both the LEDs
will remain of as according to the above table, as shown in the figure below,
Figure 10: Output 1

Now change the values and test the VI for different combinations of inputs as shown in the
figure below,

Figure 11: Output 2

Exercise
 Test the designed circuit for all the remaining combinations from the table and verify the
output from the table.
Conclusion
In conclusion, we have learned how to design a full adder circuit in LabVIEW. A full adder is a
crucial component in digital logic design and digital systems, as it allows us to add three binary
digits together, producing a sum and a carry output. Through the step-by-step process outlined in
this tutorial, we have constructed a VI that takes user inputs and provides the corresponding sum
and carry values. By understanding the differences between a half adder and a full adder, and
implementing XOR, OR, and AND gates in LabVIEW, we have successfully designed a
functional full adder circuit. This tutorial serves as a foundation for further exploration into the
realm of digital logic design and its practical applications.

DC Motor Control with


LabVIEW and Arduino –
Tutorial 3
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:

 Arduino UNO board


 5V DC motor
 L293D motor driver
 Breadboard
 Jumper wires
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.


 LabVIEW
 Arduino interfacing for LabVIEW
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


 Start the LabVIEW software.
 Create a Blank VI as shown in Tutorial 1.
 Go to the LabVIEW “Block Diagram” Panel.
Using Arduino Components in Labview
 Right-click on the white space. Go to “Arduino” and select “init”. This will
add Initializations to the Arduino board.
 Bring Cursor anywhere in the LabVIEW “Block Diagram” panel and place
the “Init”.
Setting Void Setup Function in LabVIEW
 The first input is “VISA resource”. It is the serial port we are using for
interfacing with Adruino. We can find it in the “device manager” of our
computer under “ports (COM & LPT)…”. Make sure the Arduino board is
connected to the computer; otherwise, it won’t be shown. In our case, it is
COM4.
 Bring the cursor to the first input of “Init” until it shows “VISA resource”.
Right-click on it. Go to “create” and select “constant”. As it will be a
constant value of port, which will always be used for serial communication.
 Click on the arrow; it will show the available options. In our case, it’s
“COM4”. Select the appropriate one after checking the device manager as
mentioned above; otherwise, it won’t work.

 The second input is “Baud Rate”. Create it as a constant, as done for


“VISA resource”. Right-click on “Baud Rate” then “create” and then
“constant”.

 The third input is “Board Type”, the fourth is “Bytes per packet”, and the
fifth is “Connection Type”. We will make them all constant.

Setting Void Loop function in LabVIEW


 Click on the white space on LabVIEW’s “Block Diagram” and follow
“Structure → select While loop”.
 Draw a rectangle on LabVIEW’s “Block Diagram” and click on the red-
colored round icon “loop condition”. Create a constant by right-clicking on
it. It will show a “STOP” icon on the diagram.
Using Digital and PWM Write Functions in
LabVIEW
 Place 2 “Digital Write Pin” and 1 “PWM Write Pin” blocks as shown below.
We need two digital write pins to control the direction of the motor in two
different directions (left and right). A PWM pin will be used to control the
speed of the motor.
Similarly, place the second “Digital Write”. Place the “PWM write pin” Block on
the LabVIEW “Block Diagram” panel.
 Place “Close Block” as follows:
 This process results in the following LabVIEW Block diagram:
 Click on the white space on “Block Diagram” and follow “Arduino → Low
Level → and select “Set Digital Pin”.
 Place “Set Digital Pin” on “Block Diagram”. Place 3 “Set Digital Pin” blocks
on the “Block Diagram”. These results are as follows:
Making Connections in the LabVIEW
Program
 Join the above diagram as shown below. You can take help from previous
tutorials.

 Further, join the blocks as shown in the diagram. We also need to place
two more “close” blocks. For PWM input, we create control as done
previously, and for all other inputs, we create constants.
Opening LabVIEW program in Arduino IDE
 Now start the Arduino IDE.
 Click “File”, then “Open”, as shown below. Now, go through all these
folders from “Computer” onward and open the LIFA_BASE Arduino file.
 Upload the program opened in Arduino IDE using the Arrow button on top
of Arduino IDE.
 Once uploading is done, close the Arduino IDE. It’s very important to close
the Arduino IDE because both LabVIEW and Arduino are using COM4. If
not closed, LabVIEW will not be able to communicate, and LabVIEW
software will crash.
 Now go to the front panel in LabVIEW and run the program in the toolbar
menu of LabVIEW.
 When we right 1 at the place of “direction 1”, the motor rotates in one
direction. When we right 1 at the place of “direction 2”, the motor rotates in
the other direction. Be careful when doing this; do not set 1 for “direction 1”
and “direction 2” simultaneously. Both direction controls should not be on
at once. If one direction control is 1, the other should be 0. Otherwise,
L293D will suffer permanent damage. One more thing to note is that speed
should be somewhere between 0 and 255; otherwise, the motor will not
rotate.
 By varying speed between 0 and 255, we can see that motor speed varies.
At 0, the motor stops, and at 255, it rotates at maximum speed.
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 might also like