What is UART protocol and how to setup it with Arduino?

by May 25, 2020Arduino Uno, IoT Connectivity

In this tutorial, you are going to learn firstly, about the UART protocol used in communication system. Secondly, we will also see various sensors using this protocol So, let us begin!

Contents:

What is UART ?

UART stands for Universal Asynchronous Receiver/Transmitter. It is a peripheral that is present inside a microcontroller. It’s function is to convert the incoming and outgoing data into the serial binary stream. The letter ‘A’ here stands for Asynchronous. This means there is no clock signal to synchronize or validate the data transmitted from transmitter and received by the receiver (Asynchronous Serial Communication). This is in contrast to Synchronous Serial Communication. As a result, it uses a clock signal that is shared between the transmitter and receiver in order to “Synchronize” the data between them.

UART communication

UART transmits data which is organized into packets. Each packet contains 1 start bit, 5 to 9 data bits (depends), an optional parity bit, and 1 or 2 stop bits.

Packet

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

Why to choose UART protocol?

Protocols like SPI (serial peripheral interface) and USB (Universal Serial Bus) are used for fast communication. So it is mostly used when high speed data is not required. For example, there are various embedded systems in which continuous data is not transmitted. In such scenario, this works best. It is a cheap communication device with a single transmitter/receiver. Most importantly, it requires a single wire for transmitting the data and another wire for receiving.

More Features

The UART performs serial-to-parallel conversions. The data is received from a peripheral device and parallel-to-serial conversion on data received from the CPU. The CPU can read it’s status at any time. The UART includes control capability and a processor interrupt system too. This can be tailored to minimize software management of the communications link.

The hardware for UART can be a circuit integrated on the microcontroller or a dedicated IC. This is contrast to SPI or I2C, which are just communication protocols. 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.

Sensors based on UART protocol

There are multiple sensors using the UART protocol. Some prominent ones are:

  1. Bluetooth Module: The HC-05/HC-06 modules are based on the USART protocol only. The Rx/Tx pins present in the sensor are joined with the Tx/Rx pins of the controller respectively. The Tx pin transmits Serial Data. The bluetooth receives everything and this pin gives it out as serial data. The Rx pin receives Serial Data. Every serial data given to this pin will be broadcast via Bluetooth.
  2. GPS module: It is used for navigation. The module simply checks its location on earth and provides output data which is longitude and latitude of its position. You can read more about it here.
  3. Particulate Sensor: This is used to measure the air quality and tells the PM2.5 or PM10. HPMA115s0-XXX is also one of these. It also uses the UART protocol. Read more about it here.

Using in Arduino communication

The Arduino is compatible with various communication protocols. We use I2C protocol sensors like the MPU 6050, SPI protocol sensors etc. The Arduino board and a computer or other devices use serial communication. Moreover, all Arduino boards have at least one serial port (also known as a UART or USART), and some have several.

Serial communication being set in Arduino

You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin(). You can read more about it here.

With this I conclude the blog, I hope you will explore more in the topic. Feel free to write any query in the comment section. Happy Learning!

Creating a multiplication Skill in Alexa using python

Written By Anmol Punetha

Hey, I am Anmol. I am a tech blogger and an electronics engineering student at the same time. As you're reading my blog, you are getting a generous amount of information in simpler words. Hope it's of use. Thank you for visiting. Keep reading!

RELATED POSTS

What is Edge Intelligence: Architecture and Use Cases

What is Edge Intelligence: Architecture and Use Cases

Introduction With the latest advancements in AI technologies, we have noticed a significant increase in the deployment of AI-based applications and services in recent years. More recently, with the booming IoT industry in particular, billions of mobiles and IoT...

Apache Kafka vs Apache Spark : All you need to know

Apache Kafka vs Apache Spark : All you need to know

Introduction Due to the increase in the volume of data, the demand for Stream processing is on the rise. Just processing the data wouldn't be enough, it should be done quickly too so that organizations can react to changing market conditions on a real-time basis. This...

Creating a Multiplication Skill in Alexa using Python

Creating a Multiplication Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a custom multiplication skill in Alexa using Python. If you're completely new to Alexa skills, you can get a brief idea about it by clicking here. Subsequently, we have posted regarding account...

Creating a Hello World Skill in Alexa using Python

Creating a Hello World Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a Hello World Skill in Alexa Developer Console. This is the most basic skill, and it would give us an idea about Skill-building using Alexa's developer console. If you're completely new to Alexa, you...

Creating a custom Date-Time skill in Alexa using Python

Creating a custom Date-Time skill in Alexa using Python

Introduction In this tutorial, we will look at how to create a simple date-time skill in Alexa using Python. For this skill, the only prerequisites required are an Alexa developer account and some basic understanding of Python. Also, we have created a post on how to...

All you need to know about Amazon Alexa Skills

All you need to know about Amazon Alexa Skills

Introduction In this tutorial, we will be taking a quick look at Amazon Alexa Skills. So, let us get started with the most common question - What Is Amazon Alexa? Alexa is nothing but a cloud-based voice service provided by the tech giant Amazon. In today's world,...

How to use simulators to build Arduino Projects

How to use simulators to build Arduino Projects

Introduction In this tutorial, let's learn how to use simulators for building Arduino projects for beginners. In addition to it, We shall learn how to configure it and how to get started with simulation tools. Here, We shall take an example of blinking an led using...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....