# Design Your Own Macropad With AI Auto-Layout

Learn how to design a custom macropad PCB, customize the layout, and use AI Auto-Layout to route your board for manufacturing.

Written by [Jharwin Barrozo](https://flux.seobdtools.com/jharwinbarrozo)

Published Nov 2026 - 8 min read

[![Two custom macro pads designed using Flux and powered by Raspberry Pi Pico. The pads feature 12 mechanical switches with per-key white keycaps, two rotary encoders for additional control, and a slide potentiometer for precise adjustments. Both boards are displayed with a vibrant purple PCB design, showcasing Flux's PCB editor and its newest AI Auto-Layout, and are compatible with popular manufacturer specifications.](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/main.webp)](#)

Hitting the same keys and toggling commands all day is incredibly tedious. A macropad can free up mental bandwidth and speed up your workflow—whether you’re designing PCBs, writing firmware, editing videos, or any other repetitive task. In this post, we’ll guide you through an existing [macropad design](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2?editor=pcb_3d) in Flux so you can:

-   **Fork** it instantly and use it as-is, or
-   **Tweak** it to your heart’s content—add more keys, swap out the microcontroller, or rearrange the layout.
-   **Use** AI Auto-Layout to handle routing automatically.

By the end, you’ll have a **production-ready custom macropad** you can actually order—and, if you’re up for it, share your unique spin with the Flux community.

[

![macropad keyboard 3D view in Flux](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/macropad-3d-view.webp)

](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2)

### Inside the Custom Macropad Build

This example takes inspiration from the popular “[Figma Creator Micro](https://worklouder.cc/figma/),” which was designed to speed up design software workflows. We wanted a similarly compact macropad with **plenty of customization**.

**Key Components and Features**:

**1\. Raspberry Pi Pico 2** ([RP2350A](https://flux.seobdtools.com/projects/ad90d263-ca7f-44e2-bdcf-9239d27830cb))

-   The latest Pico variant, provides more power and capability.
-   Offers native USB HID functionality, so your custom macropad can be recognized as a keyboard.

**2\. External Flash Memory** ([W25Q32RVXHJQ](https://flux.seobdtools.com/projects/f6058fec-511b-4a19-ada2-6e7e8e01dbef))

-   3V, 32M-bit serial flash with dual/quad SPI & QPI.
-   Useful if you need extra storage for more complex macros, animations, or data logging.

**3\. Two Rotary Encoders** ([PEC12R-2220F-S0024](https://flux.seobdtools.com/projects/bdcc35a8-1a10-45a2-b266-fb195c009c4d))

-   Adds dial-based input for volume, scrolling, or continuous adjustments.
-   Each encoder can also include a push-button switch, depending on the model.

**4\. Slide Potentiometer** ([PTA2043-2010CIB103](https://flux.seobdtools.com/projects/3f77386d-6087-4742-a7b6-9ce2e6759aea))

-   Provides smooth, precise adjustment—great for volume, brightness, or scrubbing through a timeline.

5\. [Mechanical Key Modules](https://flux.seobdtools.com/collinsemasi/mechanical-key-module)

-   Each “module” includes a [Kailh PG1353](https://flux.seobdtools.com/vasy_skral/kailh-choc-v1) low-profile clicky switch, an RGB LED ([WS2812-2020](https://flux.seobdtools.com/jecstronic/ws2812-2020)), and a diode.
-   Using **modules** in Flux means one click = the entire key circuit. This modular approach simplifies duplication and future updates.

[

![Macropad keyboard close-up 2D view in Flux](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/pcb-2d-closeup.webp)

](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2)

### Macropad PCB Design: Layout & Ground Fill

We used **Flux’s automatic ground fill** to ensure easy, noise-free connections across the board. [Smart vias](https://docs.flux.ai/reference/smart-vias) also help optimize routing, especially in compact designs. That keeps your layout clean and production-friendly.

**See the Schematic and PCB**: [Open/Clone the Example Project in Flux](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2) to explore the design step by step. If you want a no-fuss option, you can literally just fork and order it as-is.

### Step 1: Fork the Example

1.  **Open the Project**: Click [this link](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2) to open the project
2.  **“Fork” in Flux**: This copies everything—schematic, PCB layout, modules—into your workspace.
3.  If you love the project and want to manufacture it as is, **feel free to skip to Step 5.**

[

![Macropad keyboard project schematic diagram in Flux](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/macropad-schematic-diagram.webp)

](https://flux.seobdtools.com/flux/pico-macro-keyboard-v2?editor=schematic)

### Step 2: Understand the Modules & Connections

Before you start tinkering, it helps to see how everything fits together. If you’re not sure why certain parts are included or how they’re wired, you can simply ask [Flux Copilot](https://flux.seobdtools.com/p/blog/flux-copilot-the-first-ai-powered-hardware-design-assistant), our AI assistant, **right in the project**.

**Example Copilot Prompts:**

> ***@copilot*** *can you explain how the Mechanical Key Module is wired to the Raspberry Pi Pico?*

> ***@copilot*** *what’s the function of the external flash memory in this design?*

> ***@copilot*** *can you outline how the two rotary encoders are connected?*

> ***@copilot*** *which GPIO pins are currently free for additional keys or sensors?*

You can also request a **high-level overview** of the entire project:

![Copilot is responding to a user, explaining about a project](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/copilot-explain-this-project.gif)

Copilot will respond with details about components, pin assignments, and even why certain parts were chosen, helping you understand the design before you dive into any major customizations.

### Step 3: Customize the Macropad PCB

A quick way of personalizing this design would be to add some more keys. Each [Mechanical Key Module](https://flux.seobdtools.com/collinsemasi/mechanical-key-module) is pre-built with the switch, diode, and LED. If you want more (or fewer) keys:

**1\. Copy the Module** in the schematic.

2\. Ask Copilot for an unused GPIO on the RP2350. Type:

> *@copilot Find a free GPIO Pin on the RP2350 where I can connect a new key*

3\. Let Flux Copilot handle the actual schematic wiring if you’d like. Type:

> *@copilot connect Key13 GPIO X*

For the **rotary encoders** and **slide potentiometer**, you’ll see them already placed in the schematic. Feel free to move them around, switch to different pins, or remove them if you don’t need them.

### Step 4: Arrange Components and Run AI Auto-Layout

Switch to the PCB editor to see the current footprint placements.

1.  **Move Stuff Around**: Want the Pico on the left edge for easier USB access? Just drag it.
2.  **Add or Remove Key Modules**: If you duplicated or removed keys in the schematic, you’ll see that reflected here.
3.  **Run AI Auto-Layout**: Click “Auto-Layout.” Flux’s AI engine will handle trace routing, ensuring a clean layout.

Repeat or tweak until the board shape, connector positions, and overall look match your preferences.

![AI Auto-Layout is activated on a project. AI will now about to start routing the board.](https://flux.seobdtools.com/p/assets/blogs/rpi-macro-2/ai-auto-layout-click.gif)

### Step 5: Finalize & Order

1.  **DRC Checks**: Flux flags any design-rule violations in real-time. Address issues if they pop up (like overlapping components or unconnected nets).
2.  **Ground Fill & Stitching**: We rely on Flux’s automatic ground fill for noise reduction. No need to do it manually.
3.  **Export Gerbers or Order Directly**: Once satisfied, generate manufacturing files or send them straight to your chosen PCB board house.

That’s it! You’ll have your custom macropad PCB in hand in a couple of weeks—ready to solder and test.

### Step 6: Program the Pico

We’ve included a **MicroPython** firmware example that handles **debouncing**, **RGB lighting**, **rotary encoder tracking**, and **custom macros**. You can tweak it however you like: add more key commands, change LED effects, or even integrate USB HID keyboard functionality.

The **full MicroPython example code** is available in the Flux project.

```python
import machine
import utime
from neopixel import NeoPixel

# Define GPIO pins for switches
SWITCH_PINS = [2, 3, 4, 5]  # Assign GPIOs for your 4 macro keys
switches = [machine.Pin(pin, machine.Pin.IN, machine.Pin.PULL_UP) for pin in SWITCH_PINS]

# Define debounce time to avoid false readings from bouncing switches
DEBOUNCE_TIME = 20  # 20 ms debounce

# Define GPIO pins for encoders
ENCODER_A = machine.Pin(6, machine.Pin.IN, machine.Pin.PULL_UP)
ENCODER_B = machine.Pin(7, machine.Pin.IN, machine.Pin.PULL_UP)

# LED control (assuming WS2812 or other RGB LEDs)
LED_PIN = machine.Pin(15, machine.Pin.OUT)
NUM_LEDS = 4
leds = NeoPixel(LED_PIN, NUM_LEDS)

# Variables to track encoder state
encoder_position = 0
last_encoder_state = (ENCODER_A.value(), ENCODER_B.value())

# RGB Color values
OFF = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
WHITE = (255, 255, 255)

# Macro definitions
MACROS = {
    0: 'Volume Up',
    1: 'Volume Down',
    2: 'Next Track',
    3: 'Previous Track',
}

# Timer to avoid debounce issues
def debounce(pin):
    last_state = pin.value()
    utime.sleep_ms(DEBOUNCE_TIME)
    current_state = pin.value()
    return last_state == 1 and current_state == 0

# Key press handler with debounce and macro execution
def check_keys():
    for i, switch in enumerate(switches):
        if debounce(switch):
            print(f"Key {i+1} pressed")
            execute_macro(i)
            led_feedback(i)

# Execute macro action based on key pressed
def execute_macro(key):
    macro = MACROS.get(key, "Undefined Macro")
    print(f"Executing {macro}")
    # Advanced users can add HID USB keyboard functionality here
    # For example, using the 'uhid' module or CircuitPython's USB HID library

# LED feedback function with color cycling for each key press
def led_feedback(key):
    colors = [RED, GREEN, BLUE, WHITE]  # Different colors for each key
    leds.fill(OFF)  # Clear all LEDs
    leds[key] = colors[key % len(colors)]  # Cycle through colors for each key
    leds.write()

# Encoder read function to track position and detect rotation
def check_encoder():
    global encoder_position, last_encoder_state
    current_state = (ENCODER_A.value(), ENCODER_B.value())
    
    if current_state != last_encoder_state:
        if current_state == (0, 1):  # Clockwise
            encoder_position += 1
            print(f"Encoder rotated clockwise: {encoder_position}")
        elif current_state == (1, 0):  # Counterclockwise
            encoder_position -= 1
            print(f"Encoder rotated counterclockwise: {encoder_position}")
        
        # Apply color change based on encoder position
        adjust_led_brightness(encoder_position)
        last_encoder_state = current_state

# Function to adjust LED brightness based on encoder input
def adjust_led_brightness(position):
    brightness = max(0, min(255, position * 10))  # Scale brightness from 0 to 255
    print(f"Adjusting LED brightness to: {brightness}")
    leds.fill((brightness, brightness, brightness))  # Uniform brightness for all LEDs
    leds.write()

# Main loop with key check, encoder check, and periodic updates
while True:
    check_keys()
    check_encoder()
    utime.sleep(0.05)  # Short delay to prevent CPU overuse
```

**How to Flash**:

-   Put your Pico in bootloader mode. (Hold the BOOTSEL button while plugging it in via USB.)
-   Drag-and-drop a .uf2 build of this code onto the Pico drive.
-   Or use a MicroPython IDE (like Thonny) to upload the .py script directly.

### We Want to See Your Custom Macropads!

A macropad is a fun, hands-on introduction to designing **professional-grade PCBs** with Flux—while still being small and easy to iterate on. Using modules, AI Auto-Layout, and built-in Copilot means you can move fast, experiment freely, and end up with a fully functional device you’ll actually use every day.

Ready to **fork** this design and customize the hardware, firmware, or both?

-   **Add More Keys**: Throw in extra mechanical key modules.
-   **Go Wild with RGB**: Make each key’s LED do something different.
-   **Try a Different Microcontroller**: If you need more GPIO or different features.
-   Share Your Build: We’d love to see build photos and code snippets.

**Share your unique designs** with the Flux community for a chance to be featured in an upcoming showcase!

We can’t wait to see your take on this build—happy designing!

## About the author

[Jharwin Barrozo](https://flux.seobdtools.com/jharwinbarrozo)

Electronics Engineer at Flux

Jharwin is an electronics engineer mainly focused on satellites. He built his own ground station using Flux to monitor RF activities on the International Space Station. Find him on Flux [@jharwinbarrozo](https://flux.ai/jharwinbarrozo)

Let’s start building

Build your big idea together with Flux. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.

![Close-up photo of a PCB made with Flux, with an ESP32 module, buttons, and a microSD slot.](https://flux.seobdtools.com/p/assets/blogs/miscellaneous/sidebar-cta-pcb.webp) [Try it Free](https://flux.seobdtools.com/signup)

## More in Step-by-Step Projects & Templates

[

![This image features two main components: On the left is a detailed layout design of an electronic circuit board named "GREEN DOT 2040E5," dated 2023.11.11, and marked as made with Flux.AI. This board includes an RP2040 microcontroller at its heart, surrounded by various electronic components like resistors, capacitors, a switch, and interface connectors for peripherals, labeled with GPIO pins, I2C connections (SDA and SCL), ground (GND), and power supply inputs (3.3V, 5V, 12V). On the right, there's a physical representation of the IoT device, which is an assembled and operational LoRa IoT Sensor Node powered by a battery pack and RP2040 microcontroller. The node is connected to a long, black antenna, indicating its capability to communicate over LoRa (Long Range) wireless networks, commonly used in agriculture for remote monitoring and control. The setup suggests its application in smart agriculture solutions, utilizing IoT technology to collect and transmit data for agricultural purposes.](https://flux.seobdtools.com/p/assets/blogs/green-dot-board-how-to/main.webp)

### How to design and deploy a LoRa IoT sensor node with RP2040

14 Min Read](https://flux.seobdtools.com/p/blog/how-to-design-and-deploy-a-lora-iot-sensor-node-with-rp2040)[

![Using copilot to help design a webcam based on Omnivision's image sensor. Half of the screen is about the schematic and half is about the pcb layout.](https://flux.seobdtools.com/p/assets/blogs/using-ai-to-design-webcam/main.webp)

### Using AI to Design a Webcam: An End-to-End Example

8 Min Read](https://flux.seobdtools.com/p/blog/using-ai-to-design-a-webcam-an-end-to-end-example)[

![40+ open-source hardware projects you can build over the holidays with Flux](https://flux.seobdtools.com/p/assets/blogs/projects-you-can-build-over-the-holidays/main.webp)

### 40+ Hardware Projects You Can Build Over the Holidays

7 Min Read](https://flux.seobdtools.com/p/blog/40-plus-hardware-projects-you-can-build-over-the-holidays)[

![How to Design a Custom Keyboard PCB](https://flux.seobdtools.com/p/assets/blogs/how-to-design-a-keyboard-pcb/main.webp)

### How to Design a Custom Keyboard PCB

12 Min Read](https://flux.seobdtools.com/p/blog/how-to-design-a-keyboard-pcb)[

![Arduino microcontroller board used in a home automation system project. Do it yourself or hobbyist level PCB board.](https://flux.seobdtools.com/p/assets/blogs/arduino-essential-guides/main.webp)

### Master DIY Electronics: Essential Guides to Arduino Projects

7 Min Read](https://flux.seobdtools.com/p/blog/master-diy-electronics-essential-guides-to-arduino-projects)[

![Two blurred Arduino boards placed at the background and an upcoming Arduino Matter Board at the foreground. Arduino and Silicon Labs team up to make the Matter protocol accessible to all](https://flux.seobdtools.com/p/assets/blogs/arduino-matter/main.webp)

### Revolutionizing IoT Design: Flux Brings Arduino-Based Matter Projects to Life

4 Min Read](https://flux.seobdtools.com/p/blog/revolutionizing-iot-design-flux-brings-arduino-based-matter-projects-to-life)[

![Different reference design PCB boards made with Flux](https://flux.seobdtools.com/p/assets/blogs/harnessing-power-reference-designs/main.webp)

### Harnessing the Power of Flux for Industrial Sensing Applications

8 Min Read](https://flux.seobdtools.com/p/blog/harnessing-the-power-of-flux-for-industrial-sensing-applications)[

![Ryan, an electronics engineer holding an AI pin he created using Flux with the help of Copilot.](https://flux.seobdtools.com/p/assets/blogs/ai-pin-tutorial/main.webp)

### PCB Design Tutorial: AI Pendant

3 Min Read](https://flux.seobdtools.com/p/blog/pcb-design-tutorial-ai-pendant)[

![Top 5 CES 2025 Hardware Projects You Can Build With Flux](https://flux.seobdtools.com/p/assets/blogs/ces2025-projects/main.webp)

### Top 5 CES 2025 Hardware Projects You Can Build With Flux

5 Min Read](https://flux.seobdtools.com/p/blog/top-5-ces-2025-hardware-projects-you-can-build-with-flux)[

![Why you should start designing your PCB from a template](https://flux.seobdtools.com/p/assets/blogs/start-from-a-template/main.webp)

### Why you should start designing your PCB from a template

3 Min Read](https://flux.seobdtools.com/p/blog/why-you-should-start-designing-your-pcb-from-a-template)[

![A user interface featuring a dialog box that appears at the start of each new project, providing a selection of pre-designed templates. This feature allows users to quickly initiate their designs by choosing from an array of pre-existing options tailored to different project types.](https://flux.seobdtools.com/p/assets/blogs/project-launcher/main.webp)

### Never Start from Scratch Again: Introducing the New Project Launcher

3 Min Read](https://flux.seobdtools.com/p/blog/never-start-from-scratch-again-introducing-the-new-project-launcher)[

![Flux app screenshot with raspberry pi pico schematic diagram](https://flux.seobdtools.com/p/assets/blogs/raspberry-pi-pico-in-20mins/main.webp)

### Raspberry Pi Pico Schematic in 20 minutes using Flux Copilot

4 Min Read](https://flux.seobdtools.com/p/blog/raspberry-pi-pico-schematic-in-20-minutes-using-flux-copilot)[

![Agri.iO revolutionizes farming with Flux](https://flux.seobdtools.com/p/assets/blogs/case-study-agri-io/main.webp)

### Agri.iO revolutionizes farming with Flux

4 Min Read](https://flux.seobdtools.com/p/blog/agri-io-revolutionizes-farming-with-flux)[

![Tilt Tracker smart sensor mounted on a door lock, with a phone app showing the door is locked](https://flux.seobdtools.com/p/assets/blogs/case-study-tilt-tracker/main.webp)

### He'd never designed a PCB. Now Tilt Tracker is taking pre-orders.

6 Min Read](https://flux.seobdtools.com/p/blog/building-tilt-tracker-first-pcb-in-flux)[

![Top 10 Popular Microcontrollers for Embedded Systems including STM32F103C8T6, ESP32, ESP8266, ATtiny85, PIC16F877A, ATmega32U4, ATmega328P, and more. Essential MCUs for IoT, DIY projects, and professional PCB designs with key features like Wi-Fi, USB, and Bluetooth support.](https://flux.seobdtools.com/p/assets/blogs/top-10-popular-mcu/main.webp)

### Design Your First PCB: 10 Popular Microcontrollers to Get Started

5 Min Read](https://flux.seobdtools.com/p/blog/design-your-first-pcb-10-popular-microcontrollers-to-get-started)[

![New NextPCB Templates For More Streamlined Manufacturing](https://flux.seobdtools.com/p/assets/blogs/nextpcb-templates/main.webp)

### New NextPCB Templates For More Streamlined Manufacturing

4 Min Read](https://flux.seobdtools.com/p/blog/new-nextpcb-templates-for-more-streamlined-manufacturing)[

![Flux + Seeed: From Template to PCB in Minutes](https://flux.seobdtools.com/p/assets/blogs/flux-to-seeed/main.webp)

### Flux + Seeed: From Template to PCB in Minutes

3 Min Read](https://flux.seobdtools.com/p/blog/flux-seeed-from-template-to-pcb-in-minutes)

See All (17)

## Let’s start building.

Let’s build your idea together. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.

[Try it Free](https://flux.seobdtools.com/signup)

 ![Close-up of a Flux-designed printed circuit board](https://flux.seobdtools.com/p/assets/homepage-v2/mission-visual.webp)
