Mouse
- 7 Devlogs
- 54 Total hours
Fully custom open-source wireless mouse
Fully custom open-source wireless mouse
the mouse now exists. in flesh and blood. (it’s printed out of PLA actually but you get the idea)
I’ve actually tried using this mouse in place of a normal mouse for a little while, and it isn’t that bad. (unless you count the issues where it randomly disconnects, bad ergonomics, inability to drag click, etc)
i have designed version 2 already with several upgrades including:
but unfortunately i have lost access to my 3d printer for a while so I can’t actually print it yet.
i have finally finished version 1 of the mouse enclosure.
yes, this took me 10 hours. no, I am not very good at CAD.
a lot of the time was spent towards trying to make the curves work better, but onshape really hates 3d curves for some reason. Half the time when I tried to make some major change I had to revert it because the changes completely broke everything.
anyways here’s the model (so far). Now i have to CAD a custom scroll wheel and the side buttons. I am really going to hate onshape by the end of this.
i have been in the cad trenches.
I don’t have too much experience with CAD, and especially with making something as complex as a whole mouse. Learning how to make the curves properly was a bit of a learning….. curve (laugh at my funny joke please)
after much trial and error, I got this prototype of a mouse baseplate done. I 3d printed it as well to get a better sense of scale + check my lens height alignment
The software part of the mouse is done! (mostly)
I managed to finally finish up the software portion of this project after fixing all the bugs from last devlog. It now functions almost entirely like a regular bluetooth mouse.
Things I did:
There are still a few things I’d like to work on in software, but now I’ll be shifting my main focus towards designing the enclosure for this mouse. There are a few things I want to add still:
I haven’t done CAD in quite a bit, so I expect the enclosure design to be a bit of a trial-and-error process. For the time being, I’m just glad I don’t have to deal with software bugs anymore…..
This was supposed to be a short devlog.
(9 hours of coding time later….)
Unfortunately, not that much actual progress has been made. It’s just how things go sometimes in embedded development. Here’s what happened:
My SPI implementation for my mouse sensor decided to stop working randomly. Therefore, I had to spend a couple hours to figure out what caused it and to replace it with an entire new SPI implementation.
(My current best theory on what happened was that I was trying to run my sensor’s 3 wire SPI using Zephyr’s 4 wire SPI library, which led to problems whenever I increased the frequency.)
Right after I fixed this, all my old PREVIOUSLY WORKING mouse code suddenly stopped working. I then spent another several hours fixing this as well. I eventually narrowed it down to some kind of problem with the bootloader, but I still have no idea what it is. I’m just using some workarounds for now.
So that’s how i spent 9 hours (+ more unlogged time bc my logging and stuff isn’t actually on VSCode) getting back to where I was last devlog. I LOVE EMBEDDED! YIPPEEEE
also here’s a video of the mouse movement actually working
Major progress has been made.
Things done:
Right now i have clicking, scrolling, and mouse movement all working independently, but I haven’t integrated all three together yet. The finished mouse PCB (on the hardware side) should be ready by next devlog.
Future things to work on:
Attached below is a screenshot of my terrible testing setup. I’m so glad that this project (started in January of this year btw) is finally somewhat close to being finished.
I am proud to announce that after 9 hours of coding, I have… still not solved the SECOND MOST EVIL FUCKING BUG I HAVE EVER ENCOUNTERED IN MY ENTIRE LIFE.
the rundown of my project is that I am making an entirely custom mouse. I started this way before stardance, and by the time it started I already had the PCB designed + ordered and a bluetooth mouse connection working. I began logging time around when I started implementing the motion tracking on the mouse sensor through SPI.
communicating with the sensor through SPI took 30 minutes of coding. The problem was the aforementioned evil ass bug I encountered after this, which was basically that the sensor kills itself every time it even barely gets lifted off of the table, and it requires a power cycle to get it back to normal operation. obviously not a very good thing to be happening in a mouse.
now here is the fun part, as I spiral into the depths of insanity:
after changing every software setting in my code that could reasonably fix this issue (sensor force awake mode, SPI transaction issues, SPI clock timings, etc), I decided to test the sensor with some old, verified working code that I had written a month or two prior. One thing to note is that my code so far was written in Zephyr OS while the working code was in Arduino, so I had to make a really jank connection to a different microcontroller board just to run it.
As it turns out, the verified working code.. worked properly. So i made more changes to the Zephyr code, and I still can’t fix the bug. At this point, my Zephyr code is basically a 1-1 recreation of the Arduino code, so I decide to test the Arduino code again to make sure I’m not going insane.
THE VERIFIED WORKING CODE STOPPED WORKING. I HAVE NO IDEA WHY STILL. THE BUG SOMEHOW SPREAD?????
this is what I meant when I said it was evil. i could feel the MALICIOUS INTENT behind this issue as it attempted to destroy EVERY LAST BIT OF MY SANITY.
At this point, I was pretty sure it was a hardware issue, so i re-soldered all the connections, continuity tested them with the multimeter, etc.
it was not a hardware issue.
IT WAS AN OPTICS ISSUE?????
the issue was with the lens that came with my sensor the entire time. I still don’t know what the exact issue is, all I know is that everything works if I take off the lens.
how exactly am I supposed to solve this??? i’m a programmer who knows some hardware stuff. i can’t debug the laws of optics. I did ask AI to help me out (can you blame me at this point?) but it was kind of stupid as per usual.
has any one of u smart people here worked with mouse sensors before??? please send help if you can thank you. I have already ordered a new lens (in case i got unlucky and the one I have is defective) and I am currently considering hiring an exorcist to purge my PCBs of evil spirits.
I was originally going to post a devlog once I got X and Y movement readings on the sensor, but as you can see, I’m a bit stuck at the moment. Another note I’d like to add is that the 9 hours I’ve spent trying to fix this is only the software debugging time. The actual time spent trying to fix this is probably more than double that. I’m too lazy to timelapse me crashing out for several hours.
attached are photos of the sensor lens and my pcb testing rig.
tldr: unfortunately, no progress has been made. evil demons are infesting my project. please send help