Author Topic: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power  (Read 1935 times)

johnshearing

  • Newbie
  • *
  • Posts: 8
AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« on: December 31, 2017, 09:12:13 PM »
Hi All,
I am looking for a complete battery power management solution for my raspberry pi.

My goals are as follows:
1. Gracefully shut down my pi when the battery is critically low.
2. Capability to gracefully shut down or reboot with a button.
3. Provide a human readable battery monitor.
4. Charge the battery when power is available.
5. Run the pi on AC when AC power is available.
6. Gracefully switch to battery when AC power is removed.

I imagine that PowerShield and ATXRaspi are two of the pieces which can be used to accomplish this.
I don't know what to use for a human readable battery indicator.
And I don't know how to put it all together.

Surely I am not the first person to have these requirements.
Someone must have accomplished all this and documented the build.

Could anyone please lead me to this documentation?
Thanks for your help,
John

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #1 on: January 01, 2018, 12:33:56 PM »
Hi John, the PowerShield can only do up to 400mA peak, and I would not load it near to that figure, it's meant for low power projects. It would not work to power a Pi.
Instead there is the MightyBoost board which was designed for this purpose, it is powered from USB, has battery backup (boosted to 5V when USB power is missing), it can be paired with a bare Moteino for complete control over the power of the target (Pi or something else), see the guide page for details.
The MightyHat also is a more integrated solution which can do the same as MightyBoost and more, and would be the recommended way to go, it is a Pi "hat" and can also accept an LCD and radio. Right now it's out of stock, it may be reworked as a new revision.

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #2 on: January 02, 2018, 12:17:09 AM »
Hi Felix, Thanks for responding.

I have made a battery operated airgapped pi for safely moving cryptcurrency (Ether) without exposing private keys to any other device.
It is airgapped so there can not be any radios of any type onboard.

It's open source.
https://github.com/johnshearing/MyEtherWalletOffline/blob/master/Air-Gap_Setup.md

Please see the following video to see how it works.
https://www.youtube.com/channel/UCQlQRc9muSqPZIXSfugN43A/featured

I used the adafruit PowerBoost 1000C to run the pi and charge the Lipo.
A PowerBoost 1000 non charger version runs the 7 inch touch screen.
One PowerBoost is not enough to run both.
The on-board printer only receives power when the device is plugged in so there is no need to worry about powering that.

The problem is that the Adafruit devices are not smart.
I am not too smart either but I work hard and I am not afraid to ask for help when I need it.
Please, I need help.

As mentioned, I need to do the following:
1. Gracefully shut down my pi when the battery is critically low.
2. Capability to gracefully shut down or reboot with a button.
3. Provide a human readable battery monitor.
4. Charge the battery when power is available.
5. Run the pi on AC when AC power is available.
6. Gracefully switch to battery when AC power is removed.

The project is important because cryptocurrency decentralizes (democratizes) money.
It takes money away from investment banks, big corporations and dictators, and returns control of it to individuals.
If people can take their money and go when things get crappy then we will no longer have a refugee problem.
The problem now is that when refugees leave, the money stays. So making refugees is profitable.
Imagine if refugees could take their money with them.
The loss of funds created by people leaving would cause governments to serve people better.
Market forces would cause things to get better even before they get very bad.
When everyone is using cryptocurrency governments will have to compete for citizens in order to get money.
At that point, the needs of citizens will be considered at the bargaining table along with big banks, big corporations and dictators when deciding government policy.

The biggest problem with cryptocurrency is hacking. Until people have a safe way to keep and use their private keys cryptocurrency will not become the dominant form of money and nothing will get better. That's why I am working on this project.

I am using a pi 2 (no radio) with the official 7 inch touch screen and a the official pi camera. 

Seems like MightyHat (without a radio) could be the way to go because you could use the LCD as a battery meter unless you have another idea. The cheaper we can make the device, the more people can purchase one or make one for themselves. So maybe MightyBoost is better. But then what do we do for a battery meter? Perhaps a voltage divider and some LEDs? How is this accomplished? This thing has to be inexpensive if we are to get it into the hands of a lot of people.

When I saw your link on the MightyBoost page for a sample sketch I was expecting to see a drawing of some kind. Instead I found some kind of program on github.

Please, I am begging you - can you dumb this down for me.
What components should I use?
Where do I put the wires?
How do I install the special software (the sketch)?

If you can show me how to accomplish this, I will make the information available to anyone who wants to build their own device and I will manufacture the devices as inexpensively as possible so that the maximum amount of people can afford to own one.

