This repository contains cleaned-up demo firmware for the touch wheel badge, suitable for public release and custom projects. Three different firmware examples are provided to showcase various capabilities of the hardware.
Advanced musical demonstration with multiple modes:
- Free Play Mode: Continuous tone generation based on touch position
- Scale Mode: Quantized musical scales
- Chord Mode: Play musical chords
- Arpeggio Mode: Automatic arpeggios
- Visual Wheel: Colorful wheel visualization with effects
- Musical Features: Multiple scales (Major, Minor, Pentatonic, Blues)
Simple touch wheel demonstration:
- Touch Detection: Basic capacitive touch wheel functionality
- LED Indicators: 6 LEDs that light up based on touch position
- Calibration: Automatic baseline calibration
- Serial Output: Debug data for development
- Visual Feedback: Simple wheel visualization on display
Additional badge firmware with menu system:
- Touch Wheel Demo: Interactive capacitive touch wheel with visual feedback
- Menu System: Navigate between different modes using the touch wheel
- Audio Feedback: Simple tone feedback for interactions
- Mini Games: Placeholder for future game implementations
- Credits Screen: Information about the original creators
- Clean Architecture: Modular code structure for easy customization
All firmware examples work with the same hardware:
- ESP32 microcontroller (ESP32 Thing or compatible)
- ST7789 TFT Display (240x320 pixels)
- 6 LEDs connected to GPIO pins
- 3 Capacitive touch sensors for wheel input
- Buzzer for audio feedback
- Center button (capacitive touch)
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin#define LED_1_PIN 21
#define LED_2_PIN 22
#define LED_3_PIN 19
#define LED_4_PIN 17
#define LED_5_PIN 16
#define LED_6_PIN 25#define SELECT_PIN 27 // Center button
#define Q1_PIN 13 // Touch sensor 1
#define Q2_PIN 12 // Touch sensor 2
#define Q3_PIN 14 // Touch sensor 3#define BUZZER_PIN 5Download and install the Arduino IDE if you haven't already.
- In Arduino IDE, go to File > Preferences
- Add this URL to "Additional Board Manager URLs":
https://espressif.github.io/arduino-esp32/package_esp32_index.json - Go to Tools > Board > Boards Manager
- Search for "esp32" and install the ESP32 package by Espressif
- Go to Sketch > Include Library > Manage Libraries
- Search for "TFT_eSPI" and install the library by Bodmer
- IMPORTANT: You must configure the library for the ST7789 display
-
Navigate to your Arduino libraries folder:
- Windows:
Documents/Arduino/libraries/TFT_eSPI/ - Mac:
~/Documents/Arduino/libraries/TFT_eSPI/ - Linux:
~/Arduino/libraries/TFT_eSPI/
- Windows:
-
Open
User_Setup.hin a text editor -
Comment out any existing driver and add these lines:
#define ST7789_DRIVER // Configure for ST7789 display // Pin definitions (add these to User_Setup.h) #define TFT_MISO 19 #define TFT_MOSI 23 #define TFT_SCLK 18 #define TFT_CS 15 #define TFT_DC 2 #define TFT_RST 4 #define TFT_WIDTH 240 #define TFT_HEIGHT 320
- Choose one of the three firmware options:
tonechaser/tonechaser.ino- Musical demonstrationworking/working.ino- Basic touch wheel testwheel_visualization/wheel_visualization.ino- Full interactive demo
- Open the chosen
.inofile in Arduino IDE - Select your ESP32 board: Tools > Board > ESP32 Arduino > ESP32 Thing (or your specific ESP32 variant)
- Select the correct COM port: Tools > Port
- Click Upload
| Feature | working | tonechaser | wheel_visualization |
|---|---|---|---|
| Touch Detection | ✅ Basic | ✅ Advanced | ✅ Advanced |
| LED Control | ✅ | ✅ | ✅ |
| Audio Feedback | ❌ | ✅ Musical | ✅ Simple |
| Visual Display | ✅ Simple | ✅ Colorful | ✅ Interactive |
| Menu System | ❌ | ❌ | ✅ |
| Multiple Modes | ❌ | ✅ | ✅ |
| Calibration | ✅ | ✅ | ✅ |
| Serial Debug | ✅ | ❌ | ✅ |
| Code Complexity | Simple | Medium | Advanced |
- Touch Wheel: Touch around the capacitive wheel to see visual feedback and light up LEDs
- Center Button: Press the center capacitive button (varies by firmware)
- Calibration: All firmware automatically calibrates on startup (don't touch during this phase)
- Simple touch detection with LED feedback
- Displays raw sensor values and touch angle
- Best for hardware testing and development
- Multiple musical modes (Free Play, Scale, Chord, Arpeggio)
- Press center button to cycle through modes
- Rich visual effects and musical scales
- Continuous tone generation based on touch position
- Full menu system with navigation
- Touch wheel demo mode
- Placeholder mini-games section
- Credits screen
- Most complete user experience
All firmware examples are designed to be easily modified:
- Pin Configuration: Modify pin definitions in each sketch
- Touch Sensitivity: Adjust touch thresholds
- Colors and Effects: Customize visual appearance
- Audio: Modify tones and musical scales
- Menu Items: Add new screens and functionality
- Blank Screen: Check TFT_eSPI configuration in
User_Setup.h - Wrong Colors: Verify
ST7789_DRIVERis defined - Upside Down: Adjust
tft.setRotation(0)in setup()
- No Touch Response: Check capacitive touch sensor connections
- Erratic Behavior: May need recalibration or threshold adjustment
- LEDs Not Working: Verify LED pin connections
- Library Not Found: Install TFT_eSPI library via Library Manager
- Pin Conflicts: Check pin definitions match your hardware setup
- Memory Issues: Try a simpler firmware if running out of memory
This firmware was originally designed for a specific touch wheel badge but can be adapted for custom hardware. The touch wheel uses three capacitive sensors positioned 120° apart to triangulate touch position around a circular perimeter.
The algorithms calculate touch position using trigonometric interpolation between the three sensor readings, providing smooth and accurate position detection around the full 360° wheel.
Each firmware demonstrates different aspects of the hardware capabilities:
working/: Foundation for understanding the basic touch detection algorithmstonechaser/: Advanced audio synthesis and visual effectswheel_visualization/: Complete UI framework and menu system
Use these as starting points for your own projects or as learning examples for capacitive touch wheel implementations.
All credit to Fourfold. Visit fourfold.co for more info.
This is demonstration firmware provided as-is for educational and development purposes. WiFi functionality, splash screens, and proprietary content have been removed for public release.