Arduino UNO R4 - Control Heating Element

In this guide, we will learn to control a heating element using Arduino UNO R4. From this guide, you will further learn to create a heating system in a following tutorial.

Arduino UNO R4 heating element

Hardware Preparation

1×Arduino UNO R4 WiFi
1×Arduino UNO R4 Minima (Alternatively)
1×USB Cable Type-C
1×Heating Element
1×12V Power Adapter
1×DC Power Jack
1×Jumper Wires
1×(Optional) 9V Power Adapter for Arduino UNO R4
1×(Recommended) Screw Terminal Block Shield for Arduino Uno
1×(Optional) Transparent Acrylic Enclosure For Arduino Uno

Or you can buy the following sensor kits:

1×DIYables Sensor Kit (30 sensors/displays)
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. We appreciate your support.

Overview of Heating Element


Arduino UNO R4 Heating Element Pinout

A heating element typically has two pins.

  • Connect the positive (+) pin (red) to the 12V DC power supply.
  • Connect the negative (-) pin (black) to the GND of the DC power supply.

How to Control Heating Element

When a 12V heating element is connected to a 12V power supply, it produces heat. To manage this Heating Element, we use a relay as a connector between the Arduino UNO R4 and the Heating Element. The Arduino UNO R4 can then control the Heating Element through the relay. If you are unfamiliar with how a relay functions, its pin configuration, or how to program it, you can learn more in the Arduino UNO R4 relay tutorial at: [BASE_URL/tutorials/arduino-uno-r4/arduino-uno-r4-relay]

Wiring Diagram

The wiring diagram between Arduino UNO R4 Heating Element

This image is created using Fritzing. Click to enlarge image

Arduino UNO R4 Code

The following code turns the Heating Element ON for five seconds and then OFF for five seconds repeatedly.

/* * This Arduino UNO R4 code was developed by * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * */ #define RELAY_PIN 3 // The Arduino UNO R4 pin connected to the IN pin of relay // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin as an output. pinMode(RELAY_PIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(RELAY_PIN, HIGH); // turn on heating element 5 seconds delay(5000); digitalWrite(RELAY_PIN, LOW); // turn off heating element 5 seconds delay(5000); }

Detailed Instructions

Follow these instructions step by step:

  • If this is your first time using the Arduino Uno R4 WiFi/Minima, refer to the tutorial on setting up the environment for Arduino Uno R4 WiFi/Minima in the Arduino IDE.
  • Connect the heating element to the Arduino Uno according to the provided diagram.
  • Connect the Arduino Uno R4 board to your computer using a USB cable.
  • Launch the Arduino IDE on your computer.
  • Select the appropriate Arduino Uno R4 board (e.g., Arduino Uno R4 WiFi) and COM port.
  • Copy the code provided and paste it into the Arduino IDE.
  • Click the Upload button in the Arduino IDE to transfer the code to the Arduino UNO R4.
  • Monitor the temperature of the Heating Element.


Be careful, it can cause burns and fire in your home. This is important and we want you to stay safe. If you are not completely sure about what you are doing, please do not handle anything. Instead, ask someone who knows about it. We are not responsible for your safety.

Code Explanation

The explanation is in the comments section of the Arduino code above.

Video Tutorial


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