Solar panel + Lipo battery
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 &ndash; 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.