UART (Universal Asynchronous Receiver/Transmitter), is a hardware device (or circuit) used for serial communication between two devices. In this blog, we will discuss what UART communication is and how it works. We’ll also write a simple sketch to show it’s with the Arduino Uno.

How does UART work?

The UART protocol requires two wires between the devices that are communication, one for each direction of communication. Each of these devices have an independent transmitting and receiving module. These modules do not have to be in sync with each other, hence asynchronous.

When a device transmits data, it sends it as a series of pulses, where each pulse represents one bit of data. These pulses are sent with a particular, predefined timing called baud rate that must be understood by both devices.

Now, for two devices to communicate with UART serial, three wires need to be connected. The first two are communication wires — the transmitter (TX) of the first has to connect to the receiver (RX) of the second and the TX of the second to the RX of the first; the third wire needs to be grounded. The TX and RX pins of an Arduino board are pins D0 (RX0) and D1 (TX0). Labelled as TX and RX, they are connected to the UART-USB bridge of the board, so when the board is connected to the PC via USB, the UART of that Arduino is already wired to a virtual serial port on the computer (i.e. COM3). This allows the board to send and receive data with a serial terminal on the PC.

Now that we’ve a brief idea of how the UART works, let’s build a simple sketch demonstrating how to use the UART communication using Arduino Uno. In this project we’ll be sending a character from the PC and it’ll be serially printed on the serial monitor. Also a character string will be given to the PC that will be displayed on the serial monitor.

Once you run this program, you should be able to see the character & string displayed on the serial monitor. So you can verify that the serial transmission is working when you see “vicara” displayed on the serial monitor & for serial reception a character given from the computer will be displayed on the monitor. Thus both the channels will get verified.

In this blog, we learnt about the UART, Serial Communication, how it works and how it enable it on the Arduino with a simple example.