DEV Community

Hedy
Hedy

Posted on

How to connect to a different microcontroller via Arduino IDE's serial port?

You can use the Arduino IDE’s serial port (Serial Monitor / Plotter) to talk to another microcontroller, but you need a USB-to-UART bridge (or use an Arduino board as a bridge). The key is: Arduino IDE talks to a COM/tty device, not directly to random MCU pins.

1) The normal way: USB-to-UART adapter → target MCU UART
Hardware you need

  • USB-to-TTL UART adapter (CP2102 / FT232 / CH340)
  • Jumper wires
  • (Often needed) level shifting if voltages don’t match

Wiring (TTL UART)

  1. GND ↔ GND (must share ground)
  2. Adapter TXD → MCU RX
  3. Adapter RXD → MCU TX
  4. Optional: Adapter VCC → MCU VCC only if you want the adapter to power the MCU (often better to power separately)

Voltage rules (very important)

  • If your MCU UART is 3.3V, use a 3.3V UART adapter (or level shifter).
  • Don’t feed 5V-TTL RX/TX into a 3.3V-only MCU pin.

Arduino IDE steps

  1. Plug in the USB-UART adapter
  2. Arduino IDE → Tools → Port → select the adapter’s COM/tty port
  3. Open Tools → Serial Monitor
  4. Set:
  • Baud rate (must match MCU firmware, e.g., 115200)
  • Line ending (None / NL / CR / Both) as required by your protocol
  1. Type/send commands and read responses

Quick “is it working?” test

  • If the MCU firmware echoes characters, you should see exactly what you type.
  • If you see gibberish → wrong baud rate.
  • If you see nothing → likely TX/RX swapped, missing GND, wrong voltage level, or MCU not configured for UART.

2) Use an Arduino board as a USB-serial bridge (no extra adapter)

This is handy if you have an Arduino Uno (or similar with a USB-serial chip).

Option A (Uno): “Reset-hold” pass-through

  1. Connect Uno to PC via USB
  2. Hold the Uno in reset (press and hold RESET, or tie RESET to GND) so its ATmega doesn’t interfere
  3. Wire:
  • Uno GND → target GND
  • Uno TX0 (D1) → target RX
  • Uno RX0 (D0) → target TX
  1. In Arduino IDE, select the Uno’s port, open Serial Monitor, set baud

Voltage warning: Uno UART pins are 5V logic. If your target is 3.3V, use a level shifter or a 3.3V-safe method.

Option B: Sketch-based “Serial passthrough”

Upload this to the Arduino, then it forwards between USB serial and a second UART (best on boards with extra UARTs like Mega) or SoftwareSerial:

// For Arduino Mega: use Serial (USB) <-> Serial1 (pins 18/19)
void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}
void loop() {
  while (Serial.available())  Serial1.write(Serial.read());
  while (Serial1.available()) Serial.write(Serial1.read());
}
Enter fullscreen mode Exit fullscreen mode

3) If you meant “upload code to a different microcontroller via serial”

That’s possible only if the target MCU has a bootloader/programming protocol over UART and the Arduino IDE supports that MCU via a core/package (e.g., ESP32, STM32, RP2040, etc.).

General requirements:

  • Install the target’s Arduino core in Boards Manager
  • Wire UART plus any required BOOT/EN/RESET pins
  • Select the correct Board and Port
  • Click Upload

(Each MCU family has its own boot pins and procedure.)

Common problems checklist

  • TX/RX crossed correctly (TX→RX, RX→TX)
  • Common ground connected
  • Correct baud rate + line endings
  • Voltage levels compatible (3.3V vs 5V)
  • Target MCU UART pins are the ones you think (some pins are remapped)

Top comments (0)