An STM32F103C8T6 based MIDI Controller for MIDI2LR (Updated)

In a previous post (here) ,  a project was introduced for those of you who use Adobe Lightroom. There is a way to use a MIDI hardware ‘box’ to control various Lightroom actions. I am told that once you use the hardware controls you will never want to go back to the software ones.  A Lightroom plugin called MIDI2LR  interfaces various MIDI ‘boxes’ to  Lightroom. The MIDI box sends MIDI Control/Change commands to MIDI2LR which then changes them into Lightroom actions. More info on MID2LR can be found HERE.

This post continues the project by adding multiple rotary encoders (in addition to the buttons). Here is how things are wired (download the file for this graphic here):

Here is how it  actually looks all wired together:

In this project (so far) there are two STM32F103C8 microcontrollers. One contains the MIDI control code and interfaces via USB to the PC. It also controls the OLED screen and buttons.  Another one controls the five rotary encoders. A previous post (here) documents the STM32F103C8T6 and interfacing with rotary encoders.

Also shown in the picture above are how the STM32F103C8 microcontrollers are programmed. The one on the left has an FTDI serial-to-usb connector and the one on the right has an ST-Link programmer connected.

The two STM32F103C8 microcontrollers are connected together via I2C (two wires).  To add more rotary encoders, just add another STM32F103C8T6 and up to  five encoders.

In the above picture, at the top left, is a simple I2C circuit which was introduced in a previous post here. Using that circuit, multiple groups of rotary encoders can be added (each additional STM32F103C8T6 can control up to 5 more encoders).

Here is the code (using the Arduino IDE) to load into the STM32F103C8T6 controlling the USB connection, buttons and OLED:

Note: The above code is an enhanced version from the previous post (here) were this project was only using buttons.

Here is the code to load into the STM32F103C8T6 which controls the rotary encoders:

Note: those two sketches will need to be updated if more encoders are added.

Once the code is sent/loaded into the two microcontrollers, just plug in the USB-micro cable (shown in the picture on the right) to your Windows 10 PC and it will be added as an audio device (no drivers are needed as it is automatically recognized). Install the MIDI2LR plugin and while in Lightroom you can test out the button and rotary encoder functions and customize the functionality.

Next up for this project is a custom case,  cleaning up the wiring and adding more encoders! Stay tuned!

Leave a Reply

Your email address will not be published.