A physical button for our makerspace that changes the publicly available opening information. LED indicators show the current space state and connection status.
- Physical Button: Press to toggle space open/closed state
- LED Strip Status: 16 NeoPixel LEDs showing space state (green = open, red = closed)
- Status LEDs:
- LED 0 (first): WiFi status - blinks yellow when connecting, solid yellow on error, follows state when connected
- LED 1 (second): MQTT status - blinks yellow when disconnected, follows state when connected
- Robust Connectivity:
- WiFi reconnection with timeout (30s) and retries (3 attempts)
- MQTT reconnection with exponential backoff (5s to 60s)
- Watchdog: 42s timeout to recover from hangs
- ESP32 (WROOM)
- WS2812B NeoPixel LED strip (16 LEDs)
- Physical button
- Status LEDs (optional GPIO LEDs)
| Component | GPIO Pin |
|---|---|
| NeoPixel Strip | 5 |
| Button | 9 |
| Big Light LED | 6 |
| Button Light LED | 3 |
| Internal LED | 4 |
- Install MicroPython: https://micropython.org/download/ESP32_GENERIC/
- Flash the firmware to your ESP32
- Install MicroPython Tools plugin: https://plugins.jetbrains.com/plugin/26227-micropython-tools
- Create run configuration for your ESP32
https://micropython-stubs.readthedocs.io/en/main/24_pycharm.html
Create a secrets.py file in src/ (see secrets_example.py):
mqtt_server = 'mqtt.example.com'
mqtt_user = 'username'
mqtt_pass = 'password'
# API key for authenticating state changes to status.makerspacebonn.de
API_key = 'your-api-key'
# Dictionary of known WiFi networks to connect to
wifi_access = {
'MyWiFi': 'wifi-password',
'BackupWiFi': 'backup-password',
}src/
├── main.py # Main loop and initialization
├── mqtt_service.py # MQTT client with reconnection logic
├── wifi_manager.py # WiFi management with reconnection
├── state_led.py # Status LED control (ignore/error/blinking)
├── state_manager.py # Space state management (API calls to status.makerspacebonn.de)
├── button_handler.py # Button debouncing and cooldown
├── secrets.py # Configuration (not in repo)
└── lib/
├── trickLED.py # NeoPixel animation library
├── animations.py # LED animation patterns
└── generators.py # Animation generators
- Makerspace Bonn Infocenter
Inspired by the project from https://gitlab.com/jhaand/hacker-hotel-space-state/