Skip to content

giacomo/pico-rgb-keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🎹 RGB Keypad Media Controller with Web Interface and Visual Modes

This project uses a 16-key RGB keypad (Keybow/Pimoroni RGBKeypad) powered by CircuitPython to act as a media controller, keyboard macro pad, and animated LED visualizer. It also includes a built-in web server hosted on the device for static file serving.

🧰 Features

  • Media Keys: Volume, mute, play/pause, track navigation.

  • Keyboard Macros: Predefined key combinations like Ctrl + C, Ctrl + V.

  • Visual Modes:

    • Rainbow Mode: Shimmering rainbow effect on the keypad.
    • Snake Mode: Moving snake animation across the keys.
    • Music Mode: Animated bars with rainbow gradient (not actually audio-reactive).
  • Mode Switching: Dedicated key to cycle through display modes.

  • Web Server: Hosts static content (index.html) accessible via Wi-Fi.


πŸ”Œ Hardware Requirements


πŸ“¦ Dependencies

Install the following CircuitPython libraries on your device:

  • adafruit_hid
  • adafruit_requests
  • adafruit_httpserver
  • adafruit_connection_manager
  • pmk (Pimoroni Keybow library)
  • usb_hid
  • Standard os, math, random, time

πŸ“ Project Structure

project_root/
β”‚
β”œβ”€β”€ code.py                # Main application logic
β”œβ”€β”€ /static/index.html     
β”‚   └── index.html         # Web page served by the board
β”œβ”€β”€ /lib                   # All required CircuitPython libraries
β”‚   └── adafruit_*.mpy
β”‚   └── pmk/

πŸ”§ Setup Instructions

  1. Copy Code & Files Flash your board with CircuitPython, then drag code.py and all necessary libraries to the root of the CIRCUITPY drive. Create a folder named static and write an index.html file - that will automatically served.

  2. Configure Wi-Fi Set environment variables on the board (e.g. using secrets.py or .env) for:

    CIRCUITPY_WIFI_SSID="YourNetwork"
    CIRCUITPY_WIFI_PASSWORD="YourPassword"
    CIRCUITPY_WEB_API_PORT=80
  3. Connect & Run On boot, the keypad will connect to Wi-Fi and start serving index.html. Open your browser to the IP printed in the REPL/log.


🧠 Layer Mapping

The keypad supports the following actions:

Key Index Function
0 Volume Down
1 Mute
2 Volume Up
3 Play/Pause
4 Previous Track
5 Next Track
12 Ctrl + C
13 Ctrl + V
15 Switch Visual Mode (cycle modes)

🎨 Visual Modes

  • RAINBOW_MODE: Continuous color gradient shift.
  • SNAKE_MODE: 3-segment snake slithering through a pre-defined path.
  • MUSIC_MODE: Random height bars with color animation (visual only).
  • DISPLAY_OFF: Turns off all LEDs.

Use the mode-switching key to cycle through them.


🌐 Web Server

Uses adafruit_httpserver to serve a static index.html. This allows for:

  • Hosting a configuration page
  • Serving JSON APIs or interacting with the keypad remotely

πŸš€ Running the Project

  1. Plug in your keypad controller board via USB.
  2. The device will automatically start the server and show animations.
  3. Press key 15 to toggle between visual modes.
  4. Access the web interface by visiting the printed IP address in your browser.

⚠️ Notes

  • This project does not actually sync to real audio in music modeβ€”it’s a visual simulation.
  • Customize the key actions or LED behavior by editing the layer dictionary or mode functions.

πŸ“œ License

This project is open-source under the MIT License. Modify and share freely!


Releases

No releases published

Packages

No packages published

Languages