Firmware · 2026

STM32 Mouse - Software

Custom firmware in C for my self-developed STM32 mouse – from pin configuration and sensor connection to processing of mouse movements, buttons, and scroll wheel.

Custom Firmware for my STM32 Mouse

Development of a custom firmware in C for my self-designed STM32 computer mouse.

After I had already developed the complete electronics and board of the mouse myself in the Hardware project, the decisive part was still missing: the software that turns the hardware into a functional computer mouse.

I fully developed the firmware in C for the STM32 microcontroller built into my board.

At first I configured the microcontroller with the STM32 tools from STMicroelectronics according to my own PCB design. In STM32CubeMX, I assigned the previously defined pins from the hardware design to their respective functions and set up the required peripheral interfaces. Based on this, the first code base for the project was then generated.

From there I moved on to the actual firmware development. I first dealt with how a computer mouse works at the firmware level and how the various hardware components communicate with each other. Then I implemented the required logic step by step myself.

The firmware connects the individual components of my board: The STM32 processes the data from the PMW3360 motion sensor, detects inputs from the left, right and middle mouse buttons, evaluates the mouse wheel and the DPI button and controls the corresponding mouse functions. The captured inputs are then processed by the microcontroller so that they can be recognized by the connected computer as mouse movements and key inputs.

For flashing and testing the firmware on the hardware, I use, among others, the STM32CubeProgrammer.

What was particularly exciting about this project for me was the direct connection between hardware and software. Since I had developed the board myself, the firmware had to match my own schematic, pinout and components exactly. Errors could not simply be attributed to either the software or hardware side – often I had to look at both levels together and systematically find out where the problem lay.

← All work