enter image description here

Good morning everybody, I'm trying to build a 5v solar panel charger for a smartphone like the one in the picture. I would like to add also a 3.7v 3A Lipo battery with protection circuit to store energy when phone is not plugged.

Do you know an easy why to make the circuit only charge usb output when phone is plugged and battery when is not? (Possibly without using a manual switch). I understood adding a resistor to the battery will make charge mainly the phone but will keep charging only partially the battery when phone is not plugged.

Basically I'm interested in knowing if there is a way to address circuit energy to a different output depending if a device is plugged to the usb. Maybe a mosfet but not sure how.

Thanks in advance for your help and let me know if you need additional information and please forgive me also in advance for any mistake you can find. Andrea

  • 1
    \$\begingroup\$ Get a solar charge controller so the panel charges ghe battery and then output from battery into a dc buck converter \$\endgroup\$
    – Solar Mike
    Commented Apr 7, 2018 at 8:04
  • \$\begingroup\$ Thanks Mike but I would prefer if possible to get the current from the panel directly as it seems more efficient getting 5v from panel to the phone instead of 5v from panel lower to 3.7v then boost again to 5v. \$\endgroup\$
    – Andrea
    Commented Apr 7, 2018 at 8:21
  • \$\begingroup\$ Then how do you think you will get the battery to 5v when you say it is at 3.7??? \$\endgroup\$
    – Solar Mike
    Commented Apr 7, 2018 at 8:42
  • \$\begingroup\$ I suppose I should add a boost step-up chip like fp6717. \$\endgroup\$
    – Andrea
    Commented Apr 7, 2018 at 9:46

1 Answer 1


Basically I'm interested in knowing if there is a way to address circuit energy to a different output depending if a device is plugged to the usb.

Indeed some USB connectors do have a detection pin to indicate that a device is currently plugged in as mentioned by Ali Chen in this post then explained by Dominic Luciano in this post. Basically when a cable is plugged in a USB connector with integrated detection pin, the latter will be connected to ground. You could then use a MOSFET based switch circuit to manage energy flow :


simulate this circuit – Schematic created using CircuitLab

In this example circuit, the M1 and M2 transistor's gates are pulled-up to your 5V output so that M1 remains OFF and M2 remains ON while no device is plugged in. Thus your LiPo can be charged. When you plug your phone, M1 will turn ON to charge the phone while M2 turns OFF and disconnects the LiPo. I have not tested this circuit though.

Regarding the LiPo, you should take care on how you plan to charge it. These are delicate batteries whit respect to others technologies (LiFe, Li-Ion...) and have to be charged cautiously. If possible, find an IC charger for LiPo battery with adequate voltage and current ratings. If new to batteries charging matters, you should check it on the Internet before taking any further steps.

  • \$\begingroup\$ Thank you François for your help. I was hoping something easier exist but I could not pretend electronics stays always at my level of knowledge. :) Regarding lipo there is a small pcb mounted on the battery dedicated to avoid overcharge and overdischarge and voltage limitation, this is why I preferred to lifepo. Let me know if you believe is not enought and I will try additional protection \$\endgroup\$
    – Andrea
    Commented Apr 7, 2018 at 17:29
  • \$\begingroup\$ Glad to help :) Though this might not be the ideal circuit nor the most simple one. Regarding your LiPo PCB, read its documentation, if provided, to check input/output voltages and current ratings to make sure your application is suited. Good luck! \$\endgroup\$ Commented Apr 7, 2018 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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