-
oops
02/22/2017 at 05:05 • 0 commentsI had mis-typed the project title: I forgot the trailing "i". I hope it doesn't cause anyone problems.
-
will it blend
02/21/2017 at 17:20 • 0 commentssoldered a wire to the resistor connected to the CS pin (boy, that resistor is tiny) and tested things out on a breadboard. It works!
Next I needed to figure out how to allow the Pi to shut itself off. I came up with this circuit:
The Pi turns itself off by setting GPIO4 to pull-down (it's normally pull-up). There is a major problem with this circuit: when the Pi power voltage drops below 3.3 volts it will reset the Pi but GPIO4 will not change to pull-down, so the Pi will not power off. It WILL eventually turn off when the battery drops below it's low voltage protect voltage, but that's too late: permanent battery damage may occur. Those Lithium batteries are pretty sensitive!
To fix this I came up with this circuit. It requires removing the 1K resistor from the protection module, but in return it doesn't require a transistor:
This circuit has a small problem: the on switch has to be held down until the Pi can set GPIO4 to a low output. The quickest this can be done is in about 4 seconds, using a device tree overlay, so you have to hold the on button down for 4 seconds. I think I can live with this.
By the way, did you know that if you set a GPIO's pull state, it will survive a reboot? It only gets set back to the default state when the power is cycled. The GPIO's input/output state doesn't survive a shutdown or reset though: they all get set to inputs. So you have to use the input/output state change to power off the Pi if you want it to power off on a low-voltage reset or shutdown.
I tested the final circuit, and it works great! I issue a shutdown command, and after the PI halts, the power turns off automatically. Just like a real computer. It's kind of cool after years of powering off Pis manually! Current draw when off is 55 microamps. This seemed like a lot until I calculated that an 18650 cell could provide this current for 4 years!
-
we don't need no power switch
02/21/2017 at 17:15 • 0 commentsYo know what the problem is with power switches? They're bulky, especially thickness-wise. And all of the ones I have in my junk box are way too large. The best solution to this problem is an electronic power switch like this one. And you get the added capability of having the Pi shut it's own power off.
While pondering this problem, I realised that the electronic switch is just a pass MOSFET, some electronics, and push-button switches. And the battery protection module is a pass MOSFET (actually back-to-back MOSFETs) and some electronics. Maybe I could add push-button switches and get the same functionality?
I searched for images of battery protection modules on the Internet. It seems the DW01 chip is pretty common. So I took a look at it's data sheet: it disconnects the load if it's CS pin rises more than 150mV above ground and reconnects it if it's lower than 150mV. So, connecting CS and V+ with a switch will disconnect the load, and CS will stay at V+ once the switch is released. To connect the load, momentarily apply power to the load with a switch: this will lower the CS pin to ground potential and turn on the MOSFETs, and they will stay on once the switch is released. There, I just made an electronic power switch by adding two push-buttons to the battery protection module!
Here is the unmodified protection module:
Here is the protection module with added switches:
-
we don't need no boost converter
02/21/2017 at 16:13 • 0 commentsAs I've detailed here, some models of Pi can be operated from a power supply as low as 3.3 volts. So, I've decided to build a minimum-cost battery operated Pi Zero.
I'll need the battery of course, and it should have a protection module: I don't want any fires. And a power switch of some kind. I'll also need some way to charge the battery. And before you say anything, an all-in-one charging-protection-boost module is cheating!
The downside of this setup (there's always one, isn't there) is that some USB devices won't work at 3.3 volts. But my WiFi adapter certainly will, so I plan to make a battery operated access point as a test case.
Let the hack begin!