# How do I make this electronics system of circuits and batteries work?

I have this:

where Battery #2 will connect with pins (like wireless earbuds) to Battery #1 so Battery #2 can get charged (from Battery #1). So Battery #2 can be easily disconnected and connected to Battery #1 just like wireless earbuds with their case.

My question is, how do I make it so that when Battery #2 is disconnected from Battery #1, Battery #2 and Circuit #2 are connected. But when Battery #2 is connected to Battery #1, the connection between Battery #2 and Circuit #2 is determined by the switch (or the state of the connection) between Battery #1 and Circuit #1? In that way, when Circuit #1 is on and Battery #2 is connected to Battery #1, Circuit #2 is also on. When Circuit #1 is off and Battery #2 is connected to Battery #1, Circuit #2 is also off. And when Battery #2 is not connected to Battery #1, Circuit #2 is on. What's the easiest way to do this with least components?

• Is there any way you could word that in a way that people could understand? It's too complicated. Jun 11, 2020 at 7:43
• @SimonB I've tried my best sorry Jun 11, 2020 at 7:52
• Description is confusing but makes sense. | B1-B2 can be joined to charge B1 from B2 (very naughty). In this mode S2 controls L1 & L2 powered from B2. | When separated S1 controls L1 from B1 and L2 is on from B2. Jun 11, 2020 at 10:58
• @JingleBells I've added a diagram of an EXAMPLE circuit. Note that if you want a two wire interface then YOU have to decide how you are going to both charge over two wires and signal the state of the switch to load 1. It's doable but needs a plan on how ypu wish to do it. See my answer. Jun 12, 2020 at 12:32
• Let me see if I understand you correctly. You want to have two parts: part #1, which contains circuit #1 and battery #1, and part #2, which contains circuit #2 and battery #2. When the two parts are disconnected from each other, both circuits should be on (that is, connected to the batteries). However, when the two parts are connected to each other, both circuits should be controlled by a single switch. Am I understanding that right? At first glance, that requirement sounds quite arbitrary; can you provide a little bit of explanation as to why you want to do this? Jun 15, 2020 at 2:01

where Battery #2 will connect with pins (like wireless earbuds) to Battery #1 so Battery #2 can get charged (from Battery #1).

WARNING:
It is VERY unwise and also dangerous to directly connect two batteries together in order to try to charge battery 1 from battery 2. If battery 1 is relatively discharged and battery 2 is relatively charged VERY high currents can flow between the two batteries.
Depending on the LiIon batteries used this could cause fire and/or damage to the batteries.

You could add a resistor in the circuit between batteries - but this will waste energy and needs to be sized for the worst case relative charge situation.
An acceptable solution is to add the circuitry from a battery bank that will accept 3 to 4.2 V in and provide battery charging out. Because of the way battery banks usually work not all will operate with 3V to 4.2V in.

What will work - and it adds complexity and inefficiency is to use TWO battery bank circuits. Battery 2 inputs to the battery terminals on PB2 and outputs 5VDC. PB2 5VDC out connects to 5vDC IN on PB1 and charges battery one connected to PB1 battery terminals.

__________________

My question is, how do I make it so that when Battery #2 is disconnected from Battery #1, Battery #2 and Circuit #2 are connected. ....

You can almost do this with manual switching, and do it exactly with a relay or simple circuitry.

In both cases a 4 pin connector is used between B1, L1 & B2, L2.
2 wires connect the batteries via a charging arrangement - see above.

Manual:

If you don't mind having to manually switch B2-L2 when the modules are disconnected then this is an easy and low cost solution.

Provide a switch S1 between B1 - L1 and another between B2-L2.
When the connection is made charging occurs from B2 to B1 and L1 is connected to L2.
When the connector is disconnected then B1-L1 is controlled by S1 and B2-L2 is controlled by S2.

Automatic.

A relay in both modules can be operated via the 2 extra connections when the modules are connected. The relays can connect or disconnect Bx to Lx as required when the modules are separated.

A simple electronic circuit (one or two transistors and a few resistors on each module) could replace the relays.

I could draw the related circuit, but I suggest that you look at the above descriptions and draw a circuit that matches. Ask if too hard after giving it a try.

A circuit with a 2 pin connector may be possible but with extra circuit complexity.

_________________________

Below is an example only circuit that meets what I understand your requirement to be. S2 operates both loads when the two modules are joined and load2 only when separated. Load 1 is automatically powered on separation.

When plugged together:

• B2 charges B1 via a suitable charging circuit.

• Switch 2 operates Load 2 and Load 1 from Battery 2.

• Q3 is turned on via R3 and turns Q1 off.

When unplugged:

• Switch 2 operates load 2 from battery two

Three wires is possible with a little more complexity.
Two wires would need "signalling" over the charging circuit and is possible but non-trivial. Use of eg optocoupled signalling as well as the two power leads would allow two wires plus the opto link.

In this mode S2 controls L1 & L2 powered from B2. | When separated S1 controls L1 from B1 and L2 is on from B2.

simulate this circuit – Schematic created using CircuitLab

In the above diagram charge direction is left to right.
Assume source battery is of higher mAh than target battery.

R7 ~~= V/Ib
Ib ~= Ichg/Beta_Q1*2
Say Beta = 100 (higher available).
Say Ichg = 150 mA max.
V_R7 ~= 2.5V
R7 ~= 2.5/(0.150/100 x 2) ~~= 1K
Change Q1 to a suitably low Rdson MOSFET for much lower standby current.

R3 maybe 33k
R6 maybe 220k

MOSFETS allow much higher resistor values ane lower losses via resistor strings.

If using bipolars then eg BC327-40 / BC807-40 have higher beta so allow larger resistors.

__________________

This addresses the various discussions. I have not gone over it in utter detail compared to spec as the spec is somewhat fluid - and a boost converter is still needed for battery-battery charging BUT it shows how one side can auto turn on when disconnected and how both sides are controlled by one switch when connected.

Click image for larger version

• Comments are not for extended discussion; this conversation has been moved to chat. Jun 14, 2020 at 4:43
• You constantly decline to answer my questions. || You CANNOT make it transfer charge from one battery to another when the source is less than about 0.2V above the target using TP4056s alone. You COULD use a powerbank module to step up the source to 5V and a TP4056 to use the 5V to charge the target. Jun 14, 2020 at 12:26
• @RussellMcMahon Sir, could you please point to which questions I haven't answered, so I can answer? Jun 14, 2020 at 14:03
• @RussellMcMahon I understand that there will be a voltage drop which limits the voltage which B2 can reach while being charged. I'm not able to order a powerbank module and I need to fit the whole circuit into a ring (not exactly, but a very small space). Is there some type of a small space-efficient circuit that I can do that will do the job of supplying 5V to the second TP4056 module? If not, I could perhaps remove the second TP4056 module and put some other circuit that'll do the job? Jun 14, 2020 at 14:17
• @JingleBells You seem not to have actioned my above "R3 needs to go to Right-side_Out- via via Left-side connection. You have it going to Right-side_Input - which may not be the same. " Jun 23, 2020 at 10:32