Thanks for considering my request,
John









Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #3 on: January 16, 2018, 02:44:58 PM »
Sorry I respond so late.

I think your shortest path to your requirements is a MightyHat which provides the 5V boost from backup LiPo, and power control. It can be paired with a LCD or you can probably add a LED segment indicating the power level. Or maybe if you have the Pi LCD already, you can have some script read it from the MightyHat via serial.

For now that product is out of stock, I am working on some changes before the next revision will come out. I have some older ones in my lab if that's of interest.

NorPad

  • Newbie
  • *
  • Posts: 2
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #4 on: January 17, 2018, 02:48:16 PM »
Hello @Felix;
Do you have a rough estimation for the next MightyHat revision and when they will be in stock?

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #5 on: January 18, 2018, 12:16:56 AM »
Hi @Felix,
Thanks for your kind response.
I would prefer to wait for your latest MightyHat.
How long do you think that will be?

Can you sell me a complete solution that meets all the requirements of this device with instructions wire it up and install the required software?

A MightyHat (for security - no radio)
A human readable battery monitor on the MightyHat.
Gracefully shut down the pi when the battery is critically low.
Capability to gracefully shut down or reboot with a button.
Charge the battery when power is available.
Run the pi on AC when AC power is available.
Gracefully switch to battery when AC power is removed.

Also I expect to produce a lot of these devices once we know everything is working as needed.
Do you think you will be able to supply the required parts as production grows?
If not would you consider licensing your product to me and teaching me how to reproduce them.
While I am no engineer, I have done much electronic assembly, and I service robots for a living so I should be able to learn fairly quickly what needs to be done.

Thank you for considering all of this
John




Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #6 on: January 18, 2018, 09:54:50 AM »
How long do you think that will be?
Could be several weeks, I am not sure at this point though, there's lots of work and variables involved with a new revision. Sorry I don't have a better answer.

A human readable battery monitor on the MightyHat.
Gracefully shut down the pi when the battery is critically low.
You might need to tweak some programming to get the results you want (at what battery voltage to shut down etc). There is some example code to achieve this. The reboot/shutdown code is also provided. The sample sketch for the current/last revision is here.
For the battery indicator you will need an LCD (available as optional with the MHat).

Also I expect to produce a lot of these devices once we know everything is working as needed.
Do you think you will be able to supply the required parts as production grows?
We can talk more about this when you are confident you have what you need but in general yes, I can supply you with boards.

Have you measured your total average current required to drive your unit?

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #7 on: January 19, 2018, 01:19:34 PM »
Hi Felix,

With just the pi and the touch screen in the circuit my meter says the devices draw 1 amp at rest from the power supply.

But they are not very happy with the typical 2.5 amp USB power supplies that you can buy with the pi.

For instance, just having the amp meter in series between the power supply and the pi with the touch screen, which are in parallel after the meter of course, gives me the lightening bolt in the upper right hand corner of the touch screen which I think means there is not enough voltage. Probably the long leads of my meter are causing the voltage drop. Sometimes the pi will shut down when the lightening bolt appears. Using a 4 amp power supply instead of the 2.5 amp supply makes the lightening bolt go away. So if you just looked at the 1 amp draw of the pi and the touchscreen together you wouldn't anticipate the voltage problem. It seems we need extra capacity from the power supply.

This same problem appears in my actual device with the battery, boost, and charger in the circuit when using the typical 2.5 amp USB power supply and goes away with a 4 amp supply.

I know that I can use heavier gage wire and make the leads as shorter to help with the problem. I will do that on the next one. In the meantime I purchased a 4 amp power supply which keeps the pi, the touch screen, the charging circuit, and the boost circuits happy and still has enough power left to run the little thermal printer which is wired such that it only receives power when AC is available. Having said that, the printer seems to run more reliably when the batteries are near fully charged. The 3.7 v 6600mAh LiPo battery with the boost converter that I am now using provides only enough power to run the pi and the touch screen. That is why I don't run the printer on battery power.

So I would imagine 6 amps with perhaps a little extra voltage (maybe 5.5 volts if that is not dangerous to the pi) from the MightHat when on AC or Battery would be would be enough to run the touch screen, the pi, and the printer. If that is not possible then I don't mind running the printer directly from the power supply assuming we stick with a 5 volt supply.

Perhaps I will need to purchase a 10 amp, 5 volt power supply to provide enough power for the MightyHat and the printer.

Sorry I can not be more precise. I hope at least I have given you a sense of the problem and demonstrated some need for extra capacity above what one might expect.

