ESP32 S3 UNO - Control Heating Element
This ESP32 S3 Uno heating element tutorial shows you how to turn a 12V heater on and off with a relay and simple Arduino code. The ESP32 S3 Uno form board cannot power the heater by itself, so a relay does the heavy switching. When you finish, your heater will warm up and cool down on a timer, and you will be ready to build a full temperature-controlled heating system later.
In this tutorial, you will:
- Learn the two pins of a 12V heating element
- Wire a heater relay and a 12V power supply to the ESP32 S3 Uno
- Switch the heating element with digitalWrite()
- Upload the code from Arduino IDE and test it safely

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 | × | Heating Element | |
| 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) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of Heating Element
A heating element is a simple part that turns electric power into heat. It needs far more current than a GPIO pin can give, so it always gets its own power supply. Knowing its pins helps you wire it the right way.
Pinout

Most heating elements have just two wires. The positive (+) wire is usually red, and you connect it to the 12V side of the DC power supply. The negative (-) wire is usually black, and it goes to the GND of the same DC power supply.
How to Control Heating Element
A 12V heating element gets hot as soon as it receives 12V. To decide when that happens, you put a relay between the ESP32 S3 Uno and the heater. The board sends a small signal to the relay, and the relay opens or closes the 12V circuit for you.
In this way, the ESP32 S3 Uno never carries the heater current. It only tells the relay what to do. 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 header and its GPIO number when you wire the relay.

Wiring Diagram
The relay sits between the board and the 12V circuit. Follow the diagram and the table below.

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) |
On the high-power side, the 12V power adapter plugs into the DC power jack. The jack's positive wire goes to the relay COM terminal, and the relay NO terminal goes to the positive (+) wire of the heating element. The negative (-) wire of the heating element goes back to the GND of the DC power jack. Never connect the 12V supply to any pin of the ESP32 S3 Uno.
※ NOTE THAT:
The ESP32 S3 Uno pins use 3.3V logic and are NOT 5V tolerant. The relay module can take 5V on its VCC pin, because its IN pin only receives a signal from the board. Most 5V relay modules switch fine with a 3.3V signal on IN.
ESP32 S3 Uno Code
This sketch turns the heating element on for five seconds, then off for five seconds, again and again. It only uses pinMode() and digitalWrite() on D3 (GPIO17), so the logic is the same as on any Arduino-style board.
Detailed Instructions
Follow these steps in order:
- New to the ESP32 S3 Uno? Follow ESP32 S3 Uno - Getting Started first.
- Wire it up as shown in the diagram.
- Connect the board to your computer with a USB Type-C cable.
- Open Arduino IDE, choose the ESP32S3 Dev Module board and the correct COM port.
- Copy the code above and paste it into Arduino IDE.
- Upload the code by clicking the Upload button.
- Plug in the 12V adapter and listen for the relay. It clicks every five seconds.
- Check the heater from a safe distance. It warms up while the relay is on and cools down while it is off.
- Tip: Change the two delay(5000) values to make the on and off times longer or shorter.
WARNING
A heating element gets very hot. It can burn your skin and start a fire in your home. Your safety comes first. If you are not fully sure what you are doing, do not touch the circuit and ask someone with experience to help you. We are not responsible for your safety.
Code Explanation
Every line of the sketch has a comment that says what it does. Read the comments in the code above to follow the logic step by step.
Video Tutorial
Watch the video below to see this ESP32 S3 Uno project step by step.
FAQ
Can the ESP32 S3 Uno power the heating element directly?
No. A 12V heating element needs much more current than a GPIO pin or the board's 5V pin can give. Always power the heater from a separate 12V adapter and let the relay switch it.
Can I power the relay module from the 3.3V pin of the ESP32 S3 Uno?
Most relay modules have a 5V coil, so connect their VCC to the 5V pin. The IN pin works with the 3.3V signal from the ESP32 S3 Uno on most modules. If your relay does not click, use a 3V relay module or a module with a transistor driver.
Why does the code use 17 and not 3 for the relay pin?
On the ESP32 S3 Uno, the header label D3 is connected to GPIO17. In code you always write the GPIO number, so the relay pin is 17. The wiring stays on the D3 header, just like on an UNO R4.
How do I keep the heater at a set temperature?
Add a temperature sensor, such as a DS18B20, and turn the relay on only when the temperature is below your target. This makes a simple thermostat. Add a small gap between the on and off points so the relay does not click too often.
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 are I/O, PWM and analog. GPIO45 and GPIO35 to GPIO42 are I/O and PWM. GPIO47 and GPIO48 are output only, with PWM. Solder pin headers to use them and write the GPIO number in code. For an analog temperature sensor, use GPIO15 or GPIO16. For more 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.
Can I use a 220V heater with this relay?
The relay may be rated for mains power, but mains voltage is dangerous. Only do it if you know how to work safely with high voltage. For learning, stay with a 12V heating element.
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, or IN is on the wrong pin | Power the relay from 5V, check GND, and connect IN to D3 (GPIO17) |
| Relay clicks but the heater stays cold | The 12V circuit is open or wired to NC | Check the adapter, the DC jack, and use the COM and NO terminals |
| Heater is always on | The heater is wired to NC, or the relay module is active LOW | Move the wire to NO, or swap HIGH and LOW in digitalWrite() |
| Board resets when the relay switches | Power noise from the relay or a weak USB port | Use a good USB cable and port, and keep the 12V wires away from the board |
| Relay does not react to the 3.3V signal | The relay module needs a 5V signal on IN | Use a 3V relay module or one with a transistor driver |
| Heater gets too hot | The on time is too long for your heater | Shorten the on delay, or add a temperature sensor to control it |