ESP32 S3 UNO - LED Strip

This ESP32 S3 Uno LED strip tutorial shows you how to switch a 12V LED strip on and off with relays and simple Arduino code. You will work with both a single-color LED tape and a 12V RGB LED strip on the ESP32 S3 Uno form board. In the end, your strip will blink on a timer or cycle through seven colors.

In this tutorial, you will:

  1. Learn the difference between addressable and non-addressable LED strips
  2. Wire a relay module to control a 12V LED strip
  3. Switch a single-color LED ribbon on and off from code
  4. Mix red, green and blue channels to show seven colors on an RGB LED strip
  5. Upload and test the code with the Arduino IDE

Hardware Preparation

1×ESP32 S3 Uno-form Board
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×Relay
1×12V 1-color LED Strip
1×12V RGB LED Strip
1×12V Power Adapter
1×DC Power Jack
1×Jumper Wires

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 LED Strip

An LED strip is a thin, flexible circuit board covered with small LEDs. People also call it LED tape or LED ribbon. You often see it under kitchen cabinets, behind TVs and along shelves, where it gives a soft glow or highlights an area.

Addressable LED strips

Every LED on an addressable strip has its own address. Because of this, you can set the color and brightness of each LED on its own.

Non-addressable LED strips

On a non-addressable strip, all the LEDs share the same wires. When you change the color or brightness, the whole strip changes at once.

This guide covers non-addressable LED strips only. If you have an addressable strip, use one of these tutorials instead:

  • ESP32 S3 Uno - NeoPixel LED Strip tutorial
  • ESP32 S3 Uno - WS2812B LED Strip tutorial
  • ESP32 S3 Uno - DotStar LED Strip tutorial

Non-Addressable LED Strip Pinout

Knowing the pins tells you where the power goes and which wire turns each color on. Non-addressable strips come in two main kinds.

1-color LED strip

The color of this strip is fixed by the factory. It usually has two pins:

Pin Connection
12V/24V Positive (+) terminal of a 12V or 24V DC power supply
GND Negative (-) terminal of a 12V or 24V DC power supply

RGB LED strip

This strip can show many colors because it has a separate wire for red, green and blue. It usually has four pins:

Pin Connection
12V/24V Positive (+) terminal of a 12V or 24V DC power supply
R Red channel. Connect it to the negative (-) terminal of the supply to light red
G Green channel. Connect it to the negative (-) terminal of the supply to light green
B Blue channel. Connect it to the negative (-) terminal of the supply to light blue
ESP32 S3 Uno non-addressable LED strip pinout

Below, you will control each type with the ESP32 S3 Uno, one at a time.

How to Control a Non-Addressable 1-color LED strip.

A 12V LED strip lights up as soon as you connect it to a 12V power supply. The ESP32 S3 Uno works at 3.3V and cannot power the strip, so you need a relay between them. The ESP32 S3 Uno switches the relay, and the relay switches the 12V power of the strip.

If relays are new to you, read the ESP32 S3 Uno - Relay tutorial first. It explains the relay pinout, how it works and how to program it.

ESP32 S3 Uno Pinout

The image below shows the pinout diagram of the ESP32 S3 Uno form board. Use it to find the D3, D5, D6 and D7 headers and their GPIO numbers when you wire the relays.

ESP32 S3 Uno pinout diagram

Wiring Diagram.

The ESP32 S3 Uno only drives the relay inputs. The LED strip, the 12V power adapter and the DC power jack sit on the relay output side, so the 12V never touches the board.

Wiring Diagram between ESP32 S3 Uno and Non-Addressable 1-color LED strip.

One relay switches the whole strip. Its signal wire goes to D3.

The wiring diagram between ESP32 S3 Uno 12V LED strip

This image is created using Fritzing. Click to enlarge image

Component Pin ESP32 S3 Uno Pin
Relay VCC 5V
Relay GND GND
Relay IN D3 (GPIO17)

Wiring Diagram between ESP32 S3 Uno and Non-Addressable RGB LED strip.

Each color channel needs its own relay, so you use three relays (or a multi-channel relay module).

The wiring diagram between ESP32 S3 Uno 12V RGB LED strip

This image is created using Fritzing. Click to enlarge image