I am not the only one with this problem. In various forums where people are trying to supply battery power to a pi I see these complaints.
 


On availability: Several weeks lead time is fine.
The devices work well enough for now for testing other and there are other aspects of the device that I can work on in the meantime.

In fact I am shopping for a laser.
Your blog was very helpful with that. Thank you.
I am leaning toward the Chinese MFG ThunderLaser.
The reason is that they have a way of making 90 bends in the material which will make the enclosure I have in mind (a clam shell design) very fast and inexpensive to make.

Thank you for all of your help,
John

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #8 on: January 19, 2018, 02:20:45 PM »
The voltage drop is from:

- your meter's burden votage drop
- resistance of leads
- resistance introduced with every new connection/joint

This will happen no matter how much amperage your supply has.
You only need a supply that is at least a few hundred mA more (and stable) than your actual need (if you need 1A or 5V, 2A supply is plenty). The problem with a lot of 5V cheap chinese supplies (even if they are 5A or 10A) is they are not clean but have tons of harmonics (noise) or start dropping voltage when any load is attached. The Pi shows the thunderbolt when the supply is 4.65V (I think this happens even if it's just noise superimposed on the actual main voltage).

The backup battery can be any size, a good start is around 2000mAh, which can carry the Pi for up to 1-3 hours depending on load.
The MightyHat booster can easily handle the Pi by itself. I am not sure about adding the LCD though, which can easily reach 500mA or more.
But I would say the booster can do up to 1.5 boosted amps (5V) from a charged battery. As battery depletes and voltage drops, the booster might have a harder time keeping up with such a load.
You might have to just handle shutdown at a certain point, and/or turn off the LCD and printer if power goes out, to avoid stressing the boost/backup function.

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #9 on: January 20, 2018, 04:38:54 AM »
Hi Felix,
Thanks for explaining why the voltage drop.

>cheap Chinese supplies ... are not clean but have tons of harmonics<
Yes this makes sense.
I have noticed that the pi only works on AC if no other power supplies are plugged in on the same 120 volt circuit.
Can you suggest a power supply?
I didn't see any power supplies for sale on your site

>I am not sure about adding the LCD though, which can easily reach 500mA or more.<
Sounds like you think the LCD is not the right fit for this project.
Is there an alternative?

>turn off the printer if power goes out, to avoid stressing the boost/backup function.<
OK, I will only run the printer when the device is plugged into the power supply.

I placed a preorder for 3 just to get started.
If all goes well, I expect to be ordering a lot of them.
Can't wait to get started.

Thanks for all your help, John

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #10 on: January 27, 2018, 08:28:33 PM »
Can you suggest a power supply?
I didn't see any power supplies for sale on your site
PSUs are bulky and heavy, to sell a $5 supply that takes another $10 extra shipping weight, makes no sense to me. Shipping rates are crazy these days.
Also they can be expensive if they are very good. Cheap PSUs can transfer noise from the AC line into your product.
So unfortunately I can't recommend a particular supply, however I would look into getting started with the known "good" ones. I like the CanaKit 2.5amp stock supply, it seems solid, find it on Amazon.

The Pi official LCD can spike up to 600-700mA, i've done my own tests.
If you need the LCD then you need it... just cut power to the peripherals that are not crucial once AC input goes out.

FWIW MightyHats may be ready later next week.

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #11 on: January 28, 2018, 09:51:57 AM »
Thanks Felix,

You have solved a gigantic problem.
A lot of people have been waiting for this.
I can't wait for the MightyHats to come out.

Quote
I like the CanaKit 2.5amp stock supply, it seems solid
Great, I have several of those already.

I also just purchased this one which seem to have been built just for this situation.
https://www.adafruit.com/product/1995

Ultimately this should lead to a wider adoption of cryptocurrency among the poor and middle class.
Thanks making this possible.




Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #12 on: January 31, 2018, 04:21:42 PM »
MightyHats back in stock  ;)

johnshearing

  • Newbie
  • *
  • Posts: 8
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #13 on: February 01, 2018, 01:15:39 PM »
Thanks so much Felix.
Just ordered 3.
Can't wait to get started.
If we can make this project work, it will help a lot of people.
Thanks again.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5994
  • Country: us
    • LowPowerLab
Re: AtxRaspi and PowerShield to Manage Raspberry Pi Battery Power
« Reply #14 on: February 01, 2018, 04:37:06 PM »
Thank you,
Once you get and assemble them, feel free to continue the conversation here with any questions and info you might want to share.