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.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables.
Overview of 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
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.
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.
WARNING
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.