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
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
The 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
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.
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!