Page 1 of 1

Long term power supply programing

Posted: Sat Mar 16, 2013 12:57 pm
by Torna
Hi there,

I just started a projet for my new house. I'm going to build my new house in few weeks and I plan to timelapse the construction.
I set up a blog where I explain all I do : (sorry, I'm French ;)

To be quick I design a little system based on a Raspberry Pi and a USB webcam. The thing is, I need to run system on batteries during 10 days.
I have a Lithium-ion battery (5V - 9Ah), with whitch I can run my system about 7 hours.

I just need to power up the system 1 minute each 10 minutes from 8AM to 6PM. If I can program when the power is up and down, my 9Ah battery would be enough for at least 7 days.
I'm here to asking some help to find a solution on how to program the power up and down of the RPi.

Many thanks in advance for any help :)

Re: Long term power supply programing

Posted: Sat Mar 16, 2013 1:43 pm
by cstratton
This is actually not that trivial, as unless I'm mistaken the Raspberry Pi does not have software control of its own power, or that of USB peripherals. So it probably cannot switch itself between operation and a sufficiently low power mode to save your battery.

Most small Microcontrollers can do this however (even the broadcomm chip on the pi might be able to, if you could get a full data sheet and were designing your own board), so a direct solution would probably be an accessory microcontroller which would power the pi. Conceptually speaking:

1) Get a microcontroller, something such as the ATMEGA off an Arudino, and learn to program a timer for it to wake up from microampere sleep mode at some point in the future. Build a circuit free of current-wasting components such as pullup resistors working against the dominant state of signals.

2) Create a way for this micrcontroller to provide power to the raspberry pi, for example turning on a small relay, or enabling a (switching?) 5v regulator that has an enable input and a sufficiently low current when disabled.

3) Program the pi to automatically take a picture on startup, then cleanly shut down it's software, umounting all file systems and more or less halting itself as it usually does.

4) Create a way for the microcontroller to determine that the pi has finished shutting down before it removes the pi's power. You could do this with a simple timer, but it would be better to look for a final message on a serial console on the pi's uart, or something like that.

5) Test it. Program it for a shorter interval than you need and leave it running for a few days, and see if you can actually get that many cycles out of it without suffering sd card corruption. You might consider manually backing up the photos twice a day to a USB stick, and having a spare card all ready to go on hand which you can substitute in if it does start failing to boot. (Or just swap between two cards every day, taking the other one home to offload)

Alternatively, consider using something designed with power management more in mind - a smart phone running a timelapse app might do the job just fine if given that external battery, though if the charging circuit is wasteful you might need to only connect it periodically.

Re: Long term power supply programing

Posted: Mon Mar 25, 2013 5:32 pm
by Torna

Re: Long term power supply programing

Posted: Fri Mar 29, 2013 4:51 pm
by Torna
Lets do some Legos to start the week end :)

Re: Long term power supply programing

Posted: Sat Jun 15, 2013 10:57 am
by Torna

J'ai enfin pu avancer sur le projet, et j'ai mis l'intégralité du blog à jour :)

Le circuit de tempo pour la gestion de l'alimentation fonctionne à merveille : ... tation-22/

Voici un résumé du projet, qui est maintenant totalement fonctionnel : ... en-resume/

J'ai créé les rubriques de mes deux autres projets en cours, un jukebox pour voiture, et un dash screen pour salon :)

N'hésitez pas à partager vos idées, suggestions et recommendations :)