To use the conductive heater fabric with a microcontroller like Metro M0 Express, you'll need to use a transistor to control the flow of current in your circuit. The Metro can tell the transistor when to let current flow and when to stop it.

To learn more about transistors, check out this section from Simon Monk's great guide on using Arduino to control a motor.

If this is your first time with Metro M0 Express, be sure to visit the Metro M0 Express Guide to learn everything you need to know and get set up for programming! 


Here is a simple circuit for using the heater fabric with an Adafruit Metro M0. The Metro is powered by USB. Power from the 12V power supply goes directly to the heater fabric, but the ground goes to the collector of the transistor. The emitter of the transistor connects to the fabric. The base pin of the transistor is connected to pin 10 on the Metro M0 Express. 

An LED is connected to pin 2, for visible feedback that the button code is working. As always, place a resistor on the positive leg of the LED. For more further testing, you could add an LED further downstream in the circuit, to show that the fabric is receiving current.

The Metro M0 Express connections are:


Ground on LED, button, and emitter pin of transistor. Also connect to ground of battery/power supply.

Pin 10

Base pin of transistor

Pin 9

Connect to LED - Place a resistor between this pin and the positive leg of the LED

Pin 2

Connect to button - one side of the button goes to this pin, the other side goes to ground


This code, written in Circuit Python, controls the flow of current to the fabric through the transistor connected to data pin 10. When we set the pin to high, the fabric will heat up. When the pin is set to low, the current will stop flowing to the fabric, and it will slowly start to cool down.

Pressing a button connected to data pin 2 illuminates the LED and sends current to the fabric, heating it up. Releasing the button stops the flow of current. 

# Experiments with Conductive Heater Fabric
# -----------------------------------------
# This demo uses a Metro M0 Express and a transistor to control the flow of current to a piece of high-conductive heater fabric. 
# Pressing a button (on pin 2) causes the fabric to heat up. Releasing the button stops the flow of current. 
# An LED is included in the circuit (on pin 9) as feedback for when the button is being pressed/current is flowing to the fabric.

import time
from digitalio import DigitalInOut, Direction, Pull
import board

# Set up the transistor on Pin 10, name it "base", and make it an output.
base = DigitalInOut(board.D10)
base.direction = Direction.OUTPUT

# Set up the LED on Pin 9, name it "led", and make it an output.
led = DigitalInOut(board.D9)
led.direction = Direction.OUTPUT

# Set up the button on Pin 2, name it "switch", and make it an input. Enable the pull up resistor on the pin.
switch = DigitalInOut(board.D2)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

while True:

    if switch.value:
        base.value = False
        led.value = False
        base.value = True
        led.value = True

    time.sleep(0.01)  # debounce delay

This guide was first published on Mar 27, 2018. It was last updated on Mar 27, 2018.

This page (Control It With Metro M0 Express) was last updated on Mar 21, 2018.

Text editor powered by tinymce.