Arduino MKR WiFi 1010 - Control Heating Element

Learn to safely control 12V heating elements with your Arduino MKR WiFi 1010! This fundamental tutorial teaches relay-based heater switching—essential for temperature regulation systems, DIY incubators, and thermal projects.

You can switch a heating element with a relay or with a MOSFET module. The relay has only two states for the heater: fully ON or fully OFF. The MOSFET module gives you those two states, plus every heat level in between. It is also silent, and its contacts do not wear out when the heater is switched very often. You will learn both ways here.

What You'll Learn:

Applications:

Arduino MKR WiFi 1010 Heating Element

WARNING

CRITICAL SAFETY WARNING

Heating elements pose serious safety risks:

  • Burn hazard: Surface temperatures exceed 80°C (176°F)—severe burns possible
  • Fire risk: Improper installation or failures can ignite nearby materials
  • Electrical shock: 12V is generally safe, but wiring errors can be dangerous
  • Thermal runaway: Without temperature feedback, heaters can overheat catastrophically

Safety Requirements:

  1. Never leave unattended: Always supervise heating element operation
  2. Use thermal cutoffs: Add temperature-sensing shutoff (future tutorial)
  3. Fire-resistant mounting: Secure to metal or ceramic surfaces only
  4. Ventilation: Ensure adequate airflow and heat dissipation
  5. Testing: Initially test with power supply disconnected, then in controlled environment
  6. Know your limits: If unsure about electrical safety, consult an expert

We are not responsible for injuries, fires, or property damage. Proceed only if you fully understand electrical and thermal hazards.

Tutorial Scope: This guide covers basic ON/OFF control. For intelligent temperature regulation with sensor feedback, see our Heating System with Temperature Control tutorial.

Hardware Preparation

1×Arduino MKR WiFi 1010
1×Micro USB Cable
1×Relay
1×Alternatively, MOSFET Module (AOD4184, LR7843 or FR120N)
1×Heating Element
1×12V Power Adapter
1×Optionally, DC Power Jack
1×Breadboard
1×Jumper Wires

Or you can buy the following kits:

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.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of Heating Elements

Heating elements are resistive devices that convert electrical energy into thermal energy. Understanding their characteristics ensures safe, effective integration.

Pinout and Electrical Characteristics

Arduino MKR WiFi 1010 Heating Element Pinout

