Projects / Jacket with touch music controls

Jacket with touch music controls

Intermediate3 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. ESP32MPR121

    Test the MPR121 on the bench

    Touch each pad.

  2. ESP32

    Pair as a BLE keyboard

    Check the media keys work.

  3. ESP32MT3608

    Set the MT3608 to 5 V

    Before connecting the ESP32.

  4. ESP32+

    Wire the charger and battery

    Use a protected module.

  5. ESP32

    Sew the patches

    Spirals, no crossing threads.

  6. ESP32

    Connect and test on the sleeve

    Before you finish sewing.

  7. ESP32

    Make the board removable

    For washing.

In short

How do you build a jacket with touch music controls?

Conductive thread patches on a jacket sleeve play, pause and skip music on your phone over BLE. You need ESP32 DevKit V1, MPR121 capacitive touch sensor, Li-Po battery 3.7 V 500 mAh, TP4056 module with protection (USB-C) and MT3608 Boost Module. It takes 7 steps and about 180 minutes.

Level
Intermediate
Time
About 180 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
MPR121 SDA and SCLESP32 GPIO21 and GPIO22I2C
MPR121 3V3 and GNDESP32 3V3 and GNDPower
MPR121 electrodes 0 to 4Conductive thread patches on the sleevePlay or pause, next, previous, volume up, volume down
LiPoTP4056 B plus and B minusCharging (use a module with battery protection)
TP4056 OUT plus and minusMT3608 IN plus and minusBattery to the boost converter
MT3608 OUT (set to 5.0 V first)ESP32 VIN and GNDPower

Code

A phone treats the ESP32 as a Bluetooth keyboard, and a keyboard can send media keys, so touching a patch is the same as pressing play or next on a keyboard. The five patches sewn with conductive thread on the sleeve are read by the MPR121, which senses the change in capacitance when a finger touches. Sew each patch as a flat spiral, keep the threads from crossing or touching, and cover the loose ends with insulation. The board, charger and battery go in a small pocket, away from sweat, with a way to unplug the board before washing. Power: the ESP32 board needs 5 V, so the LiPo goes through a charger with protection and a boost converter that you set to exactly 5.0 V with a meter first. Never connect a LiPo straight to the ESP32's 5 V or 3.3 V pins. LiPo safety for a wearable: protect the cell from bending, crushing, sweat and heat, charge it away from the jacket, and stop using any cell that swells. In the Bluetooth settings of the phone, pair with the name Jacket Remote. Arduino IDE with the ESP32 boards package 2.0.x, board "ESP32 Dev Module".

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// Touch media remote: five capacitive patches act as play or pause, next, previous, volume up and volume down over BLE.
// Libraries: HijelHID_BLEKeyboard, Adafruit MPR121. Board: ESP32. Pair it on the phone like a Bluetooth keyboard.
#include <Wire.h>
#include <Adafruit_MPR121.h>
#include <HijelHID_BLEKeyboard.h>
Adafruit_MPR121 cap;
HijelHID_BLEKeyboard keyboard("Jacket Remote", "ElectroLark", 100);
uint16_t last = 0;
void setup() {
  Wire.begin();
  cap.begin(0x5A);
  keyboard.begin();
}
void loop() {
  uint16_t now = cap.touched() & 0x1F;
  uint16_t pressed = now & ~last;            // newly touched this time round
  if (keyboard.isConnected() && pressed) {
    if (pressed & 0x01) keyboard.tap(MEDIA_PLAY_PAUSE);
    if (pressed & 0x02) keyboard.tap(MEDIA_NEXT_TRACK);
    if (pressed & 0x04) keyboard.tap(MEDIA_PREV_TRACK);
    if (pressed & 0x08) keyboard.tap(MEDIA_VOLUME_UP);
    if (pressed & 0x10) keyboard.tap(MEDIA_VOLUME_DOWN);
  }
  last = now;
  delay(30);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Pair the phoneAppears as Jacket Remote
Touch patch 1Music plays or pauses
Touch patch 2Next track
Touch the volume patchesVolume changes

If it does not work

Phone cannot find it

Forget old pairings and restart the ESP32.

False touches

Keep the threads apart and use shorter leads.

Board resets

Check the boost converter output and battery.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the jacket with touch music controls?

ESP32 DevKit V1, MPR121 capacitive touch sensor, Li-Po battery 3.7 V 500 mAh, TP4056 module with protection (USB-C) and MT3608 Boost Module.

How long does the jacket with touch music controls take to build?

About 180 minutes for a intermediate maker, in 7 steps.

How do I know the jacket with touch music controls works?

Pair the phone: Appears as Jacket Remote. Touch patch 1: Music plays or pauses. Touch patch 2: Next track.

Phone cannot find it: what should I check?

Forget old pairings and restart the ESP32.

False touches: what should I check?

Keep the threads apart and use shorter leads.

Board resets: what should I check?

Check the boost converter output and battery.