Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (2024)

UART, I2C and SPI are one of the most common and basic hardware communication peripherals that makers and electricians use in microcontroller development. Similarly, for the Arduino, they contain UART, I2C and SPI peripheral too.

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (1)

For Arduino users, it would not be long before you have to switch from its digital and analog pins to using its onboard communication peripherals as digital and analog pins can only do so much for you.

In this blog, we are going to talk about:

  • UART, SPI, I2C pins on Arduino boards examples
  • Introduction to UART on Arduino
    • Advantages and Disadvantages of using UART
    • Related UART Arduino accessories
  • Introduction to I2C on Arduino
    • Advantages and Disadvantages of using I2C
    • Related I2C Arduino accessories
  • Introduction to SPI on Arduino
    • Advantages and Disadvantages of using SPI
    • Related SPI Arduino

UART, SPI, I2C Pins on Arduino Boards Examples

Before we start, you may be wondering, where are the UART, SPI and I2C Pins on the different Arduino boards since they are onboard peripherals. Here are some examples:

Arduino Uno Rev3($24.95)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (2)
  • The Arduino Uno Rev 3 is a microcontroller board based on the ATmega328, an 8-bit microcontroller with 32KB of Flash memory and 2KB of RAM.
  • It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button

Seeeduino V4.2($6.90)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (3)
  • Seeeduino V4.2 is an Arduino-compatible board, which is based on ATmga328P MCU. There’re so many Arduinos and Arduino-compatible boards in the world, and we think that compared to other Arduinos, it is much more stable, easy-to-use and even good looking.
  • Seeeduino V4.2 is based the Arduino UNO bootloader, and with an ATMEGA16U2 as a UART-to-USB converter, which means that the board can basically work like an FTDI chip.

Seeeduino Nano($6.90)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (4)
  • The Seeeduino Nano is a compact board similar to theSeeeduino V4.2/Arduino UNO, and it is fully compatible withArduino Nanoon pinout and sizes.
  • The same as Seeedunio V4.2, Seeeduino Nano is built around Atmega328P — 8-bit AVR microcontroller. However, the dimensions of the two are significantly different. Less than a quarter of the size, but with almost the same features, Seeeduino Nano will save more space for your project, more suitable for space-constrained scenes.
  • Compared to the Arduino Nano, it has a Type C USB instead of Mini USB and also an additional Grove I2C connector.
  • About Grove:
    • Grove is Seeed very own modular, standardized connector prototyping system.
    • Grove takes a building block approach to assemble electronics, compared to the jumper or solder based system. It is easier to connect, experiment and build and simplifies the learning system for makers.

Without further ado, let us jump right into the first communication peripheral for Arduino: UART

Introduction to UART on Arduino

  • UART, which stands for Universal Asynchronous Reception and Transmission, is a simple serial communication protocol that allows the host (Arduino) to communicate with serial devices.
  • UART supports bidirectional, asynchronous and serial data transmission.
  • It uses 2 data lines to communicate with each other which are: TX (Pin 1) and RX (Pin 0).
    • TX – Used for transmitting
    • RX – Used for receiving
    • They are connected between two devices (eg. USB on Arduino and computer)
  • UART is found on all types of Arduino boards which allows the Arduino to communicate with a computer due to its onboard USB to Serial converter
  • If your program is written on a Windows, Mac or Linux OS and wants to use it with your Arduino, just connect them together via their USB port as if it was a serial port.

For more information on the UART working protocol and operation, check out our other blog here!

Advantages and Disadvantages of using UART with Arduino

Advantages of using UART with Arduino

  • Simple to operate and use with the Arduino. It is well documented online as it is a widely used method by Arduino users with many resources and tutorials online.
  • No clock needed

Disadvantages of using UART with Arduino

  • Lower speed compared to I2C and SPI
  • Baud rates of each UART must be within 10% of each other to prevent data loss.
  • Cannot use multiple master systems like the Arduino and slaves.

Related UART Arduino accessories

USB CP2102 Serial Converter

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (5)
  • The USB CP2102 Serial Converter is a small adapter required for the RF Explorer 3G+ IoT for Arduino/Seeeduino board to accept firmware upgrades from a computer.
  • It can also be used as an extra Arduino Serial port if a Seeeduino or other small-form-factor board is used with the RF Explorer 3G+ IoT board.

