Skip to content

dlakmalw/attiny85-toothbrush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ATtiny85 Toothbrush Firmware πŸͺ₯⚑

CI

ATtiny85 Toothbrush Project

Bare-metal C firmware that turns an ATtiny85 into a three-speed electric-toothbrush controller.
Short press β†’ cycle speeds Β· Long press β†’ start / stop & ultra-low-power sleep


✨ Features

Category Highlights
βš™οΈ Deterministic PWM Phase-correct 8-bit PWM via Timer0 (~16 kHz) for smooth motor control
πŸš€ Three Speed Levels Lookup table for 100%, 66%, and 33% motor duty cycles
πŸ–²οΈ One-Button UI INT0-based ISR distinguishes between short and long presses
πŸ”‹ Ultra-Low Power < 5 Β΅A in SLEEP_MODE_PWR_DOWN mode for long battery life
🧩 Modular Drivers Clean, decoupled APIs for motor, button, and power subsystems
πŸ”„ Continuous Build GitHub Actions CI on every push to main

πŸ“¦ Overview

This project is a minimal but robust firmware for DIY or commercial electric toothbrush designs. It emphasizes low power consumption, predictable timing, and user-friendly control, while sticking to bare-metal C for full control over performance and size.

Ideal for:

  • Battery-powered personal care devices
  • Hobby projects involving brushed DC motors
  • Learning AVR low-level development

πŸ›  Build & Flash

git clone https://github.com/dondfx/attiny85-toothbrush.git
cd attiny85-toothbrush
platformio run             # builds firmware.hex
platformio run -t upload   # flash with USBtinyISP

πŸ”₯ Fuse Settings

Ensure proper clock and power behavior by burning the correct fuses:

LFUSE 0xE2   HFUSE 0xD7   EFUSE 0xFF

To burn the fuses, use this command (replace -c usbtiny if you're using a different programmer):
avrdude -p attiny85 -c usbtiny -U lfuse:w:0xE2:m -U hfuse:w:0xD7:m -U efuse:w:0xFF:m

πŸ“ Project Structure

attiny85-toothbrush/
β”œβ”€β”€ include/        β†’ Header files (motor.h, button.h, power.h)
β”œβ”€β”€ src/            β†’ Source code: drivers + main
β”œβ”€β”€ hardware/
β”‚   β”œβ”€β”€ gerbers/    β†’ PCB manufacturing files
β”‚   β”œβ”€β”€ step/       β†’ 3D STEP model of the PCB
β”‚   └── docs/       β†’ Wiring diagram & connection info (PDF)
β”œβ”€β”€ .github/        β†’ GitHub Actions CI workflow
β”œβ”€β”€ platformio.ini  β†’ PlatformIO project config
β”œβ”€β”€ BOM.md          β†’ Bill of Materials with footprints
└── README.md       β†’ This documentation 

πŸ“Έ Hardware Reference

  • MCU: ATtiny85 @ 8 MHz (internal RC oscillator)
  • Output: PB0 (OC0A) β†’ Motor PWM control
  • Input: PB2 (INT0) β†’ Single button
  • Power Mode: Enters SLEEP_MODE_PWR_DOWN after 2 s long press

πŸ§ͺ Status

βœ… Stable & tested on breadboard and custom PCB

βœ… < 5 Β΅A sleep current

πŸ”„ Future: H-bridge motor driver support (e.g., DRV8833)


πŸ“œ License

This project is licensed under the MIT License.


Built for fun, learning, and real-world utility. Contributions welcome!

About

πŸͺ₯ Three-speed electric toothbrush firmware for ATtiny85 β€” one-button UI, low power, bare-metal C.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages