Lightroom DIY Macro Pad with a Raspberry Pi Pico

Sped up your Lightroom workflows with a small DIY macro pad built with mechanical switches and a Raspberry Pi Pico. This guide will show you how to build and program your own.

Speed up Your Work

A great way to speed your work in Lightroom is to use shortcuts for tasks that are more time-consuming, like culling photos. I’m terrible at memorizing keyboard shortcuts so I created an easy-to-use macro pad.

The pad has 10 switches (keys) where one of them is used to change modes and 9 of them can trigger a command in Lightroom. The mode switch allows you to have an unlimited number of macros, if you can remember all of them :). For instance, I created a mode for culling photos and another one for navigating around in the develop module.

Build Resources

There are two versions of the macro pad: handwire and PCB. As the name implies, the handwire version doesn’t use a printed circuit board (PCB), so you have to connect the switches to the controller with wires. The handwire version is a little harder to solder. On the other hand, the PCB version is more plug-and-play and requires minimal soldering skills.

Here is what you will need:

  • Raspberry Pi Pico
  • 10 MX Compatible Switches
  • 3D printed case
  • Electronics wire around 22 AWG or so (optional for PCB version)
  • PCB (optional for handwire version)
  • Machined Headers (optional for handwire version)
  • 5×2 Magnets
  • Super Glue

As you build your own macro pad and reference the pictures below, keep in mind that I have made multiple changes to the design and some of the pictures were taken from an older version of the macro pad. Always check the GitHub repository for the most current files.

Installing Firmware/Software

First, you’ll need to install CircuitPython on your Raspberry Pi Pico board. I recommend installing version 7.0.0 or higher. Starting with this version, CircuitPython makes it really easy to scan for switch presses. Head out to the official CircuitPython page and follow the instructions on how to install it to your board.

Once your board is running CircuitPython, you’ll need to download the HID library. This is the library that converts bits into commands that your computer can understand. Download the HID library zip file from the GitHub repository and move the adafruit_hid folder under the lib folder on your board. If your board doesn’t have a folder named lib, go ahead and create it first.

Lastly, download the code I created from my Lightroom Macro Pad GitHub repository. This is the code that will handle triggering the shortcuts. You don’t have to install anything else on your computer, all of this code will be installed/copied onto the Pico. You only need to copy code.py and boot.py to your Pico.

So, to recap:

  1. Download and install CircuitPython on your board (CircuitPython page)
  2. Download and move the HID library on your board (GitHub repo)
  3. Move the Lightroom Macro Pad code to your board (GitHub repo)

I’ll show you how to edit the code to customize the shortcuts further in this article. Don’t let the words “edit the code” turn you away, it just requires opening a file in a text editor (like Notepad) and following some instructions.

Wiring the Macro Pad

Switches are very basic components. All they do is close (or open) the connection between two wires. Each switch will be connected to a GPIO pin and a ground Pin on the Pico. When the switch is not being pressed, the current from the GPIO pin can’t flow but once you push on the switch, it will close the connection between the ground and the GPIO pin. When this happens, the Pico will identify which switch was pressed – since each switch is connected to a different pin – and send the corresponding shortcut to the computer it is connected to.

Handwire Macro Pad Pi Pico

Switches don’t have a positive or negative side (polarity) so choose which one of the two pins on the switch will be the ground pin and connect all of them together. Then, connect one of the switches’ ground pins to one of the Pico’s ground pins (GND).

You can see in the picture above that all of the GND pins on the switches are connected with the white wire. The white wire is then connected to a GND pin on the Pico (3rd pin from the bottom on the right side of the board).

After all of the ground pins are connected, it’s time to connect the other pin on the switch to a corresponding GPIO pin on the Pico. There is no right or wrong here. Just connect the switches to their own GPIO pin. Anything that has a light green label in the diagram below is fair game. Keep note of which switch is connected to which GPIO pin, you’ll need this information to edit the firmware file.

PCB Version

If you want something more reliable than soldered wires in mid-air, I designed a PCB that makes putting together a macro pad a breeze. This will require you to solder headers to both the PCB and the Pico, but hey, you get to practice your soldering skills a little more. The case provided with the project is designed around machined headers. Machined headers allow the whole package to be more streamlined since they are not as tall as traditional headers.

