Firmware for a PWM‑controlled heated gloves system powered by 12 V 18650 Li‑ion batteries and carbon fiber heating elements. Built around an ATtiny84 microcontroller with an OLED display and thermistor feedback for both manual and automatic temperature regulation.
- PWM power control (0–100%)
- Automatic mode with target temperature regulation (Tautomatic)
- Manual mode with direct duty cycle adjustment
- OLED display (Tiny4kOLED) shows:
- Battery voltage
- Estimated power (W)
- Duty cycle (%)
- Internal (Tint) & external (Text) temperatures
- Current mode (Manual / Automatic)
- Battery monitoring via voltage divider; reduces max power when battery < 9 V
- Safety cutoff at Tmax = 45 °C
- EEPROM storage for mode, target temperature, and max power (Pmax)
- Screen auto‑sleep to save power; wake on button press
- MCU: ATtiny84
- Display: 128×64 OLED (I²C, Tiny4kOLED)
- Power: 3S 18650 Li‑ion pack (~12 V nominal)
- Heating element: Carbon fiber resistive wire (~4.7 Ω per glove)
- Sensors: 10 kΩ NTC thermistors (Steinhart–Hart in code)
- MOSFET: Logic‑level for PWM control of heater
- Buttons: Two push buttons (Up / Down)
- Voltage divider: R3 = 340 kΩ, R4 = 100 kΩ (battery sense)
- Power regulation: The PCB design includes a reverse‑engineered Mini360 buck converter to step the battery voltage down to a stable 5 V for the ATtiny84, OLED, sensors, and logic.
VCC GND PB0 PA0 PB1 PA1 PB3 10 RST PA2 PB2 PA3 PA7 PA4 13 SCK PA6 11 SDA PA5 12 MISO
- TinyI2CMaster
- Tiny4kOLED
- avr/io.h, EEPROM.h (standard AVR/Arduino environment)
- Vcc: 5.02 V (used for ADC voltage calculations)
- gloveResistance: 4.7 Ω (used for power estimate P ≈ (V·duty%)² / R)
- Tmax: 45 °C (safety software cutoff)
- Pmax: Default 100%; auto‑limited to 70% when battery < 9 V
- Screen timeout: 10 s (turns OLED off to save power)
- EEPROM addresses: 0 → automaticMode, 1 → Tautomatic, 2 → Pmax
- Install ATtinyCore in Arduino IDE or use PlatformIO with ATtiny84 support.
- Board: ATtiny84; Clock: 8 MHz internal.
- Wire OLED over I²C (PA6 SDA, PA4 SCK if using SPI pins reference; confirm your OLED’s interface).
- Compile and upload via ISP (e.g., ArduinoISP) or supported programmer.
- Manual mode:
- Up/Down buttons adjust power in 5% steps (0–100%).
- Automatic mode:
- Maintains Tautomatic; power goes to Pmax below target and 0 above target.
- Settings:
- Press both buttons to enter.
- Toggle Manual/Automatic.
- Set Tautomatic (°C).
- Set Pmax (%).
- Values persist via EEPROM.
- V: Battery voltage (computed from ADC and divider)
- P: Estimated power (W), using P ≈ (V·duty%)² / R
- D%: Duty cycle (%)
- Text: External temperature (°C)
- T: Internal glove temperature (°C)
- Mode: Manual / Automatic with on‑screen bar indicator
- Thermistors: 10‑sample averaging; Steinhart–Hart coefficients used directly in code for °C conversion.
- PWM output: PB2 (Arduino pin 8 in code context) via analogWrite; ensure timer compatibility on ATtinyCore.
- Debounce/Timing: Button reads gated by millis() intervals; screen sleeps after inactivity.
- Battery logic: ADC on PA1, scaled with Vcc and divider ratio; reduces Pmax when < 9 V.
- Validate MOSFET thermal performance and add a fuse/thermal cutoff in hardware.
- Test with a current‑limited bench supply before Li‑ion packs.
- Ensure proper insulation and strain relief for heating elements.
- Do not rely solely on firmware for critical thermal protection.
- Flexible and compact PCB
- Bluetooth control
- Include hardware current/thermal safety cutoff
Developed by Marc Prat Plana


