I'm brand-spanking-new to the Pi in general, so I am uncertain if this would be the question to ask, so I'll detail it a bit.

This Pi is located at a cabin and runs off batteries. Basically, I want it to, every day, upload a set amount of files to amazon AWS to report on the weather each day.

My predicament is that I cannot allow the internet to be enabled all the time, as the batteries would, of course, run out. So I connected the router to a GPIO network, following instructions from a more technologically-oriented friend, and I am wondering how I would be able to enable the internet, run the script, then disable said GPIO ports each day. I know a relatively basic amount of python, but I'm flexible.

If this is not the correct approach to this, I would like to apologize then subsequently request for a better approach to be voiced.

  • They better be big batteries. It is extremely unlikely you can leave a pi this way for weeks at a time; if it is feasible though you might look into a cheap solar panel to recharge. The issue with that is I believe most battery packs will not charge themselves and something else simultaneously, so you would need to find some solution to that problem, optimally a system using two batteries (alternating from one on charge to one on supply) but even then I suspect there may be a time issue (charge vs. discharge time) depending on the battery and panel capacity. – goldilocks Jun 19 '16 at 10:12
  • We have a large solar panel operating at around 60% efficiency. It will not allow the batteries to hold an indefinite amount of charge, but it'll last for months at a time, at least, at it's current operating level. I'm looking into more efficient panels, however. – Charlie Lamb Jun 19 '16 at 19:29
  • It's not very clear from this question what is going on and what it is you want to turn off. E.g., "I connected the router to a GPIO network" -> What is a "GPIO network"? Do you mean the pi is connected to the router via the GPIO's? I doubt it, but that is how it reads to me. I presume what you mean is, you have an array of sensors on the GPIOs, and you have some kind of (undescribed), normative connection via a router to the internet, and you want to minimize power by turning off the internet connection. And the sensors? – goldilocks Jun 19 '16 at 20:59
  • 1
    ...Or you want the sensors left on to continue collecting data, then just connect briefly to the internet (via wifi? ethernet?) once a day and upload? If you have not heard of XY problems before, you may want to give that some thought, and this -- although I have no intention of closing the question... – goldilocks Jun 19 '16 at 20:59
  • ...I think there is a reason you aren't getting any advice beyond "the pi is not appropriate" (which is reasonable enough, considering you said nothing about the power supply beyond "batteries" and did not even mention the solar panel). It's up to you...at this point it's already been almost an entire day, and the longer you wait to fix this the less chance anyone will bother with it. – goldilocks Jun 19 '16 at 20:59

A Raspberry Pi is probably the wrong tool for this job.

Even when powered down the Raspberry Pi will be drawing roughly 100 mA from the 5V supply. Your batteries won't last long.

So your first problem would be disconnecting the power from the Pi and starting it up at scheduled intervals. This may be tricky to do while at the same time ensuring the SD card does not corrupt.

It may be simpler to find an Arduino based solution.

| improve this answer | |
  • 1
    I might be more inclined towards an ESP8266. About 10 micro amps in sleep mode, plus built in Wi-Fi, and can handle most arduino code. – goobering Jun 19 '16 at 10:56
  • @goobering That sounds good, I know very little about the low power alternatives to the Raspberry Pi. – joan Jun 19 '16 at 11:22
  • You can pick them up for a little over £1 each, and have options on pretty much anything arduino or JavaScript for code. Fun toys! – goobering Jun 19 '16 at 11:24

Here's a good resource to help you get started with GPIO pins in Python. As far as turning things on and off on a schedule as well as running scripts on a schedule, look into cron. It is a time-based task scheduler and you can have it run tasks at specific times or at specific intervals.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.