geekhack

geekhack Projects => Making Stuff Together! => Topic started by: Frrakeyyyy on Mon, 29 May 2017, 04:39:59

Title: DIY PMW-3360 Gaming mouse
Post by: Frrakeyyyy on Mon, 29 May 2017, 04:39:59
Hi guys,
This is my first post here, and it's about a project I'm currently working on. As the title says, it a DIY gaming mouse based on PMW 3360, and a teensy 3.1, with Omron microswitches. It's still on a perfboard at the moment.


The button debounce is done on software but the next versions will have hardware debounce with dual nand gates for each button.
I'm also planning on adding an optical finger navigation sensor on the thumb side for either scrolling vertically and horizontally, or for fine mouse movement (let's say sniper mode for instance).
The mouse wheel encoder is currently mechanical, do you guys think it should be optical ?
What do you guys think ? Do you have any ideas or suggestions ?



Title: Re: DIY PMW-3360 Gaming mouse
Post by: anorak on Mon, 29 May 2017, 07:49:45
Very nice project! I always wanted to build my very own mouse... Where did you get the PMW3360 from? My impression is that the main problem is the procurement of the sensor. The two nand-gates for debouncing is a nice idea. Is it worth the effort?

Another difficulty I see is the design of a usable housing for the mouse. Any ideas until now?

How about adding a small OLED to display and/or configure settings?
Title: Re: DIY PMW-3360 Gaming mouse
Post by: Frrakeyyyy on Mon, 29 May 2017, 08:27:42
It was hard getting the PMW3360, I almost gave up because i didn't find the PMW3360 and settled for the ADNS9800, you can get sample packs for the PMW3360 from CODICO.
For the debounce, the NAND Gates are worth the effort, it can be done on software as well using the 2 pins from the switches since they are SPDT, but that also means using 2 pins instead of 1 on the MCU side.
The shell would be a bit tricky since i've never done any 3D modeling.
I tried using an oled screen but it was a bit slow and causing the cursor movement to pause when the screen was updating, maybe it's because it was I2C and I should try an SPI one ? If someone has any idea about this let me know.
Another option is a VT100 compatible menu via Serial for configuration, still experimenting with it though.
Title: Re: DIY PMW-3360 Gaming mouse
Post by: anorak on Mon, 29 May 2017, 09:14:27
About COCIDO I have already stumbled upon my search for a dealer for mouse sensors. Not necessarily cheap and you get 5 pieces, after all with the necessary lens. However, this seems to be the only dealer in Europe to order these sensors as a private customer.

Is there a good software example for controlling the 3360 sensors? On github I found two projects.

The biggest advantage of a self developed mouse would be for me the placement and selection of the switches for the thumb buttons. Almost all mice have only small, inferior and badly placed thumb buttons.

What keeps me from such a project so far is the design of a suitable shell ...
Title: Re: DIY PMW-3360 Gaming mouse
Post by: Frrakeyyyy on Mon, 29 May 2017, 09:43:31
For the software, MrjohnK's code is good, it can be improved for use as a mouse by using the burst mode.
I've just found out that MrjohnK has a pmw3360 board on his Tindie store, he's the one i got the ADNS9800 from.
Title: Re: DIY PMW-3360 Gaming mouse
Post by: nevin on Mon, 29 May 2017, 14:52:16
Very nice indeed.

I looked into something like this a while ago, but as you mentioned lack of code/details, getting a sensor, plus i wouldn't be able to write the firmware from scratch either. Ended up with a CM Recon mouse, programmable with a handful of decent buttons (for me)

If it's a project you want to build so that the community can either duplicate or adapt. i'd keep it pretty simple.
- teensy with supporting code/firmware for a specific sensor, wheel & how ever many switches you want to throw at it. Well documented firmware for where all the variables are that might need adjusted for their given setup
     (at this point it could be used as a converter to swap sensors or add functionality to an existing mouse)
     i'd jump all over it in a heartbeat to be able to do this much of it, even buy a mouse to scavenge the sensor out of, if they are that hard to source.

To create more of a polished product to be produced is where the difficulty & fewer selections come in.

As far as shell, i have no idea what you have in mind & i'm sure some of the members of this great community would be willing to lend a hand. One thing i did find when i was looking before was this adjustable top shell for a Logitech M100 mouse. The top shell is very interesting and very unique in many ways, just wish it wasn't created for such a basic mouse.

