top of page

How microcontrollers communicate with other peripherals? Difference between SPI, I2C, UART, CAN& USB

Updated: Jul 1, 2022

What are the main ways instruments communicate with microcontrollers? What are SPI, I2C, UART, CAN, and USB? What are the differences between them?

Would you like to know how instruments communicate with microcontrollers? In this blog, we will learn about the most common communication protocols used by the industry.

Instruments rely on electronics to provide signals and read them. Sometimes these electronics are complex, such as the amplifier and speakers in an instrument. Often, they are simple, such as a guitar’s pickups or a microphone’s diaphragm. Regardless of their complexity, all electronics require some form of interface to connect with the outside world.

What are microcontrollers?

Microcontrollers are the brains of these modern digital devices. They receive inputs from sensors, manage data, and respond to commands. They are the primary building blocks of IoT devices and the heart of most modern tech. But how do microcontrollers communicate with other devices?

What is a protocol? The language of microcontrollers!

Communication between electronic components is comparable to human communication. To communicate with one another, we must use the same language. These dialects are known as communication protocols for electronic components. To exchange information between computers and instruments, we need protocols.

The most common communication protocols for use with microcontrollers include Serial Peripheral Interface (SPI), Inter-Integrated Circuit (I2C), Universal Asynchronous Receiver/Transmitter (UART), Controller Area Network (CAN), and Universal Serial Bus (USB).

SPI (Serial Peripheral Interface)

Communication between instruments and microcontrollers can be accomplished in several ways. The most common method is to connect via a serial peripheral interface. SPI interface is a digital link standard that is typically used to transfer data between microcontrollers and microprocessors. It is used to transfer data at high speeds and with low power consumption over a short distance. SD card modules, RFID card reader modules, and other devices all rely on SPI as their common communication protocol.

SPI has a faster rate of data transfer. In SPI, devices interact with one another as master and slave. It is a half-duplex, bi-directional, two-wire bus system for data transmission and reception. The master is the controlling device, which is typically a microcontroller. The slave can be a sensor, display, or memory chip, which follows the master's instructions. Since there are no start and stop bits in SPI, data can stream continuously, allowing for uninterrupted data transfer.

What is I2C?

I2C, or the Inter-Integrated Circuit, is a bus interface standard that is used to transfer information between microcontrollers and other devices. It is one of the most common bus standards used in modern electronic devices, with billions of I2C devices existing in the world today. The primary purpose of I2C is to transfer small amounts of data between two devices, such as a sensor reading or an LED turning on.

I2C only uses clock and data signals. Every I2C device uses open-drain output drivers to interface with the data and clock signals. Here, each slave has a 7-bit address, and the master needs to be aware of these addresses to communicate with a specific slave. The master has the ability to write data to one or even multiple slaves. Additionally, it can ask any slave for data. Therefore, a master starts and stops every transmission.

UART: The most common asynchronous serial interface

UART (Universal Asynchronous Receiver-Transmitter) is one of the two serial ports of microcontrollers. UART was designed to asynchronously communicate with a device like a computer, a GPS, or network equipment without draining too many CPU cycles. It is the most common asynchronous serial interface used for serial communications between microcontrollers and sensors.

Since the UART protocol uses no clock source to synchronize the data, there is a much higher chance of data loss. Two wires connect the transmitting and receiving ends of UART. A transmitter and receiver line's primary function is to send and receive serial data for serial communication. A controlling data bus that relays data in parallel is connected to the transmitting UART. The data is sent to the corresponding UART serially, or bit by bit, over the transmission line. The serial data is then transformed into parallel data for the receiving device by the receiving UART.

CAN (Controller Area Network)

The CAN (Controller Area Network) bus is a serial communication protocol used to connect multiple electronic devices in a system.

Original image courtesy:

CAN is a method of data communication over two or more points in a network without the need for a centralized communications controller. The CAN protocol is used primarily in automotive applications such as vehicle infotainment. This protocol is used to send and receive data among devices on a vehicle, such as temperature sensors, airbags, displays, entertainment systems, radio, navigation, and many others. It is also applied in industrial applications for inter-communication between devices and the control system.

CAN can self-diagnose and fix data errors and has high immunity to electrical interference. These characteristics have contributed to CAN's acceptance in a lot of industries, including automation, healthcare, and manufacturing. CAN bus is a broadcast type of bus. This indicates that every node can hear every transmission. It is not possible to send a specific message to a particular node. All traffic will be picked up by all nodes. The CAN hardware provides local filtering so that each node can focus primarily on the interesting messages. CAN employs relatively short messages. 94 bits are the maximum utility load.

USB: The de facto standard for connecting peripherals

USB is a popular serial bus standard for connecting digital devices. As of 2019, the USB Consortium has more than 170 members, including consumer electronics companies, system integrators, and original equipment manufacturers. It is used in a wide variety of computer systems and products, such as computers, tablets, smartphones, automobiles, and medical equipment. It is widely accepted that USB is the de facto standard for attaching peripheral devices, such as keyboards, mice, cameras, and external hard drives, to personal computers.

USB hosts, also known as "master devices," are responsible for all communication over the USB bus. Examples of slave devices are USB flash drives, keyboards, and other similar items.


Microcontrollers power modern electronics. They control everything from lighting to motion to speech. Microcontrollers communicate with sensors and other devices using specialized protocols. Protocols vary based on the microcontroller and the communication device. A microcontroller typically communicates with other devices using Serial Peripheral Interface (SPI), Inter-Integrated Circuits (I2C), Universal Asynchronous Receiver/Transmitter (UART), Controller Area Networks (CAN), and Universal Serial Buses (USB).



bottom of page