Component Pin ESP32 S3 Uno Pin
Relay VCC 5V
Relay GND GND
Relay 1 IN (Blue) D5 (GPIO20)
Relay 2 IN (Red) D6 (GPIO3)
Relay 3 IN (Green) D7 (GPIO14)

WARNING

D6 (GPIO3) is a boot strapping pin on the ESP32 S3 Uno. The chip reads it at startup. A relay input usually does not cause trouble, but if the board fails to boot or upload, unplug the D6 wire, upload the code, then plug it back in.

※ NOTE THAT:

Most relay modules have a 5V coil, so power the relay VCC from the 5V pin. The IN pin only gets the 3.3V signal from the ESP32 S3 Uno, which most modules accept. Never send a 5V signal back into an ESP32 S3 Uno pin, because the ESP32 S3 Uno pins are NOT 5V tolerant.

ESP32 S3 Uno Code

There are two sketches below, one for each strip type. Both only use digitalWrite(), so no extra library is needed.

ESP32 S3 Uno Code for controlling Non-Addressable 1-color LED strip.

This sketch switches the relay on D3 every 5 seconds. The LED strip stays on for 5 seconds, then off for 5 seconds, and repeats forever. Each change is also printed to the Serial Monitor.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-led-strip */ #define LED_STRIP_PIN 17 // The ESP32 S3 Uno pin D3 (GPIO17) controls the LED strip via relay void setup() { Serial.begin(9600); // initialize ESP32 S3 Uno pin as a digital output pin pinMode(LED_STRIP_PIN, OUTPUT); } // the loop function runs over and over again forever void loop() { Serial.println("The LED strip is turned on"); digitalWrite(LED_STRIP_PIN, HIGH); delay(5000); Serial.println("The LED strip is turned off"); digitalWrite(LED_STRIP_PIN, LOW); delay(5000); }

ESP32 S3 Uno Code for controlling Non-Addressable RGB LED strip.

This sketch turns the three color relays on and off in different combinations. The strip shows red, green, blue, yellow, magenta, cyan and white, with 2 seconds for each color.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-led-strip */ #define BLUE_PIN 20 // The ESP32 S3 Uno pin D5 (GPIO20) connects to the blue pin of LED strip via relay 1 #define RED_PIN 3 // The ESP32 S3 Uno pin D6 (GPIO3) connects to the red pin of LED strip via relay 2 #define GREEN_PIN 14 // The ESP32 S3 Uno pin D7 (GPIO14) connects to the green pin of LED strip via relay 3 void setup() { Serial.begin(9600); // initialize ESP32 S3 Uno pins as digital output pins pinMode(BLUE_PIN, OUTPUT); pinMode(RED_PIN, OUTPUT); pinMode(GREEN_PIN, OUTPUT); } // the loop function runs over and over again forever void loop() { Serial.println("The LED strip is turned red"); digitalWrite(BLUE_PIN, LOW); digitalWrite(RED_PIN, HIGH); digitalWrite(GREEN_PIN, LOW); delay(2000); Serial.println("The LED strip is turned green"); digitalWrite(BLUE_PIN, LOW); digitalWrite(RED_PIN, LOW); digitalWrite(GREEN_PIN, HIGH); delay(2000); Serial.println("The LED strip is turned blue"); digitalWrite(BLUE_PIN, HIGH); digitalWrite(RED_PIN, LOW); digitalWrite(GREEN_PIN, LOW); delay(2000); Serial.println("The LED strip is turned yellow"); digitalWrite(BLUE_PIN, LOW); digitalWrite(RED_PIN, HIGH); digitalWrite(GREEN_PIN, HIGH); delay(2000); Serial.println("The LED strip is turned magenta"); digitalWrite(BLUE_PIN, HIGH); digitalWrite(RED_PIN, HIGH); digitalWrite(GREEN_PIN, LOW); delay(2000); Serial.println("The LED strip is turned cyan"); digitalWrite(BLUE_PIN, HIGH); digitalWrite(RED_PIN, LOW); digitalWrite(GREEN_PIN, HIGH); delay(2000); Serial.println("The LED strip is turned white"); digitalWrite(BLUE_PIN, HIGH); digitalWrite(RED_PIN, HIGH); digitalWrite(GREEN_PIN, HIGH); delay(2000); }

Detailed Instructions