Grove – UART WiFi V2 (ESP8285)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (6)
  • Grove – UART WiFi V2.0(ESP8285) is a serial transceiver module featuring the ubiquitous ESP8285 IoT SoC. With an integrated TCP/IP protocol stack, this module lets your microcontroller interact with Wi-Fi networks with only a few lines of code.
  • ESP8285 can perform either as a standalone application or as the slave to a host MCU. When ESP8285 hosts the application, it promptly boots up from the flash. The integrated high-speed cache helps to increase system performance and optimize system memory.

Grove – I2C Hub (6 Port)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (7)
  • I2C is a very popular communication protocol. In the Grove system, I2C is used by 80+ sensors for communication. With this I2C hub, it is now even more convenient to connect more I2C Grove modules.
  • Today more and more MCUs use 3.3V communication levels, but the traditional Arduino Uno still uses 5V, which leads to many modules, especially sensor modules, that need to be levelled when using them.
  • With this module, and as most of the Grove sensor modules now have a level shifting function, users do not need to consider the use of 3.3V or 5V MCU when using it.
  • For a more detailed sensor review compatibility, you can view our Grove Selection Guide.

Base Shield V2

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (8)
  • Isn’t it frustrating when your project involves many sensors, LEDs and jumper wires which causes a mess?
  • With this Base Shield V2, it gets rid of your breadboard and jump wires and allows you to add all your Grove Modules to the Arduino UNO very conveniently with 16 Grove connectors on the base shield including analog, digital, UART and I2C.

Introduction to I2C on Arduino

  • I²C, which stands forinter-integrated-circuit, is a serial communication interface designed for microcontrollers.
  • Compared to UART, it is similar but I2C is not used for PC – Device communication but are used with your modules and sensors.
  • It is a simple, bidirectional two-wire synchronous serial bus and only 2 wires (SDA and SCL) to transmit information between devices connected to the bus.
  • With I2C, they are useful for Arduino projects as they would sometimes require many different parts (eg. sensors, expansions, drivers) working together and with I2C, you can connect up to 128 devices on the mainboard while maintaining a clear communication pathway between the master (Arduino) and slave (Modules and sensors) devices!

For more information on the I2C working protocol and operation, check out our other blog here!

Advantages and Disadvantages of using I2C with Arduino

Advantages of using I²C with Arduino

  • Low pin/signal count even with many devices on the bus
  • Flexible = supports multi-master and multi slave communication (eg. can connect the Raspberry Pi together with Arduino)
  • Simple = uses only 2 wires
  • Adaptable = Adapt to the needs of various slave devices.

Disadvantages of using I²C with Arduino

  • Slower speed compared to SPI (next communication peripheral) as it uses pull-up resistors.
  • Open-drain design = limited speed.
  • Requires more space due to the use of resistors
  • Can get complex as the number of devices increase

Related I2C Arduino accessories

Brushless Motor Shield (TB6605FTG)

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (9)
  • The Brushless Motor Shield is a Brushless Motor Driver for Arduino.
  • With the onboard potentiometer, you can adjust the motor speed easily. This shield offers a variety of modes to choose from, you can use the four onboard switches to switch functions.
  • With the onboard Grove I2C interface, you can work with other grove modules with this shield easily, for instance, you can use aGrove – LCD RGB Backlightto display the Motor speed.

I2C Driver/Adapter-Easily Driver I2C Devices

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (10)
  • I²C Driver is an easy-to-use, open-source tool for controlling I²C devices.
  • It works with Windows, Mac, and Linux, and has a built-in colour screen that shows a live “dashboard” of all the I²C activity.
  • Afraid that your I²C connection may go wrong? Do you want to avoid the painful debugging? Well, this I²CDriver right here makes I²C much more user-friendly and it can prevent just that.

