Skip to main content

Awful Mouse


A mouse made with a joystick and a rpi pico. I made it to try out the pico’s HID capabilities and the rust HAL for it. It’s called “Awful mouse” because it’s hard to control and it lacks the right click and scroll wheel.

I made it with a potentiometer based joystick with a press button, so there’s only a left click. If the joystick was bigger, it would have potential as an alternative game controller. I could see it being used to aim and shoot in games like Enter The Gungeon. Other than that, it’s just a little project.

I liked working with the usb_device library, I think using a struct to manage all the HID data is really neat. It is also really simple to use:

let report = MouseReport {
            x: u8,
            y: u8,
            buttons: u8,
            wheel: u8,
            pan: u8,


It is as simple as feeding the struct the XY coordinates, the state of the buttons and the speed of the scrollwheel, and sending it with the push_mouse_movement function. The push_mouse_movement function is an abstraction for a bit of unsafe code though:

cortex_m::interrupt::free(|_| unsafe {USB_HID.as_mut().map(|hid| hid.push_input(&report))}).unwrap()

I also found it neat that you can define some of the USB info:

let usb_dev = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27da))
        .manufacturer("All of this")
        .product("can be changed")
        .serial_number("to whatever you want")

So if you are building something like a custom keyboard, you can have it seem more professional or hide a fun little easter egg for those who like to look.

Check out the project on gitlab: