To simplify the outside design as much as possible (keeping it simple to use and less expensive) I would like to use just one small 2-pin connector both as output to drive an external led and as 5V input that would charge the internal battery via a tp4056 lion charger IC.

Right image:Using the connector as output to drive a led:
Left image:Using the same connector but now as 5V input: enter image description here

I have some basic knowledge of electronics but not enough to determine how to separate the in and output from interfering with each other. Would this be possible? If yes, could anybody give me some help/hints with this?



The answer Theamk gave made me thinking...

would this work?: enter image description here

+Batt = 3.7V

When Arduino port is high (3.3V) Q1 and Q2 open (Led on) and Q3 closes preventing feedback from +bat to the VCC pin of the charger IC. (R4 is a pullup for Q3)

When Arduin port is low current Q1 and Q2 are closed (so no feedback from Vbat to VCC) and Q3 is open allowing current to flow from pin 1 of the connector to VCC of the charger IC.

Only thing is when the arduino port is high and the connector is used for charging nothing happens (5V from connector is higher than +bat so no flow through D1 and Q3 is closed) untill the arduino port goes low.

The diodes prevent: D1 prevents current from 5V charging to +bat D2 prevents the solar panel from backfeeding Q3 D3 prevents backfeed to the solar panel

Could anybody confirm if it indeed works like this? Thx!! (and if it should work which resistor values of R1, R2 and R4 and transitor types (SMD) I could/should use (LED is max 100 mA) )



You want to drive your LED with PNP transistor, see this answer: PNP transistor to command LED

Once you switch to this method, you will notice that pin 2 of both LED and charger circuit is connected to ground, while pin 1 always contains signal. Thuse, you can just parallel the outputs. You will want to additionally add a regular diode in series with LED resistor to ensure that charging voltage will not back-feed into +BATT via the transistor.

(edit): Vorstendom provided a schematic: schematics

  • \$\begingroup\$ Hi, thanks for the quick answer. I made the schematic but am unsure how I can now add it to this topic ( I am new to stackexchange...) I was wondering, isn't the battery feeding the charger IC when the led is on the way you describe it? (not sure if this is a bad thing though...) \$\endgroup\$
    – Vorstendom
    Jan 31 '17 at 17:41
  • \$\begingroup\$ Hi @Vorstendom. Welcome to EE.SE! Best would be for you to edit your question and add the schematic and comments there. \$\endgroup\$
    – Ricardo
    Jan 31 '17 at 18:14
  • \$\begingroup\$ Thx, i put it in the answer of theamk, he just needs to review before it gets visible :-) \$\endgroup\$
    – Vorstendom
    Jan 31 '17 at 19:03
  • \$\begingroup\$ that top PNP is wrong. base should not connect to +BATT only to the resistor. \$\endgroup\$
    – Jasen
    Apr 22 '18 at 6:01

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.