Help with designing a device that can run off of a lithium cell while it is charging

I have a pretty spiffy darkroom timer that I have designed, running on an Arduino Nano with a 4 digit LED display and some big chonky buttons for controls.

This works beautifully right now, using a USB-C “Decoy” PD gadget that provides 5 volts regardless of what USB-C source I plug in to.

I would like this to be battery powered, and my ever-present servant, ChatGPT, is having me use a 18650 3.7V battery with a TP4056 lithium battery charger module and a MT3608 boost power convertor to get the 5V–that then powers both the Arduino Nano and the 4-digit display. The current “Decoy” gadget will be dumped.

Everything was looking fine, and I was sorting out how to modify my case to house the components when ChatGPT casually mentioned the need to add a Schottky diode to prevent back flow from the MT3608 into the TP4056, and told me about all kinds of mayhem that could result without this precaution.

No matter where I look, I find sites that tell me about using a MOSFET + resistor + diode combination to solve this problem, and other sites that say the TP4056 can never be used to charge while the battery is under load.

The problem is, I don’t want to add a power switch. My design is such that the Arduino will always be on, so I can’t charge without load. The display will be off, and Arduino CPU in sleep mode, but it will still technically be “on”.

ChatGPT indicated that the single diode is sufficient though it the MOSFET solution is more efficient for other use cases, but for my darkroom timer this will work just fine.

Give it to me straight: Is ChatGPT leading me down a terrible path?
Can I safely do what I am trying to do with just an additional diode between the TP4056 and the boost convertor?

You’re using a preassembled MT3608 module, right (and TP4056)? These will have the required protection bits.

I see no reason why a TP4056 can’t charge under load. The battery acts as a significant buffer. You don’t want the load to be very high, but an Arduino and display will be fine.

All that said, I’d just look for an all-in-one “UPS” module. You can get them in various voltages and 18650 counts. I haven’t actually tried it yet (just arrived), but this one supports 2x 18650s with 5v output:
https://www.aliexpress.us/item/3256806984758101.html?spm=a2g0o.order_list.order_list_main.5.4c581802knQp3q&gatewayAdapt=glo2usa

I use a similar unit, but in “hat” form, for a Raspberry Pi in my car that syncs music and dashcam footage to a home server over WiFi. Works great.

I don’t know if this helps, but you can buy powerbanks that do this, and you can buy ready-made hobbyist boards that are intended for building your own power bank that does this - the keywords appear to be ‘noninterrupted passthrough’.

(You might not want to use one of those ready-made solutions, but perhaps studying one of them would yield information on the part numbers of components that have the feature)

Thanks for looking into this.

Here’s the device I built:

They have both stopwatch and kitchen-timer features, in a way that works well for photography.

They are really pretty small, so I can only fit that single 18650 in there (it fits nicely), along with whatever is needed to make the charging safe.

What I’m looking for is whether ChatGPT is telling me BS:

Make sure the boost converter’s output does not backfeed into the TP4056’s OUT+ pin. Some boards protect against this, others don’t.

  • You can add a Schottky diode on the 5V line to prevent any reverse current

  • Or just confirm your modules are well-matched (common in hobby kits)"

    Then under some conditions (especially if power is drawn while charging), the boost converter’s 5V output may leak back through the TP4056 OUT+ pin, causing:

  • Overheating

  • Charging misbehavior

  • Shortened module life

I’m quite happy calling BS on this if it really is–ChatGPT helped write the Arduino code but needed constant vigilance to keep it from doing stupid things, but when I give it a clear problem (set it up so the CPU sleeps and I can use the green button as an interrupt to wake), it behaves very well and gives me cites as requested.

But this time it has failed me and keeps inventing cites that don’t say anything about what it is saying, but those pages do mention risks and talk about the MOSFET solution.

The applicable term here is “load sharing.” Here is an article on the subject that might be helpful for you: Lithium Ion Battery Charger Circuit: Load Sharing.

If you do not want a BS answer, or cannot tell BS when you see it, what good does it do you to run a BS generator?

However, some of the words are mined from actual articles like this one:

Note Figure 2 which pictures a MOS transistor and Schottky diode to enable battery charging while the load is connected. Cf The TP4056: Lithium Ion/polymer Battery Charger IC

Thanks, that’s pretty much what I was finding when I was doing my due diligence.
It looks like I will either have to install a switch or go with the MOSFET setup.

Can you elaborate? I really would like to be able to do this the easy way, but it is above my pay grade, so I’d like to have confidence this would work, especially since others are providing cites to things that say I must add the extra circuitry.

I will answer this as a straight honest question.

Generative AI is not a BS generator–it is the most powerful tool I have seen come about since the beginnings of the Internet. Used correctly it does amazing things–it is right now assisting in complex medical diagnoses, and in my own industry it is assisting in pharmacovigilance by interpreting a firehose of adverse-event reporting information, and … writing tons of code for people like me.

The problem is, it is a very helpful assistant who will occasionally and non-maliciously make stuff up, hence human-in-the-loop.

For this project I was able to tell it everything I needed and over the past month or two the product took form, both on the electronic side (which pins to use, how to get interrupts to work, which display to use, how to hook them up) as well as the software side.

