0% found this document useful (0 votes)
164 views7 pages

Interfacing Arduino Uart With Labview: Performance Objectives

The document describes interfacing an Arduino with LabVIEW using UART serial communication. It discusses UART protocols and frame formats. It provides steps to send analog sensor data from an Arduino and display it in LabVIEW by reading the serial data stream.

Uploaded by

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

Interfacing Arduino Uart With Labview: Performance Objectives

The document describes interfacing an Arduino with LabVIEW using UART serial communication. It discusses UART protocols and frame formats. It provides steps to send analog sensor data from an Arduino and display it in LabVIEW by reading the serial data stream.

Uploaded by

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

LAB MANUAL

LAB EXPERIMENT – 08: INTERFACING ARDUINO UART WITH LABVIEW

INTERFACING ARDUINO UART WITH LABVIEW

PERFORMANCE OBJECTIVES:
Upon completion of this laboratory exercise, the student technicians/engineers will be able to:
1. Write VIs to interface Arduino UART with LABVIEW.
2. Perform data acquisition and control using LABVIEW.
EQUIPMENT:

1 LABVIEW equipped PC
2 Arduino Microcontroller.
3 Arduino IDE.
DISCUSSION:
UART
UART, or universal asynchronous receiver-transmitter, is one of the most used device-to-device
communication protocols. UART is a hardware communication protocol that uses asynchronous
serial communication with configurable speed. Asynchronous means there is no clock signal to
synchronize the output bits from the transmitting device going to the receiving end.

In serial communication, data is transferred bit by bit using a single line or wire. In two-way
communication, we use two wires for successful serial data transfer.

Embedded systems, microcontrollers, and computers mostly use UART as a form of device-to-
device hardware communication protocol. Among the available communication protocols,
UART uses only two wires for its transmitting and receiving ends.

For UART and most serial communications, the baud rate needs to be set the same on both the
transmitting and receiving device. The baud rate is the rate at which information is transferred to
a communication channel. In the serial port context, the set baud rate will serve as the maximum
number of bits per second to be transferred.

DATA TRANSMISSION
In UART, the mode of transmission is in the form of a packet. The piece that connects the transmitter and receiver
includes the creation of serial packets and controls those physical hardware lines. A packet consists of a start bit,
data frame, a parity bit, and stop bits.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


1
LAB MANUAL
LAB EXPERIMENT - 08: INTERFACING ARDUINO UART WITH LABVIEW

Start Bit
The UART data transmission line is normally held at a high voltage level when it’s not
transmitting data. To start the transfer of data, the transmitting UART pulls the transmission line
from high to low for one (1) clock cycle. When the receiving UART detects the high to low
voltage transition, it begins reading the bits in the data frame at the frequency of the baud rate.

Data Frame
The data frame contains the actual data being transferred. It can be five (5) bits up to eight (8)
bits long if a parity bit is used. If no parity bit is used, the data frame can be nine (9) bits long. In
most cases, the data is sent with the least significant bit first.

Parity
Parity describes the evenness or oddness of a number. The parity bit is a way for the receiving
UART to tell if any data has changed during transmission. Bits can be changed by
electromagnetic radiation, mismatched baud rates, or long-distance data transfers.

After the receiving UART reads the data frame, it counts the number of bits with a value of 1 and
checks if the total is an even or odd number. If the parity bit is a 0 (even parity), the 1 or logic-
high bit in the data frame should total to an even number. If the parity bit is a 1 (odd parity), the
1 bit or logic highs in the data frame should total to an odd number.

When the parity bit matches the data, the UART knows that the transmission was free of errors.
But if the parity bit is a 0, and the total is odd, or the parity bit is a 1, and the total is even, the
UART knows that bits in the data frame have changed.

Stop Bits
To signal the end of the data packet, the sending UART drives the data transmission line from a
low voltage to a high voltage for one (1) to two (2) bit(s) duration.

FRAME PROTOCOL
One key feature that is available in UART yet not fully used is the implementation of a frame
protocol. The main use and importance of this is an added value for security and protection on
each device. Each frame protocol is specifically designed to be unique and secure. You can
design your own frame protocol.

START SEPARATOR DATA VALUE SEPARATOR DATA VALUE SEPARATOR END

YANBU UNIVERSITY COLLEGE


2
LAB MANUAL
LAB EXPERIMENT – 08: INTERFACING ARDUINO UART WITH LABVIEW

TASK-1
USE ARDUINO AS DATA ACQUISITION SYSTEM
In this task this task Arduino is used as analog data acquisition system and displays the analog
reading on serial monitor as data frame.
• START for the data frame is $ sign.
• Separator is a comma (,)
• END is Line Return

START SEPARATOR DATA VALUE SEPARATOR END


$ , Analog Value , ↵

PROCEDURE:
1. Open Arduino IDE and write the following code and upload it to Arduino.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


3
LAB MANUAL
LAB EXPERIMENT - 08: INTERFACING ARDUINO UART WITH LABVIEW

2. Open the Serial Monitor window and monitor the data frame.

YANBU UNIVERSITY COLLEGE


4
LAB MANUAL
LAB EXPERIMENT – 08: INTERFACING ARDUINO UART WITH LABVIEW

TASK-2
DISPLAY THE ANALOG READING ON LABVIEW
In this task the data frame from Arduino is read into LABVIEW and the data value is displayed.

PROCEDURE:
1. On the front panel create the following:
a. Silver>> I/O >> VISA resource name
b. Silver>> String & Path >> String indicator (Data Frame)
c. Silver>> String & Path >> String indicator (Start)
d. Silver>> String & Path >> String indicator..(Data Value)
e. Silver>> Numeric >> Numeric indicator..(Numeric Data Value)
f. Silver>> Numeric >> Guage
2. Change the guage range Right Click on guage >> properties >> Scale, change the Min and Max values.

3. On the block diagram insert the following VI.


a. Functions>> Instrument I/O >> Serial >> Configure Port
b. Functions>> Instrument I/O >> Serial >> Read
c. Functions>> Instrument I/O >> Serial >> Close
d. Functions>> Programming >> Dialog & User Interface >> Simple Error Handler
e. Functions>> Structures >> While Loop
f. Functions>> Programming >> Numeric >> Numeric Constant (Baud Rate)
g. Functions>> Programming >> Numeric >> Numeric Constant (Byte Count)
h. Functions>> Programming >> String >> Match Pattern
i. Functions>> Programming >> String >> Match Pattern
j. Functions>> Programming >> String >> String Constant
k. Functions>> Programming >> String >> String Constant
l. Functions>> Programming >> String >> Number /String Conversion >> Decimal
String to Number
4. Connect the components as shown in block diagram.
5. Run the program.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


5
LAB MANUAL
LAB EXPERIMENT - 08: INTERFACING ARDUINO UART WITH LABVIEW

FINAL CHECKLIST
All the students must make sure, before they leave the Lab:
1. Clean your equipment, materials, and work benches before you leave.
2. Return all equipment and materials to their proper storage area.
3. Submit your lab report and answers to the questions, together with your data,
calculations (if any) and results before the next laboratory sessions.

YANBU UNIVERSITY COLLEGE


6

You might also like