OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) safe shutdown on power loss with larger capacitor

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47512

    JimS
    Participant

    Have been doing some thinking about safe shutdown since I have had a few corruptions of SD cards on the pi. Lipo batteries seem like a bad choice since they can catch fire (maybe this is due to bad charger design but I would rather just avoid it). A really big capacitor seems like a good choice. Since the normal voltage of the input cap is about 30 volts and the regulator works down to 7 we have a fairly large range and a decent amount of power during discharge. I figured if the load is 1A at 5V and the capacitance 400,000 uF it should power the board for about 60 seconds (actually calculated a bit more but 60 factors in some losses – it’s probably a little less than 60). What else is needed is a way to detect power loss which could be a gpio pin. And a way for the power to be shut off (so it will restart if power is failing and the board shuts down but the power recovers before the cap runs out). The shutdown pin of the switching regulator could be used or a MOSFET in series with the input. Since I am going to use an arduino for some other things anyway I figure I can shut the power feed off with the Arduino. And the arduino could sense the voltage and send a serial USB string to signal shutdown. This would allow everything to be done on the arduino with no changes to the OSPi board.

    Since it’s headless I think I could shut down HDMI and maybe some other stuff to save power. Anyone interested or done something like this?

    #47746

    Ray
    Keymaster

    I would think adding a capacitor on the 5V (VIN) line is easier as it’s much cheaper to get a super capacitor that can withstand 5V. You can detect power loss by checking the voltage at capacitor C1 (the input voltage capacitor that is generally at 30 to 36VDC when 24VAC is plugged in). Use a resistor network to drop it down to something below 3.3V and connect it to a RPi GPIO pin (best through a 1K series resistor to be on the safe side).

    #47805

    JimS
    Participant

    I slipped a decimal place in the capacitance I think and changed the value above. That’s a huge capacitor (or several).

    I don’t think most supercapacitors are used directly but have a switching converter so more energy can be extracted by allowing more voltage drop at the cap.

    I have a lightly loaded UPS for my routers and such so am thinking of injecting power from UPS on unused ethernet lines. The failure of the main power line could be detected and shutdown the Pi. From what I have read NUT is a UPS supervisor that can run on the Pi and handle everything including restart.

    Looks like it could even handle multiple machines via network communication.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) safe shutdown on power loss with larger capacitor