• All systems go

    Joshua Bemenderfer03/25/2025 at 14:10 0 comments

    In pursuit of a smaller mouse sensor

    In my Cheap Thumb Trackball project, I discovered the YS8205 mouse sensor from a cheap no-name mouse that has an integrated USB controller, no external capacitors, resistors, diodes, oscillators, or anything else. Just a sensor, lens, and a red LED.

    For that project, I cut up the vendor's PCB and connected the USB wires to a RP2040 running jfedor's hid-remapper. However, I was dissatisfied with the size of the combined boards, taking up far more space than I would have liked.

    Splitting the two halves was fun for a split keyboard and enabled adding a 5-way switch for mouse buttons, but was too frustrating and complicated to assemble.

    So I turned my attention to making the sensor-and-RP2040-zero combination as small as possible, with as little soldering as possible.

    Mounting the sensor

    Ultimately the YS8025 sensor only requires four pins to function, VCC, Ground, Data +, and Data -. 

    I found that if you bend the pins backward, they can be soldered to 5v, Ground, GPIO 0, and GPIO 1 on the RP2040-zero. Just barely, but they fit. This matches up perfectly with the pins that hid-remapper expects for USB translation.

    This enabled mounting the sensor directly to the RP2040-zero without an intermediate PCB. It's disgusting and evil, but it works! I slapped the original LED on the side, connected to the control pins of the sensor to test.

    Putting the LED off to the side resulted in inconsistent tracking depending on direction, and I didn't want to make an entire PCB or weird wiring harness to connect up the LED.

    Evil LED tricks

    Since doing things as wrong as possible is on the table, under the assumption that the Pi GPIO pins are unlikely to source enough current to overheat the LED, I connected a red LED to GPIO 8 (+) and 14 (-), and set 8 high and 14 low, putting ~3.3v across the LED.

    Surprisingly, this worked, which lets us bypass the sensor LED control entirely. I also found that using an infrared LED worked as well, removing the need for a bright red-light source on the desk.

    Shrinking the lens

    I was hoping to find a workable alternative lens for the sensor but have yet to find one as effective as the stock PMMA mouse lens. Unfortunately, it comes with a light pipe that is too large for this project and is designed to mount in reverse on the sensor.

    I did find a 4mm diameter, f3.0mm planoconvex lens on Amazon that worked fairly well but required the tracking surface to be almost 15mm from the sensor itself which was far too high for use as a trackball sensor. 

    I also found a 3mm diameter biconcave lens on AliExpress that worked fairly well, though not quite as reliably as the stock lens. This direction is worth investigating.

    Ultimately what worked best was cutting down the stock lens with a rotary tool to remove the light pipe and allow mounting it "backwards".

    Result

    With these hacks combined, the whole system fits into the footprint of the postage-stamp-sized RP2040-Zero and requires only six solder joints to assemble. The only thing needed now is a case for the trackball/finger navigation mount.

    The overall vertical height is higher than I'd like. That is mostly due to the RP2040-Zero's USB port being directly under the sensor. With a custom board, this could all be significantly improved, but I'm happy with where it's at right now.

    Once I build the 3d printed case, we'll see how well the system performs in real-life use.