ESP32 C3 Super Mini - RS422

The ESP32 C3 Super Mini is a tiny 3.3V board that can talk over long cables when you add a TTL to RS422 module. RS422 is a rugged serial standard used in factories, boats and building systems. This tutorial shows you how to wire it and how to send and receive data with simple code.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - RS422

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×TTL to RS422 Module
1×Jumper Wires
1×Optionally, RS422 to USB Cable

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of TTL to RS422 Module

A TTL to RS422 module is a small converter that changes the ESP32 C3 Super Mini's TTL serial signals into RS422 signals, and back again.

Why you need it:

  • The ESP32 C3 Super Mini's TX and RX pins use TTL level (3.3V) signals.
  • TTL signals only travel a short distance, about 1 meter on a breadboard wire.
  • RS422 uses two wire pairs with opposite voltages, so noise cancels out.
  • This lets your data travel much further, with far fewer errors.

Key Features:

  • Full duplex: RS422 sends and receives at the same time, on two separate pairs.
  • Long distance: Up to about 1200 m (4000 ft) at a low baud rate.
  • Noise resistant: Differential signalling ignores electrical noise from motors and relays.
  • Multi-drop receive: One transmitter can feed up to 10 receivers.
  • No driver needed: The module converts the signals in hardware, with no extra software.

Technical Specifications:

  • TTL side voltage: 3.3V or 5V. Use 3.3V for the ESP32 C3 Super Mini.
  • Signal type: Differential, two pairs. One pair sends, one pair receives.
  • Typical chips: MAX13487, MAX3422 and similar RS422 transceivers.
  • Max cable length: About 1200 m at a low baud rate, shorter at high speeds.
  • Common baud rates: 9600, 19200, 38400, 57600, 115200.

Pinout

The RS422 to TTL module has two sides: a TTL side that faces your board, and an RS422 side that faces the long cable.

TTL Interface (connected to the ESP32 C3 Super Mini):

  • VCC: Power pin. Connect to 3.3V on the ESP32 C3 Super Mini.
  • GND: Ground pin (0V). Connect to GND.
  • RXD (DI): Data input. Connect to a TX pin of the ESP32 C3 Super Mini.
  • TXD (RO): Data output. Connect to an RX pin of the ESP32 C3 Super Mini.

RS422 Interface (the long cable side):

  • A (R+): The RX+ pin of the module. Connect to the TX+ pin (T+ or Y pin) of the other RS422 device.
  • B (R-): The RX- pin of the module. Connect to the TX- pin (T- or Z pin) of the other RS422 device.
  • Y (T+): The TX+ pin of the module. Connect to the RX+ pin (R+ or A pin) of the other RS422 device.
  • Z (T-): The TX- pin of the module. Connect to the RX- pin (R- or B pin) of the other RS422 device.
RS-422 module Pinout
image source: diyables.io

Wiring Diagram

Connect the module's TTL side to the ESP32 C3 Super Mini, then connect the RS422 side to the other device with twisted-pair cable.

  • Note: GPIO20 and GPIO21 are the Serial Monitor UART. Leave them free, or you lose your debug messages.
  • Note: We use a second hardware serial port on GPIO6 and GPIO7 instead.
  • Note: TX always goes to RX, and RX always goes to TX. Swapping them is the most common mistake.
  • Note: The ESP32 C3 Super Mini and the module must share a common GND.
TTL to RS422 Module Pin ESP32 C3 Super Mini Pin
VCC 3.3V
GND GND
RXD (DI) GPIO6
TXD (RO) GPIO7

WARNING

The ESP32 C3 Super Mini is a 3.3V board. Its GPIO pins are NOT 5V tolerant. Power the module from the 3.3V pin, and never feed a 5V TTL signal into GPIO6 or GPIO7. It can damage the chip. If your module only works at 5V, put a logic level shifter on the TXD line.

On the RS422 side you must follow the pairs. RS422 is full duplex, so it uses TWO twisted pairs: one pair for Y/Z (TX+ and TX-), and one pair for A/B (RX+ and RX-). Y and Z must share one twisted pair. A and B must share the other twisted pair. Mixing wires from different pairs kills the noise rejection. On a long cable, add one 120 ohm termination resistor across each pair, at the RECEIVING end of that pair only. Putting resistors at both ends, or on the wrong pair, makes the signal weak.

The wiring diagram between ESP32 C3 Super Mini TTL to RS422

This image is created using Fritzing. Click to enlarge image

How To Program ESP32 C3 Super Mini to use the RS422 module

The ESP32 C3 Super Mini has no SoftwareSerial library, so we use a second hardware UART instead.

  • Create a hardware serial port and define the two pins:
#define RS422_RX_PIN 7 // The ESP32 C3 Super Mini pin GPIO7 connected to the module's TXD (RO) pin #define RS422_TX_PIN 6 // The ESP32 C3 Super Mini pin GPIO6 connected to the module's RXD (DI) pin HardwareSerial rs422Serial(1); // use UART1
  • Initialize the RS422 serial port inside setup():
rs422Serial.begin(9600, SERIAL_8N1, RS422_RX_PIN, RS422_TX_PIN); // RS422

※ NOTE THAT:

Use HardwareSerial, not SoftwareSerial. The SoftwareSerial library does not exist on the ESP32 C3 Super Mini, so a sketch copied from an AVR board will not compile. The good news: the ESP32 C3 can map a real hardware UART to almost any free GPIO, which is faster and more reliable than software serial.

  • Keep the Serial Monitor on its own port at 115200 baud:
Serial.begin(115200); // Serial Monitor

ESP32 C3 Super Mini Code

This sketch echoes every character that arrives from RS422 back to the sender, and also prints it on the Serial Monitor.

What This Code Does:

  • Starts the Serial Monitor at 115200 baud for debugging.
  • Starts a second hardware UART at 9600 baud on GPIO7 (RX) and GPIO6 (TX) for RS422.
  • Checks whether any RS422 data has arrived.
  • Echoes each character back to the RS422 sender.
  • Prints the same character on the Serial Monitor so you can see it.
/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-rs422 */ #define RS422_RX_PIN 7 // The ESP32 C3 SuperMini pin GPIO7 connected to the TXD (RO) pin of the TTL to RS422 module #define RS422_TX_PIN 6 // The ESP32 C3 SuperMini pin GPIO6 connected to the RXD (DI) pin of the TTL to RS422 module // The ESP32 C3 SuperMini does NOT support SoftwareSerial. // Use a second hardware UART (UART1) so that the Serial Monitor UART stays free. HardwareSerial rs422Serial(1); void setup() { // start communication with the Serial Monitor Serial.begin(115200); // Serial Monitor // start communication with the TTL to RS422 module at baud rate 9600 rs422Serial.begin(9600, SERIAL_8N1, RS422_RX_PIN, RS422_TX_PIN); // RS422 // wait a moment to allow serial ports to initialize delay(100); } void loop() { // Check if there's data available on RS422 if (rs422Serial.available()) { char data = rs422Serial.read(); // read the received character rs422Serial.print(data); // echo back to data to the sender Serial.print(data); // print the recived data to Serial Monitor } }

Detailed Instructions

  • New to ESP32 C3 Super Mini? Complete our Getting Started with ESP32 C3 Super Mini tutorial first to set up your development environment.
  • Wire the module: Follow the wiring table above. Check that RXD goes to GPIO6 and TXD goes to GPIO7.
  • Check the power: Use the 3.3V pin, not 5V.
  • Connect the board: Plug the ESP32 C3 Super Mini into your PC with a USB Type-C cable.
  • Open the IDE: Launch the Arduino IDE on your computer.
  • Select the board: Make sure ESP32 C3 Super Mini is selected in Tools > Board.
  • Select the port: Pick the COM port of your board in Tools > Port.
  • Upload the code: Copy the code above into the editor and click Upload.
  • Open Serial Monitor: Set the baud rate to 115200.
  • Send some data: Send characters from the other RS422 device and watch them appear.
  • Pro Tip: If you see nothing, swap the A/B wires first, then the Y/Z wires. A reversed differential pair is the second most common RS422 mistake.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 Dev Module' on 'COM15')
New Line
9600 baud
Hello ESP32 C3 Super Mini RS422 test 1 RS422 test 2 Temperature = 24.6 C
Ln 11, Col 1
ESP32C3 Dev Module on COM15
2

Testing

You can test the link by sending data from your PC to the ESP32 C3 Super Mini over RS-422, and back again.

  • Connect the cable: Link the ESP32 C3 Super Mini to your PC with an RS422-to-USB cable, as shown below.
ESP32 C3 Super Mini RS422 to PC communication
  • Install a terminal: Get a serial terminal program like Tera Term or PuTTY.
  • Set the parameters: Open the terminal, then pick the COM port and 9600 baud, 8 data bits, no parity, 1 stop bit.
  • Type some data: Send a few characters from the terminal to the ESP32 C3 Super Mini.
  • Check the echo: If it works, the same characters come straight back to the terminal.
  • Check the monitor: The same characters also show up in the Arduino Serial Monitor at 115200 baud.

※ NOTE THAT:

Your RS422-to-USB cable gets its own COM port, separate from the ESP32 C3 Super Mini's USB port. You can open both at the same time: one terminal on the RS422 port at 9600, and the Arduino Serial Monitor on the board's port at 115200.

Application and Project Ideas

RS422 with the ESP32 C3 Super Mini is great whenever your cable is long or the area is electrically noisy.

  • Remote sensor node: Read a sensor 100 m away and send the values back over RS422.
  • Factory machine link: Talk to an industrial controller or motor drive that only offers RS422.
  • Boat or RV panel: Carry data between a helm display and an engine sensor box.
  • Greenhouse monitor: Connect several far-apart temperature and humidity stations to one hub.
  • Building automation: Link door, light and HVAC controllers across different floors.
  • Scale or printer reader: Read a bench weighing scale or label printer that uses an RS422 port.

Challenge Yourself

Try these small upgrades to get more comfortable with RS422 on the ESP32 C3 Super Mini.

  • Easy: Change the RS422 baud rate to 19200 on both ends and check that it still works.
  • Easy: Print a short prompt on the Serial Monitor every time a full line arrives.
  • Medium: Collect a whole line with readStringUntil() and echo it back in upper case.
  • Medium: Send a temperature reading over RS422 every 2 seconds, in the form TEMP:24.6.
  • Advanced: Build a small command protocol so LED:ON and LED:OFF over RS422 switch the built-in LED on GPIO8.
  • Advanced: Add a checksum byte to every message and ignore any message whose checksum is wrong.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!