Project Log 9: MVP!

A project log for OS3M Mouse

"Awesome" Mouse - the open source 3D mouse... mouse

coltonbaldridgecolton.baldridge 06/21/2023 at 05:112 Comments

After long last, there might be light at the end of the tunnel for this project. Since the last update, I have been hard at work on the software front, both for the mouse and for the PC. At the point of my last update, I was so close, yet so far. I still had USB to implement and a Solidworks driver to write. For any hobbyist, USB is a BEAR. There is so much you have to learn... controlled impedances, differential pairs, the MCU's USB peripheral, descriptors, classes like HID, etc, etc. It gets out of hand really fast. On top of that, I had to figure out how to use the Solidworks API, which (thankfully) I already had some experience with back when I wrote that VBA script for FEA (in project log 4). 

Setting off, I began with MCU code containing the algorithm I discussed last log and some serial transmission logic. And since I was already transmitting serial data, I figured the next easiest move would be attempting to add the USB CDC serial class. I thought this would be as simple as adding a few files provided by STM, but found that the example code was too big to fit on my microcontroller! After messing around with varying compiler and linker options, I was able to reduce the code size but it still wouldn't drop below the 16KiB that my microcontroller had. So, for the time being, I shelved USB.

I then worked the other front -- the Solidworks driver. I went with C++ since that is the language I know best, and this proved to be not terribly difficult once I got everything setup properly. The lack of examples certainly hampered progress, but in general the online documentation was pretty alright. My biggest time sink was stumbling through what function calls I needed to make in order to emulate normal CAD mouse controls. This left me back with the bear... USB.

Attempt 2 at tackling the USB implementation went a bit differently. I decided to dig deep, watching YouTube videos and reading sites like USB in a NutShell. I even started poking around the official USB 2.0 specification. The 650 page spec seems daunting at first, but once you've read enough summaries, the actual content doesn't surprise you with much, it just fills in the gaps. With this newfound knowledge, I decided to go right for the kill. The actual target for writing USB for this device was to make it a USB HID compliant joystick. That way, people can write Python, C++, or whatever to read data off this thing and not have to worry about a custom OS driver. (This also saves me work). Ready to fight hard, I went in expecting much pain and suffering as I selected the USB HID example from STM. However, much to my surprise, it compiled just fine, and when plugged into my PC, it just worked. Welp, so much for all that research. 

(not true but still)

The only real modifications I needed to make to the STM example were changing the HID report descriptor (which tells the PC what HID device the device is) and some buffer lengths. And with that, it was no problem! I loaded up the Windows game controller settings and bam, there it was:

So with that, I modified the Solidworks driver to input data from the specific USB VID and PID of the of the OS3M mouse and whadayaknow, it works!

So following up on last log's goals, I'll finally design those book holders (though I have since moved apartments and am not using that bookshelf the same anymore), and get to cleaning up code and releasing it. This is where I'll need some help from you all (the community). I've never released an open source project and the licensing situation is daunting to say the least. I'll put in my best effort to make sure I abide by all the licenses of software I'm using, but can't make any promises that I'll do it right. Please contribute and help me out!

Thanks for reading!


RunnerPack wrote 11/28/2023 at 19:54 point

Minimum Viable Product?

  Are you sure? yes | no

kelvinA wrote 06/21/2023 at 21:33 point

MVP status... the dream milestone. 🎉 

I'm also wondering what I'm going to do about licensing for my projects, so I'll be interested to see what you and/or the community decide on.

  Are you sure? yes | no