The three pillars of Zaunkoenig firmware
, by Patrick SchmalzriedThe firmware for our gaming mice firmly stands on three pillars: self-sufficiency, open source and ultra low latency. Read on to find out why we decided on these three pillars.
Self-sufficiency
The two most commonly used approaches for changing important mouse attributes like «counts per inch» (CPI), «angle snapping» and «lift off distance» (LOD): external software as well as dedicated buttons.
The one most hated by gamers is the dreaded external software. It is bad enough that you have to install something. But what is worse is that these software suites usually have a terrible user interface and are bloated with buggy non-features. External software is especially bad for pro-gamers, since installing software on a tournament PC is very restricted in order to limit the potential for cheats.
The second approach: having dedicated buttons that do nothing else but change CPI or polling rate, for example. This is much better than having to install painful software. It is especially suitable for tournaments. However, oftentimes these buttons are very limiting, especially when it comes to CPI. Modern gaming mouse sensors offer over a hundred different CPI values, and yet most CPI buttons only offer the option to choose between two or three of those.
Furthermore, these dedicated configuration buttons increase the weight of the gaming mouse. When your gaming mouse weighs 100 grams, it does not really matter that the CPI button increases the weight by half a gram. With a mouse as light as the M1K however (23 grams), even half a gram is a significant increase in overall weight.
For these reasons we decided early on, that we would never use external software or configuration buttons. Instead we decided to have the user interact directly with the firmware of our gaming mice. In addition we use the on-chip flash memory of the MCUs on our printed circuit boards (PCBs) to remember those interactions.
The following is how you can change CPI, angle snapping and LOD in the M1K by interacting with its firmware.
Changing CPI
The M1K uses a PixArt 3360 sensor. You can change the CPI in steps of 100. Minimum CPI is 100 and maximum CPI is 12,000. For CPI values of 100 up to 3,500 the 3360 has just 2 frames of smoothing. From 3,600 CPI up to 12,000 CPI however the smoothing jumps to 16 frames. We thus recommend not going above 3,500 CPI.
This is how you can change the CPI of your M1K:
- Plug the M1K into your PC.
- Lift the M1K a few centimeters off your mousepad so it stops tracking.
- Hold down both mouse buttons for five seconds.
- The M1K now enters the so-called «CPI programming mode». Upon entering the mouse cursor will move to show you at what CPI the M1K is currently at. The standard value of the M1K is 800 CPI. So when you enter the CPI programming mode with a brand new M1K the mouse cursor will go up and down exactly eight times. At 3,500 CPI the mouse cursor would move to the right and back three times (indicating 3,000 CPI), and then up and down five times (indicating 500 CPI).
- Now place the M1K back on your mousepad. You can now change the CPI by pressing either the left or right mouse button. Each time you now press your left mouse button, the CPI will be decreased by 100 until you reach the minimum CPI value of 100. Pressing right increases CPI by 100. While you are doing this you can move the M1K around to get a feeling for different CPI values.
- If you want to increase CPI by 1,000 you can use the following shortcut: hold down the left mouse button and press right. The mouse cursor makes a bigger jump to indicate an increase by 1,000 CPI instead of just 100 CPI. Switch buttons to do the same for decreasing CPI by 1,000.
- You exit the CPI mode the same way you entered it: Lift the M1K a few centimeters off your mousepad so it stops tracking and hold down both mouse buttons for five seconds.
- The M1K exits CPI programming mode and tells you again at what CPI it is running now.
Changing angle snapping and LOD
Per default angle snapping on the M1K is disabled, and the LOD is set to 2 millimeters. Should you want to change these values this is how you can do it:
- To activate angle snapping, press and hold the left button while plugging in the M1K. Cursor moves clockwise in a square to indicate the change.
- To set LOD to 3 millimeters, press the right button while plugging in the M1K. Cursor moves clockwise in a square to indicate change.
- To go back to default settings, press both buttons while plugging in the M1K: angle snapping now is disabled again and LOD is set to 2 millimeters. Cursor moves counter-clockwise in a square to indicate the change.
Open source
The firmware of the M1K is based on the firmware overclock.net user qsxcv developed upon reverse engineering the PixArt 3366 sensor. He later used this firmware to make a wireless mouse that had lower input lag than any wired mouse from Logitech. See his thread on overclock.net for more information on this: A wireless mouse faster than Logitech's wired ones? Oh yes!
As did qsxcv with his firmware, we made our firmware open source. See our GitHub repository.
Having a gaming mouse with an open source firmware has several advantages for you, the gamer.
The first being longevity: Imagine Germany, where Zaunkoenig headquarters is based, is hit by a big meteor. That would be the end of Zaunkoenig. However: since our firmware is open source it would not be the end of our firmware. Firmware for our gaming mouse could be developed further, since the source code for it will forever live on our public GitHub.
The second advantage is that since our firmware is open source, you can take it and adjust it any way you want. When you are done you can install your own firmware on the M1K with a program called DFU Programmer. See this guide for how to do that exactly.
Why does it make sense to write your own firmware? You can do small changes like setting your M1K to an interpolated CPI value like 850. Or you could switch your left and right mouse button (you can do that in Windows, but some games do not respect that setting and do not offer such a setting at the same time). You could do more advanced changes as well however. For example you could choose different CPI values for the x and y axis. Or maybe you are currently using software on your PC to implement a custom acceleration curve; with the M1K you could apply that custom acceleration curve on an MCU level. There are many possibilities.
The third advantage is that by open-sourcing our firmware we increase the chances that our firmware gets even better in the future. The latencies of our firmware are very low already (see next point) but maybe there is a trick that could save a few microseconds here and there; who knows. If you know C and love gaming mice: why not give the code for the M1K firmware on GitHub a look?
Linus Torvalds, the creator of Linux, put it this way:
«I often compare open source to science. Science took this whole notion of developing ideas in the open and improving on other peoples ideas. It made science what it is today and made the incredible advances that we have had possible.»
Ultra low latency
In our blog article «Optimal weight of a gaming mouse» we argued that the optimal weight of a gaming mouse is zero grams. Because only at zero grams you have zero inertia. And as it turns out, when moving a mouse, inertia is a big source of latency.
You could describe the inertia of your gaming mouse as real life latency.
Inertia is not the only kind of latency that stands between you and better aim, of course. The firmware of your gaming mouse can be a huge source of latency as well, depending on how poorly it is written.
Just as the optimal weight of your gaming mouse is zero grams, the optimal amount of latency introduced by the PCB and the firmware running on that PCB is zero as well.
Achieving an actual latency of zero is, sadly, impossible, but we have tried. The result: we have not just optimized our firmware down to the millisecond level, but to the microsecond level.
8,000 hertz
When you plug the M1K into your computer it will run with 1,000 hertz which results in your PC getting new mouse data every 1.0 milliseconds (1,000 microseconds). Internally however the MCU of the M1K fetches new data from the sensor every 125 microseconds. Put another way: internally the M1K runs at 8,000 hertz. Only when used in conjunction with an overclocked Windows driver though can you actually use the M1K at 8,000 hertz in Windows.
Using the M1K at 8,000 hertz as opposed to 1,000 hertz reduces input lag by 437.5 microseconds on average.
Compared to 500 hertz a mouse running with 8,000 hertz will be quicker by 937.5 microseconds on average.
Should you want to try overclocking your Windows driver to 8,000 hertz give this two minute long tutorial a try. For more information check out SweetLows overclock.net thread «USB mouse hard overclocking (2000 Hz+)». Be warned though: the 8,000 hertz overclock for the M1K is not easy to pull off.
By the way: we see no reason for using the M1K at 500 hertz. Modern gaming PCs have plenty of processing power for a 1,000 hertz gaming mouse. Hence, the M1K runs with 1,000 hertz per default and does not offer the option to be downgraded to 500 hertz. We think a 500 hertz gaming mouse is the equivalent to a 60 hertz monitor: outdated.
Zero lag switch debouncing
Many so-called gaming mice have problems with accidental double clicks. And in order to prevent accidental double clicks, many gaming mice use their MCU to artificially delay each click, or the release of a click, by up to 40 milliseconds.
Delaying clicks is especially bad in FPS games. Just imagine each of your shots having an extra delay of 40 milliseconds. Just to put this into perspective: In many cases these 40 milliseconds are higher than the lag of your internet connection.
The alternative to delaying the registering of a click is delaying the release of a click. In FPS games this way of preventing accidental double clicks would be better than delaying the registering of clicks, but it is still not optimal. And in RTS or MOBA games, where you have to do quick and precise selection boxes, delaying the release of a click is bad, period.
The M1K uses a debouncing technique called the set/release latch method with which we can prevent accidental double clicks without introducing any delay to clicks or releases.
Using the set/release latch method is not exactly rocket science and not exactly expensive. This begs the question: why has it not been used up to now? Daniel Sauvageau, the author of an in-depth article on debouncing mouse switches, offers this explanation:
«This is one more example of perfectly good theory not getting used in practice to save pennies per unit and also to perpetuate planned obsolescence. That is, sales would drop if you no longer needed a new mouse every two to four years as a result of glitchy buttons.»
Continuous button sampling
Thanks to zero lag debouncing in combination with internal 8,000 hertz the M1K already has insanely fast clicks. However qsxcv came up with a neat little trick to get even less input lag than you would have when polling the switches with 8,000 hertz. The state of each switch are sampled continuously so that there is no delay due to reading a switch while it is bouncing.
This saves a few microseconds per click. And at Zaunkoenig, every microsecond counts.