Projects / 3.3 V and 5 V logic levels lab

3.3 V and 5 V logic levels lab

Intermediate45 minGuided buildReviewed

Build it step by step

0 of 7 done
  1. UNO

    Measure the Uno output

    About 5 V on TX.

  2. UNO

    Build the divider

    1 kΩ and 2 kΩ to ground.

  3. UNO

    Measure the divider node

    About 3.3 V.

  4. UNOESP32

    Send Uno to ESP32

    Check the text on the ESP32 monitor.

  5. UNOESP32

    Send ESP32 to Uno

    Check the text on the Uno monitor.

  6. UNOLOGIC

    Swap to the level shifter

    Repeat both directions.

  7. UNO

    Write what each fix is good for

    One-way and two-way.

In short

How do you build a 3.3 V and 5 V logic levels lab?

See why a 3.3 V board can be damaged by 5 V signals and fix it with a level shifter. You need Arduino Uno R3, ESP32 DevKit V1, Logic Level Converter 4-channel, Resistor 1 kΩ, Resistor 2 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 45 minutes.

Level
Intermediate
Time
About 45 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Uno TX (software serial D11)1 kΩ, then a node, then 2 kΩ to groundDivider: 5 V becomes about 3.3 V
Divider nodeESP32 GPIO16 (RX2)Safe 3.3 V input
ESP32 GPIO17 (TX2)Uno D10 (software serial RX)3.3 V is read as high by the Uno
Level shifter LV and HVESP32 3V3 and Uno 5VTwo supply sides
Level shifter GNDBoth grounds joinedCommon ground
Uno D11Shifter HV1, with LV1 to ESP32 GPIO16Alternative path through the shifter

Code

The ESP32's pins are rated for 3.3 V only and are not 5 V tolerant, so a 5 V output from an Uno can slowly damage them or kill them at once; the Uno side is safer, since it reads anything above about 3 V as high, so 3.3 V from the ESP32 is accepted directly, though with little margin. First measure with a multimeter: the Uno's TX pin idles at about 5 V, and the divider node should read about 3.3 V (5 times 2 over 3). Use the divider for a one-way line, and the four-channel level shifter, which is built on small MOSFETs, when a line must carry data both ways, as with I2C. Make sure the low side powers from 3V3 and the high side from 5V before connecting any signal, and join the grounds. Arduino IDE, board "Arduino Uno". Never connect a 5 V signal to an ESP32 pin, even briefly, to see what happens.

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// ESP32 side. Prints what the Uno says and answers every second. Pins: RX2 GPIO16, TX2 GPIO17 via the divider or the level shifter.
// Board: ESP32 Dev Module.
void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, 17);   // RX2 = GPIO16, TX2 = GPIO17
}
void loop() {
  while (Serial2.available()) Serial.write(Serial2.read());
  Serial2.println("hello from the ESP32 at 3.3 V");
  delay(1000);
}

/* UNO side (separate sketch). Board: Arduino Uno. Pins: RX D10, TX D11.
#include <SoftwareSerial.h>
SoftwareSerial link(10, 11);
void setup() { Serial.begin(9600); link.begin(9600); }
void loop() {
  link.println("hello from the Uno at 5 V");
  while (link.available()) Serial.write(link.read());
  delay(1000);
}
*/

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Divider nodeWithin 0.2 V of 3.3 V
Uno to ESP32Text arrives clean
ESP32 to UnoText arrives clean
Level shifterWorks both ways

If it does not work

Garbage text

Check the baud rate on both ends and the grounds.

No data

Check the RX and TX are crossed.

ESP32 hot or resets

Disconnect and recheck the divider.

Shifter dead

Check the LV and HV supplies.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the 3.3 V and 5 V logic levels lab?

Arduino Uno R3, ESP32 DevKit V1, Logic Level Converter 4-channel, Resistor 1 kΩ, Resistor 2 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the 3.3 V and 5 V logic levels lab take to build?

About 45 minutes for a intermediate maker, in 7 steps.

How do I know the 3.3 V and 5 V logic levels lab works?

Divider node: Within 0.2 V of 3.3 V. Uno to ESP32: Text arrives clean. ESP32 to Uno: Text arrives clean.

Garbage text: what should I check?

Check the baud rate on both ends and the grounds.

No data: what should I check?

Check the RX and TX are crossed.

ESP32 hot or resets: what should I check?

Disconnect and recheck the divider.

Shifter dead: what should I check?

Check the LV and HV supplies.