I’ve had my wireless keyboard for almost 10 years now.
One thing that has always annoyed me is that it uses double AA batteries.
I have switched over to rechargeable batteries, but I always forget to have a charged spare
set ready and the ones I have are now quite old and don't last very long.
I could upgrade to a new keyboard from Apple - but honestly, I don't want to spend £100
when I've got a perfectly good working keyboard.
I'm currently waiting on some components so that I can solder up the latest batch of
PCBs from PCBWay - this time I got PCBWay to send me a stencil along with the PCBs and
we're going to try and a bit of SMD reflow soldering with either a hot plate or hot air
gun.
All the bits should arrive in the next couple of weeks - so don't forget to subscribe!
In the meantime, I thought we'd do a bit of DIY on my old keyboard and bring it kicking
and screaming into the modern world.
I've seen a few hacks where people have stuffed things into the battery compartment - these
are definitely interesting and I could 3D print something to do the same job.
But if we look at the bottom of my keyboard there is a small plastic window that can be
popped off with a bit of brute force.
With this removed we can see the connections coming in from the battery.
I've got a couple of fairly flat batteries installed at the moment, so the voltage is
pretty low.
But if I had a couple of fresh batteries then we'd be measuring around 3 volts.
With my soldering iron cranked up to maximum blast, I was able to reflow a couple of wires
onto these terminals.
This gives us an easy way to inject power into the system.
I've also cut out a small bit of the plastic cover so we can route the wires to the outside
world.
I'm planning on powering the keyboard from a rechargeable lithium battery, I found these
nice USB charging modules on AliExpress.
The modules use a TP4056 chip and also include a DW01A battery protection IC along with a
dual MOSFET.
The schematic for both the charging and battery protection circuits is pretty much an exact
match for what we see on their respective datasheets.
On the charging side of things, we have the two LED indicators for charging and fully
charged and we have the resistor for programming the charging current.
My PCB has a 1.2K resistor which according to the datasheet will give us a charge current
of 1A.
The cells I'm currently using only have a capacity of 1000mAh so this charging current
is possibly slightly too high and we should be using around 500mA.
But I do have some much larger capacity cells on order which will be fine with this higher
charging current.
The battery protection circuit follows the datasheet exactly.
This battery protection is probably unnecessary as it's quite unusual to get cells that don't
have built-in protection - most cells that you buy will have a protection PCB built-in,
though you never know what you might end up with so I'm quite happy to have it.
When the battery is fully charged we get around 4.2 volts from it.
This is quite a bit higher than what we'd get from two AA batteries.
From reading around I suspect that the keyboard's circuitry could probably handle this voltage
without any problems, but I really don't want to risk it up so I'm going to reduce the voltage
a bit.
There are a few options for us here.
We could just put a couple of diodes in series with the battery supply.
This would drop the voltage by around 1.4 volts.
Alternatively, we could use a linear regulator and drop the voltage.
Both of these options would work, but they would also waste a bit of power.
Instead of these two options, I've decided to use a cheap DC to DC converter module.
This PCB is configured to output 3.3volts - it's a bit higher than the 3v from 2 AA
batteries, but I think it's low enough that the keyboard will survive.
The PCB is pretty interesting as it's actually a step up and step down DC converter, so it
will output 3.3 volts even if our battery is outputting a lower voltage.
It's using an SDB628 chip in a Single-ended primary-inductor converter configuration.
This is pretty interesting as the only configuration shown in the datasheet is a boost converter.
Here's the schematic for what's on the PCB.
The SBD628 tries to keep the feedback voltage at 0.6v and will adjust its duty cycle to
try and achieve this.
It's quite a nice little circuit on a very compact PCB - I've put a link to a video that
describes how a SEPIC converter works - it's pretty interesting.
Connecting things up is pretty simple.
We take the output from the charging PCB and connect this to the inputs of the DC converter
and then just solder the battery onto the charging PCB.
When we are charging we get 4.2 volts on the output from the charging PCB and we get a
nice sensible 3.3v from the DC converter.
If we disconnect the power supply then we still get 3.3v from our DC to DC converter.
I've connected this all up to the keyboard and it works nicely.
I'll be interested to see how long the battery actually lasts before it needs to be charged
again.
I've 3D printed a nice little compartment to hold the components and I've fixed the
charging PCB in place with some hot glue.
For now, I'm just temporarily taping the compartment in place.
When my new high capacity cell arrives I'll need to reprint this and do it again with
a more permanent solution.
It is quite nice, we can see the charging LED glowing through the 3D printed wall, and
when it's fully charged the colour changes.
There are a couple of things that I think could be improved.
I would quite like to make the output voltage exactly 3 volts - I'll probably desolder the
current resistor divider and replace it with some more suitable values.
The other issue is that I now have no way of knowing when the battery is going flat.
The boost converter will always output 3.3 volts so I'll always see the battery reported
as 100% by the mac.
The only indication I'll have that it's gone flat is that the keyboard won't power on anymore.
I'm quite tempted to build my own custom PCB with everything combined into one board along
with some battery monitoring so I can see when the battery needs to be recharged.
For now, I'm pretty happy.
I've saved myself a bit of money and I now have a nice rechargeable keyboard.