Follow these steps in order:

  1. New to the ESP32 S3 Uno? Follow ESP32 S3 Uno - Getting Started first.
  2. Wire it up as shown in the diagram for your strip type.
  3. Connect the board to your computer with a USB Type-C cable.
  4. Open Arduino IDE, choose the ESP32S3 Dev Module board and the correct COM port.
  5. Copy the code for your strip type and paste it into the Arduino IDE.
  6. Upload the code by clicking the Upload button.
  7. Open the Serial Monitor at 9600 baud and watch the LED strip.
  8. Tip: You should hear the relay click each time the strip changes. If it clicks but the strip stays dark, check the 12V adapter and the relay output wires.

For the RGB sketch, the Serial Monitor shows something like this:

∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
The LED strip is turned red The LED strip is turned green The LED strip is turned blue The LED strip is turned yellow The LED strip is turned magenta
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Code Explanation

The comments in the code explain each line. The idea is simple: each relay is a digital output, so HIGH turns that channel on and LOW turns it off. On the RGB strip, turning two or three channels on at once mixes the colors.

A relay can only switch fully on or fully off. If you want to dim the strip or mix in-between colors, use a PWM driver such as the L298N driver instead of a relay.

Video Tutorial

Watch the video below to see this ESP32 S3 Uno project step by step.

FAQ

Can the ESP32 S3 Uno power a 12V LED strip directly?

No. The ESP32 S3 Uno pins give only 3.3V and a small current. The strip needs its own 12V power adapter. The board only switches a relay, and the relay switches the 12V.

Will a 5V relay module work with the 3.3V ESP32 S3 Uno pins?

Most 5V relay modules work. Power the module VCC from the 5V pin, and connect IN to a GPIO. The 3.3V signal is enough for most modules with a transistor input. If the relay LED lights but the relay does not click, use a 3V relay module.

Can I dim the LED strip or make other colors?

Not with a relay, because it is only on or off. Use a MOSFET module or an L298N driver and the analogWrite() function. The ESP32 S3 Uno supports PWM on all the Uno header pins used here.

Can I use a 24V LED strip instead of a 12V one?

Yes. Use a 24V power adapter that matches the strip, and check that the relay contacts are rated for the voltage and current. The code stays the same.

Why does the RGB code use pin 3 for red when the wire goes to D6?

On the ESP32 S3 Uno, the header label and the GPIO number are different. D6 is GPIO3, D5 is GPIO20 and D7 is GPIO14. In code you always write the GPIO number.

What if my project needs more pins than the Uno headers give?

The ESP32 S3 Uno has two extra rows of holes with more GPIOs. GPIO15 and GPIO16 work as I/O, PWM and analog. GPIO45 and GPIO35 to GPIO42 work as I/O and PWM. GPIO47 and GPIO48 are output only, with PWM. Solder pin headers to them and write the GPIO number in code. For extra relays, GPIO35 to GPIO42 are a good choice. Be careful with two things. First, GPIO47 and GPIO48 may run at 1.8V instead of 3.3V on some modules, especially ones with "V" in the name like R8V or R16V, so 3.3V devices can be damaged or act strangely. Second, GPIO0, GPIO3 (D6), GPIO45 and GPIO46 (D9) are boot strapping pins, and a wrong connection can stop the board from booting or uploading code. Use the other extra pins first.

Troubleshooting

Problem Possible Cause Solution
No COM port in Arduino IDE USB driver is missing or the board is not in upload mode Install the CP210x or CH340 driver, or hold BOOT while pressing RESET
Relay never clicks Relay VCC or GND is not connected Power VCC from 5V and check the GND wire
Relay LED lights but it does not click The 3.3V signal is too weak for this module Use a 3V relay module or one with a transistor input
Relay clicks but the strip stays dark 12V adapter is off or the strip is on the wrong relay terminals Check the adapter, the DC power jack and use the COM and NO terminals
Strip is on when it should be off Relay module is LOW level trigger or wired to NC Use the NO terminal, or swap HIGH and LOW in the code
Wrong colors on the RGB strip R, G and B wires go to the wrong relays Match red to D6, green to D7 and blue to D5
Board does not boot or upload with the RGB wiring D6 (GPIO3) is a boot strapping pin Unplug the D6 wire, upload, then plug it back in
Board resets when the relay switches Power drop from the relay coils Use a good USB cable or power supply and keep the 12V load on its own adapter

※ 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!