“But hey, where do I get this nifty PCB?”, you might ask. Here’s how:

Kailh switch macro pad PCB

Assembling the PCB version is pretty easy. Solder machined headers to the PCB and the Pico, insert the switches and the PCB into the case, solder the switches in place, plug in the Pico into the headers.

Pi Pico on Macro Pad PCB

The top and bottom parts of the case snap together with the use of magnets. The easiest way to keep track of magnet polarity is to stack all of them together. Use the stack of magnets to insert one in each hole on the top part of the case. Flip stack or remaining magnets and insert them in the bottom part’s holes.

Interest in purchasing one of these PCBs? Check them out on my Etsy shop.

Customizing Shortcuts

Customizing the shortcuts is super easy. All you need is a plain text editor like Notepad, Notepad++, or VS Code. Side note, if you are still using Notepad as a plain text editor, consider revisiting your life choices 🙂

There are a few things you have to edit in the code.py file:

  1. Pin to swicth mapping
  2. List of Modes
  3. Available Macros/Shortcuts for each mode

If you are using one of my PCBs, you don’t have to worry about editing the pin to switch mapping.

Here is the switch layout. Keep in mind that switch number 9 is the mode switch and doesn’t follow the same order as the other switches.

|     |   0   |   1   |   2   |
|     |   3   |   4   |   5   |
|  9  |   6   |   7   |   8   |
Pi Pico Macro Pad PCB

Now, open code.py in your favorite plain text editor and find the code block below.

# Pi Pico     SW0        SW1        SW2        SW3        SW4        SW5        SW6         SW7         SW8         SW9       #
board_pins = (board.GP0, board.GP1, board.GP2, board.GP6, board.GP8, board.GP7, board.GP11, board.GP13, board.GP12, board.GP16)

Check the pins you are using on the Pico and update the mapping as needed.

Next, create or edit the Shortcut/Macro classes. These classes are the definition for the key combination that will be sent to your computer. In the examples below you can see two shortcut classes. One to increase the flag status of a photo (mark as a pick) and another one to decrease the flag status. The Lightroom Classic shortcut for these commands are Ctrl + up_arrow and Ctrl + down_arrow respectively. Here is what they look like in code.py.

class increaseFlag:
    
    def macroName():
        return 'Increase Flag Status'
    
    def macro():
        kbd.send(Keycode.CONTROL, Keycode.UP_ARROW)

class decreaseFlag:
    
    def macroName():
        return 'Decrease Flag Status'
    
    def macro():
        kbd.send(Keycode.CONTROL, Keycode.DOWN_ARROW)

You can create as many macro definitions as you want but you can only have nine macros per mode. To enable multiple modes – you guessed it – you have to edit the mode classes in code.py.

class Culling:
    
    def name():
        return 'Culling Shortcuts'
    
    def color():
        return 'red'

    def macros():
        # This is where you add the list of macros for this mode
        # add as many macros as the number of buttons/switches
        return [grid, oneToOneZoom, crop, loupe, increaseFlag, toggleFilters, goPrevious, decreaseFlag, goNext]

In the example above, you can see that the Culling mode has nine different macros.

Finally, you have to tell code.py which modes you would like to load. So, find the block of code below and edit it accordingly.

modes = [LibraryModule, Culling] # Edit this list with the mode classes

That’s it. Save code.py and the Raspberry Pico will automatically reload the configuration you have just edited. Your new macros will start working right away.

Case Design

I put together a very functional case that you can download the 3D files and print one yourself also. The case can be used with both the PCB and the handwire versions.

You’ll need 6 5x2mm magnets and some super glue to secure them in place.

https://github.com/camerahacks/lightroom-macro-pad/tree/main/case

Beyond Lightroom

As you might have imagined, this macro pad is not limited to only Lightroom shortcuts, you can program it any way you wish. For instance, you can a mode for Lightroom and another mode for Photoshop.

What would you use a macro pad for? Let me know in the comments below your ideas for how you would configure your macro pad. Perhaps a way to make Zoom calls without having to hunt for the mute button?

André

André is just a regular dude that loves photography, traveling, and hacking stuff. When he's not planning his next bikepacking trip, he's tinkering with a couple of Raspberry Pi's and writing personal apps. He usually codes in CFML or JavaScript.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *