Arduino Nano - Heating Element

This tutorial instructs you how to control a heating element with Arduino Nano. Subsequently, you will be able to apply this knowledge to create a heating system in a separate tutorial.

Hardware Preparation

1×Arduino Nano
1×USB A to Mini-B USB cable
1×Relay
1×Heating Element
1×12V Power Adapter
1×DC Power Jack
1×Jumper Wires
1×(Optional) 9V Power Adapter for Arduino Nano
1×(Recommended) Screw Terminal Adapter for Arduino Nano

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

The Heating Element Pinout

Arduino Nano heating element pinout

The heating element typically has two pins:

  • The Positive (+) pin (red) should be connected to the 12V of a DC power supply
  • The Negative (-) pin (black) should be connected to the GND of a DC power supply

How to Control Heating Element using Arduino Nano

If a 12V heating element is supplied with 12V power, it will generate heat. In order to regulate the heating element, a relay must be placed between the Arduino Nano and the heating element. The Arduino Nano can then control the heating element through the relay.

If you are unfamiliar with relays (pinout, how they work, how to program them, etc.), please refer to the Arduino Nano - Relay tutorial for more information.

Wiring Diagram

The wiring diagram between Arduino Nano and heating element

This image is created using Fritzing. Click to enlarge image

Arduino Nano Code

The code below will cause the heating element to be switched ON every five seconds and OFF again after five seconds have passed.

/* * This Arduino Nano code was developed by newbiely.com * * This Arduino Nano code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano/arduino-nano-heating-element */ #define RELAY_PIN 2 // The Arduino Nano pin connected to the IN pin of relay module // The setup function runs once on reset or power-up void setup() { // initialize digital pin D2 as an output. pinMode(RELAY_PIN, OUTPUT); } // The loop function repeats indefinitely 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

  • Connect your Arduino Nano to the computer using a USB cable.
  • Launch the Arduino IDE, select the appropriate board and port.
  • Paste the code into the Arduino IDE.
  • Click the Upload button in the Arduino IDE to send the code to the Arduino Nano.
  • Check the temperature of the heating element.

WARNING

Take caution. It can hurt you and your home. This is a significant issue, and we want you to be secure. If you are NOT absolutely certain what you are doing, do yourself a favor and don't meddle. Seek advice from someone who is knowledgeable! We do NOT accept any liability for your safety.

Code Explanation

Check out the line-by-line explanation contained in the comments of the source code!

Video Tutorial

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