Home All Projects
Easy

Serial Communication Between Arduino UNO and ESP32-CAM

In this project, we demonstrate UART (Serial) communication between an Arduino UNO and an ESP32-CAM. The Arduino sends data to the ESP32-CAM, and the ESP32-CAM receives and processes that data using hardware serial communication.

Serial Communication Between Arduino UNO and ESP32-CAM

Components, Tools and Machines

1x Breadboard 100x50
-
1x 10 jumper wires 150mm male
-
1x ESP32 CAM
-
1x Arduino Uno Rev3
-

Apps and platforms

1x Arduino IDE 2.3.4
Official Site

Project description

This project is useful for:

  1. ESP32-CAM control using Arduino
  2. Sensor data transfer to ESP32
  3. Camera-based IoT projects
  4. Learning UART communication between 5V and 3.3V devices

How It Works

UART (Universal Asynchronous Receiver-Transmitter) allows two devices to communicate using TX (Transmit) and RX (Receive) lines.

  1. Arduino UNO sends data via Serial TX
  2. ESP32-CAM receives data via UART RX
  3. Common GND is shared
  4. ESP32-CAM uses Serial2 (GPIO16 & GPIO17)

⚠️ Important: ESP32-CAM works at 3.3V logic, so a voltage divider is recommended on Arduino TX → ESP32 RX.

Wiring Connections

To establish UART communication between the Arduino UNO and ESP32-CAM, follow the wiring steps below.

Connect Grounds (Important)

  1. Connect GND of Arduino UNO to GND of ESP32-CAM
  2. A common ground is required for proper serial communication

Serial Data Connection

  1. Connect Arduino UNO TX (Pin 1) to ESP32-CAM RX (GPIO16)
  2. This allows data to be transmitted from Arduino to ESP32-CAM

Voltage Level Protection (Recommended)

The Arduino UNO operates at 5V logic, while the ESP32-CAM uses 3.3V logic.

To protect the ESP32-CAM, use a voltage divider :

  1. Place a 1.8kΩ resistor between Arduino TX and ESP32-CAM RX (GPIO16)
  2. Place a 3.3kΩ resistor between ESP32-CAM RX (GPIO16) and GND

ESP32-CAM Programming Connections

  1. Use a USB-to-TTL adapter to upload code
  2. Connect U0R → TX, U0T → RX, 5V → 5V, GND → GND
  3. Connect IO0 to GND while uploading the sketch

Arduino UNO Code (Sender)

void setup() {

Serial.begin(9600);

}

void loop() {

Serial.println("Hello from Arduino!");

delay(1000);

}

📌 This code continuously sends text data from the Arduino to the ESP32-CAM every second.

ESP32-CAM Code (Receiver)

#include "HardwareSerial.h"

HardwareSerial SerialESP32(2);

void setup() {

Serial.begin(115200);

SerialESP32.begin(9600, SERIAL_8N1, 16, 17);

Serial.println("ESP32-CAM Ready");

}

void loop() {

if (SerialESP32.available()) {

String data = SerialESP32.readStringUntil('\n');

Serial.println("Received: " + data);

}

}

📌 The ESP32-CAM reads data using Serial2 and prints it to the Serial Monitor.

How to Upload Code to ESP32-CAM

  1. Connect IO0 to GND
  2. Press RESET
  3. Upload code using USB-to-TTL adapter
  4. Disconnect IO0 from GND
  5. Press RESET again

References

Original tutorial:

https://www.programmingboss.com/2023/01/serial-communication-between-arduino-and-esp32-CAM-UART-data-communication.html

Code

🔒 Unlock Code

Support to get the Source Code for this project

Project Reference Code: serial-communication-between-arduino-uno-and-esp32-cam-33b6a0-en
79 THB
PromptPay QR Code

Project estimate

Want something like this project? Open the estimate page.

The long estimate form has moved to a separate page so this project page stays clean.

รีวิวจากคนใช้งานจริง

รีวิวจากลูกค้าและคนที่เคยใช้งาน

ถ้าเคยสั่งงาน เคยอ่านหน้านี้แล้วได้ประโยชน์ หรือมีข้อเสนอแนะ ฝากรีวิวไว้ได้เลย

กำลังโหลดรีวิว...