Making Your Wireless Keyboard Truly Low-Power

Screenshot of the blog post, showing how you can optimize your battery level measurement resistor dividers, among many other things

The basics of keyboard design are tried and true at this point, but there are still a few aspects yet unconquered. One of them is making your keyboards wireless. You might think it’s easy, but if you just slap a wireless-enabled microcontroller onto your board, you’ll soon be left with a dead battery. Rejoice – [Pete Johanson], creator of ZMK, tells all that you want to know about making your keyboard low-power.

In a lengthy blog post, he goes through everything that a typical keyboard consists of, and points out factor after factor that you never knew could cause a spike in power consumption. Are you using muxes or config options that will force your MCU to always stay alert? Is your voltage regulator’s quiescent current low enough, and can the same be said about other parts you’re using? Does your MCU have to work extra hard transmitting bytes because you’ve put a copper fill under its antenna? Most importantly, is the firmware you’re using designed to optimize power consumption at its core?

If you’ve ever thought about designing low-power keyboards, hell, any low-power device, you seriously should read this post – it will set you at ease by giving you a checklist of things to do, and it also links to quite a few other useful resources, like the ZMK power profiler. Perhaps, if you’re building a wireless keyboard or just creating battery-powered device, you should consider ZMK, as it sure seems to be written with energy efficiency in mind.

Want to learn more about what it takes to build a low-power device? Our 2023 Low-Power Contest attracted a wide range of entrants, and they’ve shared a flurry of methods and tricks you can use to build any sort of battery-juice-sipping gadget.