Introduction to SPI on Arduino

  • SPI, which stands for the serial peripheral interface, is similar to I2C where it is a different form of serial-communications protocol specially designed for microcontrollers to connect.
  • SPI operates at full-duplex where data can be sent and received simultaneously.
  • Compared to UART and I2C, it is the fastest communication peripheral with an 8Mbits or more data transmission rates.
    • It is typically faster due to its simple protocol. Data/clock lines are shared between devices and each device will require a unique address wire
  • SPI is used in places where speed is important like SD cards, display modules or when info updates and changes quickly like thermometers.
  • However, SPI can only be used with a single master device which is an Arduino with a maximum of 4 slave devices.

For more information on the SPI working protocol and operation, check out our other blog here!

Advantages and Disadvantages of using SPI with Arduino

Advantages of using SPI with Arduino

  • The protocol is simple as there is no complicated slave addressing system like I2C
  • The fastest protocol compared to UART and I2C
  • No start and stop bits, unlike UART which means data can be transmitted continuously without interruption.

Disadvantages of using SPI with Arduino

  • More Pin ports are occupied, the practical limit to a number of devices. (1 master and 4 slave devices)
  • There is no flow control specified, and no acknowledgement mechanism confirms whether data is received unlike I2C
  • Uses four lines – MOSI, MISO, NCLK, NSS
  • No form of error check unlike in UART (using parity bit)
  • No multiple masters.

Related SPI Arduino accessories

Serial CAN-BUS Module based on MCP2551 and MCP2515

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (11)
  • The Serial CAN Bus module provides your Arduino with CAN bus capabilities and allows you to hack your vehicle.
  • It lets you read and write messages to the CAN bus. The Serial CAN Bus module can be connected to your Arduino through the on-board Grove connector through SPI.

2.7” Triple-Color E-Ink Shield for Arduino

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (12)
  • The E-Ink screen is also known as E-paper screen.E-Ink eliminates the need for backlighting and therefore power consumption is ultra-low. And the E-Ink has an extremely wide viewing angle with very high contrast so that it even can be clearly displayed in direct sunlight.
  • The 2.7” Triple-Color E-Ink Display is an Arduino E-Ink display shield, which contains 264×176 pixels, and can display white/black/red for each pixel.
  • This shield communicates with Arduino via the SPI interface and it reserves a Grove I2C interface for use with other modules.

SD Card Shield V4

Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (13)
  • This SD card V4.0 shield provides storage space for your Arduino.
  • Users can read/write SD card via Arduino’s built-in SD library. It supports SD, SDHC and Micro SD cards and will only occupy the SPI port of your Arduino.
  • You can stack this on other shields that work with the unused pins. Additionally, there are preformed I2C and UART port facilitate your connection with Grove modules.

Summary

Even though the 3 different communication peripheral UART, SPI and I2C seem complicated for you to use with the Arduino be it you are a beginner or an experienced engineer, knowing which communication peripheral to use for your projects will definitely save you time and from frustrating moments when your devices don’t work the way you want to.

I have compiled all the various advantages/disadvantages and functions of the various communication peripherals and compared them using a table so you can easily pick which communication peripheral suits your project the most to save you some time:

UART I2C SPI
Complexity Simple
Easy to
chain many
devices.
Complex as a device
increases
Speed Slowest
Faster than
UART
Fastest
Number of devices Up to 2
devices
Up to 128
but may
get complex as devices
increases
1 Master and up to 5 Slave devices,
Number of wires 1 2 4
Duplex Full Duplex Half Duplex Full Duplex
Number of masters and slaves No multiple slaves and masters Multiple
slaves and masters
Only 1 master but can have multiple slaves.

Hope that you have a better understanding of the differences between UART, I2C and SPI now!

About Author

yida

See author's posts

    Tags: Advantages and Disadvantages of I2C, Advantages and disadvantages of SPI, Arduino SPI, I2C, I²C, SPI, uart

    Arduino Communication Peripherals: UART, I2C and SPI - Latest Open Tech From Seeed (2024)
    Top Articles
    Latest Posts
    Article information

    Author: Pres. Lawanda Wiegand

    Last Updated:

    Views: 6590

    Rating: 4 / 5 (71 voted)

    Reviews: 94% of readers found this page helpful

    Author information

    Name: Pres. Lawanda Wiegand

    Birthday: 1993-01-10

    Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

    Phone: +6806610432415

    Job: Dynamic Manufacturing Assistant

    Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

    Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.