Heating elements feature two wire terminals:

  • Positive (+) pin (red wire):
    • Connects to positive terminal of 12V DC power supply
    • Polarity usually doesn't matter for resistive heaters, but follow manufacturer markings
  • Negative (-) pin (black wire):
    • Connects to ground (GND) terminal of 12V power supply
    • Completes circuit for current flow

    Key Specifications (check your element's datasheet):

    • Voltage rating: Typically 12V DC (this tutorial), but also available in 5V, 24V, 110V AC
    • Power consumption: 10-50W common for small elements (higher = more heat)
    • Current draw: Calculate using P = V × I (e.g., 24W at 12V = 2A current)
    • Temperature range: Can reach 80-200°C depending on design

    Example Calculation:

    If your heating element is rated 12V, 24W:

    • Current = Power ÷ Voltage = 24W ÷ 12V = 2A
    • Your power supply must provide at least 2A continuous current
    • Your relay must be rated for at least 2A switching current

    How Heating Element Control Works

    Operating Principle: When voltage is applied across the heating element's resistance, current flows, generating heat (Joule heating effect). More current = more heat.

    Control Method: ON/OFF switching via relay

    Why Relay is Essential:

    1. Voltage mismatch: Heating elements require 12V; Arduino pins output only 3.3V
    2. Current demand: Elements draw 1-5A; Arduino pins supply maximum 15mA (333× insufficient!)
    3. Isolation: Keeps high-power heater circuit separate from sensitive Arduino logic

    Direct connection would instantly destroy your Arduino and likely damage the heating element.

    The Relay Solution:

    • Arduino sends 3.3V LOW signal → Relay opens → Heater OFF (no power flow)
    • Arduino sends 3.3V HIGH signal → Relay closes → Heater ON (12V applied, heat generated)

    The relay acts as an electrically-isolated switch, allowing low-power Arduino signals to control high-power heater operation safely.

    Relay Prerequisite: Not familiar with relays? Study our comprehensive Arduino MKR WiFi 1010 - Relay tutorial. It covers:

    • Relay pinout and internal mechanics
    • How electromagnetic coils control switch contacts
    • Wiring diagrams for various configurations
    • Programming relay control logic
    • Choosing appropriate relay ratings

    Master those concepts, then apply them here for heating element control!

    MOSFET Prerequisite: Planning to use the MOSFET module instead? Read the Arduino MKR WiFi 1010 - MOSFET Module tutorial to see how the module is built and how to pick between AOD4184, LR7843 and FR120N.

    Heating Element: Relay vs MOSFET Module

    Relay MOSFET Module
    Heat control ON or OFF only ON, OFF, and heat level (power) by PWM
    Sound a click at every switch silent
    Switching time milliseconds (slow) very fast
    Wear contacts burn and wear when switched often no moving parts, no wear
    Supply type works with AC or DC works with DC only
    Minimum supply none (within the relay rating) about 6V, because the gate needs it
    Isolation coil is apart from the contacts PC817 optocoupler
    Best for AC heaters, simple ON/OFF 12V DC heaters, power control, frequent switching

    A thermostat project switches the heater many times every hour. That wears out relay contacts, so the MOSFET module is a good fit for a 12V heating element. Keep the relay for a heater that runs on AC mains. Also check the current: the FR120N handles only about 2A without a heatsink, so a 24W heater (2A at 12V) is better with the AOD4184 or LR7843.

Wiring Diagram

The wiring diagram between Arduino MKR WiFi 1010 Heating Element

This image is created using Fritzing. Click to enlarge image

Arduino MKR WiFi 1010 Code

This code repeatedly turns the heating element on for five seconds and then off for five seconds.

/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-controls-heating-element */ #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

New to Arduino MKR WiFi 1010? Complete our Getting Started with Arduino MKR WiFi 1010 tutorial first to set up your development environment.

  • Connect the components to the Arduino MKR WiFi 1010 board as depicted in the diagram
  • Plug your Arduino MKR WiFi 1010 into your computer's USB port
  • Launch the Arduino IDE on your computer
  • Select the Arduino MKR WiFi 1010 board and its COM port
  • Copy the code provided above and paste it into the Arduino software.
  • Click the Upload button to compile and send the code to your Arduino MKR WiFi 1010 board.
  • Look at the temperature of the heating element.

WARNING

Be careful. It can burn you and your home. This is very serious, and we want you to be safe. If you are not 100% sure about what you are doing, please do not touch anything. Ask someone who understands. We are not responsible for your safety.

Code Explanation

The Arduino MKR WiFi 1010 code above has an explanation for each line. Please read the comments in the code!

Arduino MKR WiFi 1010 Code - Set Heat Level with MOSFET Module

In this part, a MOSFET module switches the heating element instead of the relay. The MKR sends a PWM signal, so the heater gets only part of its power when you want less heat.

Wiring Diagram

The wiring diagram between Arduino MKR WiFi 1010 heating element MOSFET module

This image is created using Fritzing. Click to enlarge image

Connections:

  • MKR pin 6 → module PWM pin
  • MKR GND → module GND pin
  • 12V adapter + and heater red wire (+) → module + terminal (they share it)
  • Heater black wire (−) → module LOAD terminal
  • 12V adapter − → module − terminal

A heating element is only a resistor, not a coil, so no flyback diode is needed.

Code

/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-controls-heating-element */ const int MOSFET_PIN = 6; // Arduino MKR WiFi 1010 pin connected to the PWM pin of the MOSFET module void setup() { Serial.begin(9600); pinMode(MOSFET_PIN, OUTPUT); analogWrite(MOSFET_PIN, 0); // start with the load OFF } void setLoad(int percent) { int duty = map(percent, 0, 100, 0, 255); // convert 0-100% to 0-255 analogWrite(MOSFET_PIN, duty); Serial.print("Load power: "); Serial.print(percent); Serial.println("%"); } void loop() { // turn the load fully ON, then fully OFF Serial.println("Load: ON"); setLoad(100); delay(2000); Serial.println("Load: OFF"); setLoad(0); delay(2000); // increase the power step by step (PWM) for (int percent = 10; percent <= 100; percent += 10) { setLoad(percent); delay(500); } // decrease the power step by step (PWM) for (int percent = 90; percent >= 0; percent -= 10) { setLoad(percent); delay(500); } delay(1000); }

What happens: the heater gets full power for 2 seconds, then no power for 2 seconds. After that, the power climbs from 10% to 100% in steps, then goes back down. A heater warms up and cools down slowly, so you feel the change only after some time, not at each step.

Detailed Instructions

  • Prepare the MKR board and the Arduino IDE like in the relay Quick Steps above.
  • Build the circuit from the MOSFET wiring diagram. Mount the heater on a safe, fire-resistant surface.
  • Upload the code above to the Arduino MKR WiFi 1010.
  • Connect the 12V adapter.
  • Open the Serial Monitor (9600 baud) to see the power level.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino MKR WiFi 1010
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino MKR WiFi 1010' on 'COM15')
New Line
9600 baud
Load: ON Load power: 100% Load: OFF Load power: 0% Load power: 10% Load power: 20% Load power: 30% Load power: 40% Load power: 50% Load power: 60% Load power: 70% Load power: 80% Load power: 90% Load power: 100% Load power: 90% Load power: 80% Load power: 70% Load power: 60% Load power: 50% Load power: 40% Load power: 30% Load power: 20% Load power: 10% Load power: 0%
Ln 11, Col 1
Arduino MKR WiFi 1010 on COM15
2

WARNING

The heater still gets hot with the MOSFET module. Do not touch it, and never leave it running alone.

Tip: Use the MOSFET module only for DC heaters with a supply of about 6V or higher. For an AC heater, use the relay.

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!