I was attempting to make a mini UPS for a raspberry pi. The (relevant) bill of materials goes as follows:

  1. 250V/50Hz AC to 5V/5A cctv power supply
  2. A 2-port mobile powerbank (i.e. it can charge two phones simultaneously)
  3. A 5V DC sugar cube relay
  4. A capacitor - 4700 micro farads

They are connected as per this schematic:

enter image description here

The working principle is as follows: When there is AC supply, the 5V DC will activate the relay. This closes the circuit wrt the cctv powersupply device; the rpi should boot properly; and the powerbank should charge. When the AC powersupply is offline, the relay deactivates (i.e. enters the NC state). In this state the circuit should be (theoretically) closed wrt the powerbank's output; the rpi should boot properly. During the "switch" there is a momentary dip in the rpi's powersupply. This is taken care of by the capacitor.

Somewhere during breadboard prototyping phase, I noticed that I didn't need to ground the output of the powerbank. In other words, the powerbank's output was grounded through the GND of the powerbank's charging port. At the time, this made me assume that this is the norm. I decided to design the circuit likewise, and, implemented on a stripboard.

However, on the stripboard, my experiment failed. I observed the powerbank wasn't supplying output to the target device. Since, the circuit wasn't closed like I thought it would. This could be because of the powerbank being used was a different one - not the same one used during the prototyping phase. Perhaps this could be a feature of powerbanks with passthrough charging feature.

Hence, moving on, I decided to make a connection between my target device's GND to the powerbank's output GND. I connected pin2 of j2 to pin2 of j4.

Now when the mains supply is offline. I am unable to observe the actual order - but the following happens:

  1. The relay momentarily jumps to a NO state.
  2. The rpi momentarily tries to power on, but as soon as I hear the relay's click the pi looses power supply.
  3. Same is the case with the powerbank output.
  4. The powersupply device, has, an indicator LED on it. In its normal operation (i.e. when it is supplying DC from the AC mains) it turns on. But in this case, there is not AC supply. But it turns on momentarily.
  5. I am unable to discern whether the actual number of relay clicks. (one or two).

I am still unsure why this happens. Hoping someone can correct the defect.

  • \$\begingroup\$ relay momentarily jumps to a NO state does not make sense because it means jumps to a normally open state ... do you mean that the relay momentarity energizes? \$\endgroup\$
    – jsotola
    Mar 14 '20 at 1:04

First off, I think (hope?) that you drew your relay backwards. As shown, it would connect the Pi to the powerbank output when it is energized (when the charger is connected). If so, then...

You do not know what the circuit inside your charger or powerbank looks like. There could be lots of stuff going on inside there that could mess up this circuit.

It is, for example, possible that the powerbank will output a voltage on the charging terminal when there is no charger connected and the current draw in the output is low. See how that could mess things up?

You could try adding a diode here...

enter image description here

..and see if that helps. If not, report back and we can try more things!

Also, while the 2 grounds on powerbank might be connected together, you really should not assume that. Better would be a double pole relay so each power should could have an isolated ground.


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.