[attach=1]

designers page: http://www.pyottdesign.com/statial01.html
top shell @ shapeways: https://www.shapeways.com/product/T4C3TT6KM/statial-adjustable-mouse
mouse:https://www.logitech.com/en-us/product/mouse-m100

Anyway, Congrats! And i'll anxiously keep an eye on the project.
Title: Re: DIY PMW-3360 Gaming mouse
Post by: MajorKoos on Tue, 30 May 2017, 10:01:40
I've been on a similar mission, but I could only source the ADNS9800 sensor.
I designed and 3D printed a quick 'n dirty base to hold it together...
The arduino sketch needed a little tweaking to get it working properly, but voila -

[attach=1]

[attach=2]

[attach=3]

I also salvaged some switches, encoders and mouse wheel bits from an old gaming mouse of mine.
Next up I plan to modify this design to fit the components.
https://www.thingiverse.com/thing:2187988
Title: Re: DIY PMW-3360 Gaming mouse
Post by: nevin on Tue, 30 May 2017, 14:39:11
Awesome. Thanks for sharing. Looks very promising.

Nice find on the shell.
Title: Re: DIY PMW-3360 Gaming mouse
Post by: razorconcepts on Mon, 11 September 2017, 12:09:46
I'm working on my own mouse with the PMW3360. It works fine at low speeds (1CM/s), but at higher speeds it the motion sensing interrupt only fires about 5 times a second, which is a bit odd. Does anyone know where the datasheet for the communication protocol is? I found the standard datasheet for the hardware and stuff, but its only like 10 pages long, and the only software stuff it has is a register table.

Also what code is everyone using? The one I'm using is mrjohnk from github.

(https://image.ibb.co/iUYQOa/mice.jpg)
Title: Re: DIY PMW-3360 Gaming mouse
Post by: hanya on Wed, 13 September 2017, 08:12:37
I'm working on my own mouse with the PMW3360. It works fine at low speeds (1CM/s), but at higher speeds it the motion sensing interrupt only fires about 5 times a second, which is a bit odd. Does anyone know where the datasheet for the communication protocol is? I found the standard datasheet for the hardware and stuff, but its only like 10 pages long, and the only software stuff it has is a register table.
You can have the full datasheet from the page, see Datasheet link: https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/
Title: Re: DIY PMW-3360 Gaming mouse
Post by: zyzyx on Thu, 26 October 2017, 04:28:31
For those of us looking for a PMW3360 Motion Sensor I found a Tindie dealer that has them.

https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/

The seller also has some really small USB buses if you want to add an extra USB port to your mice/keyboards.
Title: Re: DIY PMW-3360 Gaming mouse
Post by: JohanAR on Fri, 27 October 2017, 04:19:00
I bought some laser mouse sensors in Akihabara that I never used for anything. Could check if I still have them if anyone's interested
Title: Re: DIY PMW-3360 Gaming mouse
Post by: theKM on Mon, 19 February 2018, 11:59:57
Such a nice thread that it caused me to register... that out of the way, in the process of building trackball from mouse bits, but had an idea that would be nice but requires firmware. For the scroll function, mice should have a modifier button that when pressed switches from outputting mouse movement to outputting scroll info.

I'm making a keyboard with integrated trackball, but need the mouse and scroll to properly penetrate into linux VM's. Most trackball scrolling is driver specific, whereas with this mouse modifier idea, awesome scrolling without any driver shenanigans at all.

...so I guess I'm going to build one of these mice and try and hack the firmware, though wouldn't mind if someone got to it ahead of me :)
Title: Re: DIY PMW-3360 Gaming mouse
Post by: TheAlchemist-404 on Wed, 11 September 2019, 20:29:06
so allow me to do some necromancy on this thread, im looking to make my own mouse but im planning on using an esp 32 (mainly i got spoiled on exesive amounts of memory), and make sort of a naga trinity/roccat nyth with two key differencies, first: both sides can be used with the button modules (it will have an ambidiestrous design), and second: it will be wireless, now nice to implement are an additional side grip with a thubstick for navigation on cad, and if its possible make it under 80 grams with blank sides,
on the topic of additional side modules they will be at best five: one blank, one with two side buttons, one with 12 buttons (replaceable keycaps), one with a psp joystick, one with hex layout