Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #25787

Battery Powered Project

From nospam.Vincent.Coen@f1.n250.z2.binkp.net (Vincent Coen)
Newsgroups comp.sys.raspberry-pi
Subject Battery Powered Project
Date 2021-01-12 14:35 +1300
Organization Agency BBS, Dunedin - New Zealand | bbs.nz
Message-ID <1610462814@f1.n250.z2.binkp.net> (permalink)
References <rtk3qv$1112$1@gioia.aioe.org>

Show all headers | View raw


Hello Simple!

Tuesday January 12 2021 12:14, you wrote to All:

 > I am working on a battery powered car and want the Pi to shut down
 > automatically if the battery starts to go flat to try to prevent SD
 > card corruption. I am a beginner to bash scripts! I will run this via
 > crontab...

 > #!/bin/bash
 > powerstatus=$(vcgencmd get_throttled)
 > if [ $powerstatus="throttled=0x1" ]
 > then
 > echo Under Voltage Detected - Shutting Down
 > sudo halt
 > else
 > echo Voltage Normal
 > fi

 > Obviously it is not working!! Could someone correct and explain for me
 > please.

You have another 2/3 possible issues :-

1.  crontab will only run the script at the defined point of time so you need
to run it often OR better still as a subtask from a routine that WILL run if
the battery is low at a given point (not almost flat) to shutdown the system ,
NOTE the term shutdown by using similar to shutdown -h now and not halt which
may well not close down any processes running first and possbly cause
curruptions on your system disk / SD etc.

2. As a follow on from 1 , you need a low level process that is constantly
running say with a sleep of nn seconds that tests the battery state and if 
good
sleeps or runs process similar to your bash script but not it and suggest say
a little C process as it would use less resources.

3. As a follow on from both of the above.
You should check what battery setting you have for throttled and have it set 
to
at least 25% battery power if you have a lot of proceses that can be running 
at
any one time and if needed a higher value.

I have a similar set of processes but linked to a APC UPS so see package
apcupsd.

Vincent

Back to comp.sys.raspberry-pi | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:14 +0000
  Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-12 12:40 +0000
    Re: Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:50 +0000
      Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-12 15:15 +0100
      Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-12 21:43 +0000
        Re: Battery Powered Project Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2021-01-13 09:40 +0000
        Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-13 18:02 +0000
        Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-13 22:04 +0000
          Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-13 23:37 +0000
            Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 00:43 +0000
            Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:59 +0000
            Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 10:18 +0000
              Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
                Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 11:46 +0000
                Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 12:21 +0000
                Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 12:38 +0000
                Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-14 14:17 +0000
                Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:28 +0000
                Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-16 20:09 +0000
                Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-17 07:19 +0000
                Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-17 15:57 +0000
                Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-18 07:05 +0000
                Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-18 14:14 +0000
                Re: Battery Powered Project John Aldridge <jpsa@cantab.net> - 2021-01-17 17:52 +0000
              Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 12:56 +0000
              Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-14 13:46 +0000
                Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:26 +0000
          Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:46 +0000
            Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 09:23 +0000
              Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
                Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 17:48 +0000
            Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-18 17:07 +0000
              Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-18 20:33 +0000
                Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-21 20:36 +0000
  Battery Powered Project nospam.Vincent.Coen@f1.n250.z2.binkp.net (Vincent Coen) - 2021-01-12 14:35 +1300
  Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-12 16:40 +0000
    Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-13 13:56 +0000
      Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-13 15:12 +0000
        Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 12:24 +0000
          Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 17:53 +0000
            Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 20:39 +0000
              Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 22:33 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 23:30 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 23:52 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 10:39 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:32 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 13:20 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 13:41 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 14:02 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 15:15 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 13:46 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 15:24 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 15:34 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 16:21 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 17:18 +0000
                Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-19 19:31 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:12 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 22:15 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:03 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 10:49 +0000
                Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 11:29 +0000
                Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:02 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 15:49 +0000
                Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 16:54 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 17:19 +0000
                Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-21 10:24 +0000
                Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:18 +0000
                Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 14:14 +0000
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 14:51 +0000
                Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:45 +0000
                Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:44 +0000
                Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 15:07 +0000
                Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-20 16:38 +0100
                Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 15:45 +0000
                Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 10:07 +0000
                Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-21 12:30 +0100
                Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 13:09 +0000
                Re: Battery Powered Project Anssi Saari <as@sci.fi> - 2021-01-22 10:08 +0200
                Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-22 10:29 +0000
                Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-22 10:25 +0000
                Re: Battery Powered Project Kees Nuyt <k.nuyt@nospam.demon.nl> - 2021-01-19 17:03 +0100
                Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-17 01:09 +0000
            Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:48 +0000
              Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 12:11 +0000
              Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:43 +0000
            Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:52 +0000
              Re: Battery Powered Project Andy Burns <usenet@andyburns.uk> - 2021-01-17 13:53 +0000

csiph-web