ESP32 RS422

This tutorial instructs you how to use RS422 communication with ESP32. We'll learn through the following steps:

Hardware Used In This Tutorial

1×ESP-WROOM-32 Dev Module
1×USB Cable Type-C
1×TTL to RS422 Module
1×Jumper Wires
1×(Optional) RS422 to USB Cable
1×(Recommended) ESP32 Screw Terminal Adapter

Or you can buy the following sensor kit:

1×DIYables Sensor Kit 30 types, 69 units
Disclosure: some of these links are affiliate links. We may earn a commission on your purchase at no extra cost to you. We appreciate it.

Introduction to TTL to RS422 Module

When employing serial communication on the ESP32 using functions such as Serial.print(),, and Serial.write(), data transmission occurs via the TX pin while data reception takes place through the RX pin. These pins function at TTL level, meaning they handle signals with a limited range. Therefore, for serial communication over longer distances, it becomes essential to convert the TTL signal to RS232, RS422, or RS485 standards.

In this guide, we will explore the use of RS422 (also referred to as RS-422) with the ESP32 by incorporating a TTL to RS422 module. This module facilitates the conversion of TTL signals to RS422 signals and vice versa.


The RS422 to TTL module features two interfaces:

  • TTL Interface (connected to ESP32):
    • VCC Pin: This power pin should be connected to VCC (5V or 3.3V).
    • GND Pin: This power pin should be connected to GND (0V).
    • RXD Pin: This data pin should be connected to a TX pin of the ESP32.
    • TXD Pin: This data pin should be connected to an RX pin of the ESP32.
  • RS422 Interface:
    • A (R+) Pin: This is the RX+ pin of the module. Connect this pin to the TX+ pin (T+ or Y pin) of the other RS422 device.
    • B (R-) Pin: This is the RX- pin of the module. Connect this pin to the TX- pin (T- or Z pin) of the other RS422 device.
    • Y (T+) Pin: This is the TX+ pin of the module. Connect this pin to the RX+ pin (R+ or A pin) of the other RS422 device.
    • Z (T-) Pin: This is the TX- pin of the module. Connect this pin to the RX- pin (R- or B pin) of the other RS422 device.
    RS-422 module Pinout
    image source:

Wiring Diagram

ESP32 TTL to RS422 Wiring Diagram

This image is created using Fritzing. Click to enlarge image

If you're unfamiliar with how to supply power to the ESP32 and other components, you can find guidance in the following tutorial: How to Power ESP32.

How To Program ESP32 to use the RS422 module

  • Initializes the Serial interface:

ESP32 Code

/* * This ESP32 code is created by * * This ESP32 code is released in the public domain * * For more detail (instruction and wiring diagram), visit */ void setup() { // start communication with baud rate 9600 Serial.begin(9600); // Serial Monitor Serial2.begin(9600); // RS422 // wait a moment to allow serial ports to initialize delay(100); } void loop() { // Check if there's data available on Serial if (Serial2.available()) { char data =; // read the received character Serial.print(data); // print the recived data to Serial Monitor } }


You can do a test by sending data from your PC to ESP32 via RS-422 and vice versa. To do it, follow the below steps:

  • Connect ESP32 to your PC via RS422-to-USB cable as below:
ESP32 RS422 to PC communication
  • Install a Serial Terminal Program like Tera Term or PuTTY
  • Open the Serial Terminal Program and configure the Serial parameters (COM port, baurate...)
  • Type some data from the Serial Termial to send it to ESP32.
  • If successful, you will see the echo data on the Serial Terminal.

Video Tutorial

Making video is a time-consuming work. If the video tutorial is necessary for your learning, please let us know by subscribing to our YouTube channel , If the demand for video is high, we will make the video tutorial.