Need advice on documenting my Raspberry Pi power failover project (and maybe some help designing it)

Thread Starter

AngusM

Joined Feb 8, 2010
6
This will be, by far, my largest project yet and I could do with some advice on documenting it. First of all, what medium do people use to do that? Blogs? I see we have the ability to write blogs here, but not a lot of people use them and it doesn't seem like this site doesn't make readily-available features to browse them. I asked Google Gemini and it recommends GitHub
Some advice on how to seek help may not be a waste effort either. So far I've been to the two StackExchange forums and the Raspberry Pi forum but so far all I've gotten are downvotes and crickets. For instance, I don't seem to be able to find out what kind of ripple voltage is acceptable in the power supply to the R.Pi. I can get it below 50mVp-p, but I can't confirm if that's good enough for the Pi.

If anyone's interested, this project is going to be a failover system to switch my CPAP to a battery backup in the event of a grid power loss. It has these features:
  • I already have a 12V marine battery and a DC-DC booster to get the 24V the CPAP needs. The battery will also be hooked up to a battery tender, because it's going to be maintaining the R.Pi
  • A buck converter, driven by the battery, will output 5V necessary for the R.Pi and other components. Both it's input and output will be filtered, since the output will have a ripple voltage and so will the input, due to the battery maintainer that will be on while the grid has power.
  • A system of relays, driven (indirectly) by the R.Pi's GPIO will manager the changeover between the DC-DC booster's output and the AC adapter's output.
  • An NMOS will keep the DC-DC booster off until it is needed (I don't think it likes to be power 8hours a day).
  • The grid loss detection will be managed by an optocoupler. The BJT will pull down the voltage on a voltage divider and the R.Pi's GPIO will monitor this voltage.
  • The battery voltage will be monitored by an ADS1115 connected to the GPIO
  • The output to the CPAP will be buffered by a 98mF capacitor, to maintain power during the crucial milliseconds required for the changeover.
 

Jerry-Hat-Trick

Joined Aug 31, 2022
775
Maybe I’ve not understood correctly, but I’m thinking that a Raspberry Pi is over complicated for this application. I expect that the CPAP device has a tolerance on the voltage necessary to keep it running and you may get away with the backup supply being fed through a Schottky diode (which has a low voltage drop) in parallel with the main supply. If something more complex is necessary, a fairly basic processor like an ATtiny85 should suffice - the Digispark version if you want to program it directly from a PC USB output
 

Thread Starter

AngusM

Joined Feb 8, 2010
6
I also want to monitor the voltage and shut everything down if the battery voltage gets too low. But first, I want to have some vision of how to document such a project.
 

Jerry-Hat-Trick

Joined Aug 31, 2022
775
I’d suggest that the key to documentation is to write a very clear requirement specification before coming up with a planned solution. This would probably start with a clear description of the CPAP device including the details of the voltage and current requirement, the details of the battery you have and a description of the normal operating conditions and what you expect to happen if the power fails. From your post it looks like you have decided on a solution to a problem which, if carefully defined, may lead to a simpler solution. As I mentioned, I’m not convinced that you need a processor at all. Is the device intended, for example, to be switched on all the time? Could the power supply trickle charge the battery? How serious is a brief absence of power if the backup takes time to get started?

it’s not unusual to see requirement specifications which are not well prepared leading to poor engineering solutions. The documentation following the requirement specification leads naturally into description of alternatives and details of the selected solution
 

Thread Starter

AngusM

Joined Feb 8, 2010
6
Giving the requirements isn't so hard.
  1. I already have a marine 12V battery and a DC-DC booster to get the 24V the CPAP needs. I want the changeover to be automatic.
  2. I want to be able to monitor the battery and shut everything down if the battery gets too low.
  3. I want 0 downtime during the changeover. The booster probably doesn't output as soon as its input is powered, plus there are going to be a few ms between when the grid power is lost and the Pi reacts. A large output cap should solve this
  4. Energy efficiency: that's why I'm looking at a buck converter to get the 5V needed instead of a regulator for the 12V battery. I'm also going to need to find a way to pull the power on the Pi once it shuts down.
  5. I don't want to fry anything, which means more relays, flyback diodes, RLC filters, current limiters, etc.
  6. Then, if I'm feeling ambitious enough: a manual override switch, shutdown button, voltage display
It's those last 3 that make things complicated and I don't seem to be very good at attracting attention to this project.
 
Top