PiSupply / PiJuice

Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere
https://uk.pi-supply.com/collections/pijuice/products/pijuice-portable-power-raspberry-pi
GNU General Public License v3.0
435 stars 103 forks source link

Stacking pHats on PiJuice Zero / suitable case for batteries + one pHat #1006

Closed r-colvin closed 1 year ago

r-colvin commented 1 year ago

Hi!

I am building a project and I need the ability to schedule power on / off … say 10 minutes on starting 5 minutes before the hour and ending 5 minutes past the hour. The point being to run a PiZero for as long as possible in a location (my shed!) where I don’t have mains power. I can probably attach a USB Power Bank to extend the time – but still having the schedule ability will be required to get weeks of constant run time minimum.

For a battery, I am considering if a flat LiPo is the better option or an 18650 in a holder which I can then easily swap in and out if need be.

However, I want to have the PiZero, the Pi Juice (with a battery) and then add a pHat – specifically this one: https://thepihut.com/products/nb-iot-emtc-edge-gprs-gnss-hat-for-raspberry-pi?variant=39808804815043 – but I can’t work out if there will be a pin conflict; I plan on using the HAT to provide a ppp connection to the Pi for internet access (my wifi doesn’t stretch to the shed either)

If I can stack, then I am trying to work out the best way to package everything; using a flat lipo, the PiJuice Zero case looks good – but I don’t think it will hold the third pHat! So this one caught my eye : https://thepihut.com/products/flanged-weatherproof-enclosure-with-pg-7-cable-glands?variant=18634584817726 : though might not be tall enough? Also I am worried about how to add a battery safely to avoid header pins and solder joints …. So any recommendations would be welcome!

r-colvin commented 1 year ago

Sorry - have just found the Pinout here: https://github.com/PiSupply/PiJuice/tree/master/Hardware

looking at that, only SDA / SCL are taken and ID_SD/ID_SC are reusable - if that's the case then I should be able to stack that HAT quite nicely image image image (source: https://www.waveshare.com/w/upload/7/76/SIM7000E-NB-IoT-HAT-Manual-EN.pdf)

from the above, I only need 5V / GND / RXD / TXD. By default P4 is not connected to the module - if i want that I need to change the solder bridge on the back - but im ok without having GPIO control for now (but its no conflict anyway) - thus I am good to use the two together

but just to clarify - this statement: Note: Turning on the Raspberry Pi via the onboard intelligent switch only works when the power is provided to the micro USB on the PiJuice.

as using the intelligent switch is critical for my use case, I need to have power supplied to the PiJuice micro-usb; as I don't have power available where i plan to deploy, would a 2500mAh power bank work? The unit I am looking at is capable of outputting 5v @ 1A. the issue here is that i guess when the system is powered up, the USB power bank will be used to top up the LiPo? is there a way around this? as i say, my primary use case is not as a UPS, but as an off-grid scheduled power up/down controller

tvoverbeek commented 1 year ago

Regarding the statement "Turning on the Raspberry Pi via the onboard intelligent switch only works when the power is provided to the micro USB on the PiJuice.", What you want is a scheduled wakeup at 5 minutes before the hour using the PiJuice RTC. If the battery has sufficient charge you do not need to provide external power to the PiJuice. You will also need to get the GSM antenna cable out of the case. I cannot tell if your case (the PiHut) one is high enough for Pi Zero + GSM modem + PiJuice. If you use shutdown with 5V off (to save battery charge) then the GSM modem has to log in every time the Pi goes on. GSM modems can be quite power hungry. Anyway your PiHut case is also available on Adafruit: https://www.adafruit.com/product/3931 with even more background info. Hope this helps (a littel bit).

r-colvin commented 1 year ago

hey @tvoverbeek thanks for the update - appreciate it :)

reading your answer it seems that I can use the PiJuice Zero to power my Pi Zero from battery directly through the GPIO header and create a script that will automatically power on and off the Pi on a schedule - this is perfect!

however... reading https://github.com/PiSupply/PiJuice I am still confused

... oh, I think I see my confusion (and this would relate also to "Turning on the Raspberry Pi via the onboard intelligent switch only works when the power is provided to the micro USB on the PiJuice." - the PiJuice has a micro USB port for power-in, as does the Pi Zero - and you can use either... (I am used to devices where you power via a Hat/pHat, that you shouldn't use both) - I had interpreted these statements as saying you needed to run a micro USB between the PiJuice and the Pi Zero!

Right - so, in my case, I will have the Pi Zero stacked on the PiJuice Zero - and I will have a LiPo attached by JST (the biggest I can find); I may, use a PowerBank as a supplementary power source; is there a difference in behaviour if I plug the PowerBank into the Pi Zero or PiJuice? Is there a preference for my use case? Essentially I want to keep the PiJuice battery high enough to keep the RTC running to bring the Pi Zero up and down. Makes sense...

Looking at the docs for the case, I am hopeful everything will fit, and if not... the case is not so expensive. I have a SMA cable coming to run the antenna from - and that will run through the cable duct, so no issue there.

Regarding the modem, I am speccing an LTEm modem for this exact reason where I can use PSM and eDRX to reduce the power consumption when re-connecting (which is what these functions were designed for)

looks like I might have a plan.. thanks again

tvoverbeek commented 1 year ago

Good luck with your project. Closing this issue. Feel free to open a new one (or a discussion) if you have more questions.