For things inside my wheelhouse (embedded coding) I let it do the scutwork and then I go and politely correct its mistakes. For things beyond my understanding, I trust but verify, asking it for cites for its claims.

In this claim (a Schottky diode is sufficient to protect the battery charger), I could not get it to produce a reasonable cite that backed it up.

…so I came here, where I knew I could find people who know this stuff like I know network analysis, and they would in short order give me the Straight Dope.

But I don’t throw out the baby with the bathwater. It is too valuable.

The concern, as best I can tell, is that the TP4056 has a notion of a “charge cycle” that it terminates after some time.

Note that battery chargers tend to operate in two modes: constant current and constant voltage. When the battery is mostly empty, the charger picks constant current mode since the battery tends to be rated for a max charging current. Then, as the battery is close to full, it picks constant voltage mode, since batteries also have a max voltage that you don’t want to overshoot (4.2v for li-ion).

You can just leave a battery charger in this state indefinitely–putting 4.2v across the battery and leaving it there. In fact you can build a simple battery charger from a 4.2v source with just a resistor which limits the current. Still, for power-saving reasons, you may want to shut off the charger completely when it’s done. And so the TP4056 shuts off when the current falls below a certain threshold.

The concern is that if you have a load as well, it will never fall below this charging current threshold and never shut off. But the charger isn’t going to put more than 4.2v across the battery. This charging current will just go directly to the load.

Maybe the TP4056 has some characteristic that I’m not familiar with, that it’ll overheat or something if it’s just on constantly. But that seems unlikely to me. Some of the links above say it’ll damage the battery, but it’s hard to imagine a scenario where that could actually happen. Either the charger is in voltage-limited mode, in which case it’ll never put more than 4.2v across the battery and hence not damage it, or it will be in current-limited mode, in which case the load is just decreasing the current going into the battery, which is again safe.

Also:
The standard MT3608 schematic already contains a Schottky diode to prevent backflow (it wouldn’t work without it, since it’s a boost converter). You can see it here:
Imgur

I double-checked on my boards and it’s there. If you want to be sure, check with a multimeter that has a diode mode. It should show a small voltage drop from +IN to +OUT, maybe 0.2 v. In reverse the multimeter will show nothing or maybe display a few volts.

I seriously apologize for questioning your insight and passing this to ChatGPT. But I’d like to be able to firmly say “It doesn’t know what it’s talking about!”

I asked it about the internal diode and got this:

You still want a separate Schottky diode:

  • Between TP4056 OUT+ and Boost IN+
  • To prevent the boost converter’s output filtering caps (and Nano’s circuitry) from backfeeding into the TP4056 OUT+ when USB is unplugged

My problem is that I don’t have the background I would need to determine if boost converter/nano back feeding into the TP4056 OUT+ is an actual problem, or if this is one of those silly things like a mechanic telling someone their oil all went out the dipstick tube.

(And though I did respond to one comment about why use AI, I’d rather not use this thread to debate GenAI, just to validate/invalidate this particular use case).

The Schottky that’s already on the board definitely does this already:

To prevent the boost converter’s output filtering caps (and Nano’s circuitry) from backfeeding into the TP4056 OUT+ when USB is unplugged

It’s a valid concern, but the board already does it.

In the diagram above, C2 is the output filtering cap. That will be at 5v, or possibly something else if the Arduino is backfeeding it (though the Arduino also has a diode that will prevent this).

D1 is the diode in question. It only passes current from input to output, not the reverse.

The input is connected to +IN through the inductor. The inductor may have a voltage across it, but current can only ever flow from +IN to +OUT (it will be interrupted when the MT3608 is charging the inductor, but it won’t allow the output to leak to input).

I’m not against use of AI at all (I use it almost every day at work), but I will say that I find it particularly weak for electronics-related things. I think the training data is just not very good. You seem to have the right degree of skepticism when it comes to its answers here already, so just keep that in mind.

Adding another Schottky to the input won’t harm anything (other than wasting a bit of power), but it is redundant, assuming your boards didn’t do something weird.

If you’re looking for an “AI seal of approval”, here is what Claude said:
https://claude.ai/share/cc376c6c-eacd-4762-bec2-bf49b20ac7f3

I had to do a little convincing.

I don’t have access to ChatGPT’s good models, so I didn’t try those. Grok also gave a reasonable answer, though it mistakenly thought it was a buck converter, not boost:
https://x.com/i/grok/share/k2igHdPdJdFwmOmHSiSLUqwnc

It correctly said that the only path from output to input is the feedback pin, which is high impedance and thus isn’t a problem. I’m actually mildly impressed at that.

Thanks for the assessment of AI’s training set. That’s always a major concern of mine. It can code circles around junior developers in Python and Java, which is a boon for me–I can treat it like a junior coder and provide gentle course corrections along the way.
But I doubt it will be able to tell me much about servicing the shutter mechanism in a 1970 Rollei 35.

And I do worry that GenAI may have a bit too much of a bias toward stuff that gets way too much airtime in our world (Star Wars and Harry Potter).

I’ll go with your recommendation and boldly hook it up straight with no extra parts.

TP4056->Battery->MT3608

Thanks!