45 thoughts on “Making Your Wireless Keyboard Truly Low-Power

    1. Exactly. And why make your typing even more sniffable? Even if you use encryption, what information is given away by the time between keypresses?

      The keyswitch EMI is bad enough.

      1. If it’s a one-off personal project without the protocol posted online, and you’re not a celebrity, the chance that someone (say, a neighbor) will figure out what you’re doing and how you’re doing it is pretty low. And if the only secret information you type in is a password to a device that is not accessible from outside your WLAN, and you don’t use the password for anything where security matters, then it’s not a big deal if you’re sniffed.

      1. I want a split kb without a wire running between the halves across my desk

        I want a split kb I can mount to the ends of my computer chair armrests

        I want a portable/luggable kb that doesn’t involve a mess of wires.

        Lots of reasons

    2. Because it’s neater to have no wires, you can place your computer freely on or around the desk without worrying about where you’ll route the wires, and you can lift the keyboard away for cleaning or stash it in a drawer when you’re not using it.

      You could say “Oh, what’s one wire gonna cost you?”, but you have to look at your desktop as a system: wireless everything – mouse, keyboard, maybe even the speakers – and it the whole organization becomes so much nicer when you don’t have these annoying cables laying about.

      1. Also, when you have the wire going from your keyboard towards the back of the desk, it occupies table surface where you then can’t put other stuff because it’ll get knocked over when you shift the keyboard around to shake the cookie crumbs off of it.

          1. I use one at home since I’ve got it and am used to it, but you do need to route things so that there is plenty of slack in the cables so that the mouse doesn’t drag and you can pull the computer out to dust or work on it without yanking the cables out or yanking the keyboard off the tray, yet that slack needs to be prevented from getting caught on anything including your legs/feet/other cables/etc. I use wires because they’re cost effective, but I can still see that it isn’t as plug-and-go.

          2. I was a proponent of wired mice for a long time because I believed that the lower latency was better than the annoyance of pulling the wire around, but then I got a wireless one with the keyboard set I bought, and realized it was indistinguishable.

          3. >plenty of slack in the cables

            There’s never enough cable to reach every spot on your desk unless you put your PC in the middle, so some devices end up with cables precariously strung up in the air while others have too much slack and you have to tie it into a loop and hang it somewhere hidden. That spot becomes a rat’s nest that ends up in a knot that you can’t unravel without unplugging everything and unwinding every loop – which you hopefully didn’t tie up with tape that gets gummy over time. Masking tape gunk, Mmm-mm.

            At least every device doesn’t need its own power brick anymore.

      2. Then it’s a choice between:
        • A purpose-defeating dedicated charging wire
        • A charging wire shared with other devices that is always somewhere else where you last used it and not where you need it now.
        • Disposable, pollution filled batteries you will dump in a landfill for your grandchildren to one day drink in their water.

        There are certainly situations where wireless is good. (thinking living room media pc for example) but only in such special applications.

        Sorry, I very much think the kids’ hatred of wires is more the result of marketing people successfully brainwashing the population vs any sort of practical tech.

        1. >pollution filled batteries

          Common alkaline batteries are really harmless.

          The worst bit is Potassium hydroxide or potash lye, which will react with air and rain water to make Potassium bicarbonate, which is a food additive used for making club soda and baking biscuits.

          1. Though recycling your disposable batteries is a better option from a resource point of view, since they contain valuable iron and zinc. Luckily, there’s a drop-off point in most supermarkets I’ve seen, next to the bottle return machine.

        2. It’d almost certainly be a usb cable even if you did recharge in-device, but as long as they last months to years per charge I’d just use nimh, and probably one battery could continue being recharged even after multiple wireless mice died, so it really isn’t a big source of waste. Even alkaleaks wouldn’t be the end of the world, although I would rather avoid them.

        3. Some of us like wireless keyboards because we like organized desks. Which is why I have a box in the corner with … my charging cable in it . I don’t actually move (or unplug) it

    3. I have a Raspberry PI plugged into my TV for retro gaming. A wireless keyboard with very long battery life would be nice for use from the sofa. (I have a wireless keyboard, but it’s usually out of charge.)

  1. Is there a practical way of making a wireless keyboard that uses zero power when keys aren’t pressed? Here’s an impractical but conceptually simple approach: each key has a little AM transmitter that transmits a sinewave of a different frequency, with the key functioning as a momentary power switch. No MCU on keyboard end. SDR then decodes this. FFT gives you NKRO. Another probably impractical approach: keyboard switches are DPST (can one get those?), with one pole wired in series for power, and an MCU with a fast startup time runs a scan whenever it’s powered up.

  2. Just make sure you document this kind of thing. I spent a couple of evenings recently trying to get an I2C sensor working on a dev board, only to discover that A) the on-board sensor is connected to a separate I2C bus than the header pins for I2C, and B) that the pull-ups need driven by a GPIO pin. None of this was documented clearly, and the manufacturer’s own generic sensor library apparently didn’t know it either.

  3. Sounds like a fun learning project. But I suspect the devil is in the details. I don’t know much about SDRs, but my impression is that while they support many frequencies, they are generally just listening to ~one frequency at a time. So then you need many receivers to listen to 100 keys. Not to mention how much spectrum you’d need for 100 frequencies without overlap.

    Maybe it becomes more practical if you limit yourself to a ‘chorded’ keyboard, which maps all 26 letters to just 5 keys?

    1. SDRs receiver typically listen to a wide bandwidth simultaneously. Think everything displayed on a spectrum analyzer. Then it gets to pick what frequencies it cares about, and do whatever it wants with the phases and amplitudes for those frequencies.

    2. If the frequencies are near enough, you can just listen to the lower one and consider the others like a modulated version of the first one. Anyway, that would be very sensitive to noise and eavesdropping, so it’s not very practical.

  4. Maybe I missed something but I didn’t see any mention of the why. Making it low power to decrease radiation and make it more secure or low power to extend battery life ? On the battery life side, my Logitech wireless keyboard/mouse goes into a sleep or low power mode when not used and I get up to a year on batteries or a bit more. On the secure side, then in a crowded office low power would increase security maybe but I have not heard of security problems but there are ways around this too.

    1. Yeah, but how do you think those “low power modes” work?

      It’s not a magic setting that hardware gives you that you just need to turn on, the hardware has to be explicitly designed at all levels to eliminate unnecessary power wastage – having your microcontroller go into a sleep state is pointless if there’s a separate resistor always burning off 100mA.

      1. So the gist of the article was to squeeze more power savings out of a low power device….right ? Hopefully this hack will make a keyboard that runs up to a year on batteries, run for 3 years. I think a better idea would be in putting a piezoelectric generator under each key of an IBM Model M clacky keyboard that would charge a supercap. The amount of force needed to press those keys would generate enough power to run the keyboard forever..😁

        1. It’s about how to make your own low power keyboard that runs for a year on battery, which is something the commercially available wireless ones have already figured out and implemented, but is not as easy as just using an efficient MC.

  5. The advice for the battery monitor is bad. The voltage divider should use lower value resistors to place a known load on the battery, which should be some multiple of what the MCU consumes while taking the measurement. Otherwise you are measuring the open circuit voltage of the battery effectively, or some random amount based on what the MCU consumes during the measurement.

    Because the measurement is so fast it’s no a problem to place that much load on the battery very briefly. Just be aware of the influence of capacitors when making the measurement.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.