Just having a bit of a current control problem.

Thread Starter

robp1956

Joined Jun 12, 2026
19
I will begin by explaining my use case then I will present the beginner problem I have. First let me suffice this with that I am rank beginner and I know there are far better designs than this simple thing I have. So I wish to drain an 18650 battery and I wish to sense the voltage of the battery by using a point just after the 0.1ohm sense resistor I have chosen. Now The battery drain is through a mosfet and no connection from that circuit to the control circuit bar the high impedance input that an op amp provides. I have the shutdown after low voltage part done as a test circuit. we'll see after connection. the part I am having a bit of trouble with is the Mosfet allowable current which can vary between 100mA and 1.5A with the ability to go to 2A. Being the type that likes to learn through struggling I am not looking for a drop in solution but rather some pointers on direction. So for the current control circuit it I think will start with a difference amplifier between the top and the bottom of the current sense resistor. from there at 1.5A there will be a constant 150mv drop across that resistor. Feeding that to the difference amplifier would give me 150mv at the output. That voltage must be boosted to gate voltage likely between 2 and 5 volts or in the linear control part of the Mosfet. So some circuit advice here would help can the difference amplifier be boosted to a more apropriate voltage for the Mosfet or must I use another op amp to get the voltage correct. I know this seems simple to most of you but I'm retired and I have really nothing better to do other than what little brain I have to play with junk I have had in drawers since I was a young teen.
 
Last edited:

dl324

Joined Mar 30, 2015
18,362
Welcome to AAC!

You could use an opamp to make a current sink, using a potentiometer to set the current. You could use a comparator to control a MOSFET to switch the battery out of the circuit when it gets down to 2.5V.

In a pinch, you could use a comparator as a slow opamp so you can use something like LM393 (dual comparator). You want the current sense voltage to be low (so use something like a 0.2 ohm resistor). You'll need the common mode input voltage to be low. LM393 allows 0V on the inputs.

When I was testing Li-ion cell capacity, I ended up buying a 4-channel board that charged and discharged at around 1A. From AliExpress:
1781388516271.png
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Ok after much playing around I have come up with a formula that works but is limited to current draws of between 0.5A and 1.5A. standard difference amplifier setup with R1=1000 and R2=30000. with this in place and a 4.1v power supply drawing 1.5A does give me 9v out or close to rail out that puts my mosfet into saturation. bringing the current down to 1.3A gives me 7v out down to 0.5A giving me 3V out MosFet remains on at 0.3A I get 1.8V out MosFet off, I believe. Only a leakage current flows from what I can tell. Given this will I get linear control of the MosFet voltage at the gate and therefore current through it. there are still problems that I would have to solve even getting to this point. If someone can figure this out and tell me I'm barking up the wrong tree with this method. I will search for other ways to handle the problem. my Mosfet does turn on at 2V gate voltage but below that current is severely reduced not off quite yet but not usable or reliable at that stage.
 

BobTPH

Joined Jun 5, 2013
11,555
Now The battery drain is through a mosfet and no connection from that circuit to the control circuit bar the high impedance input that an op amp provides.
If this s literally true, there is no ground connection between the drain circuit and control circuit. That will not work. They must share a ground.
 

dl324

Joined Mar 30, 2015
18,362
Ok after much playing around I have come up with a formula that works but is limited to current draws of between 0.5A and 1.5A. standard difference amplifier setup with R1=1000 and R2=30000. with this in place and a 4.1v power supply drawing 1.5A does give me 9v out or close to rail out
A schematic would be appreciated.
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Welcome to AAC!

You could use an opamp to make a current sink, using a potentiometer to set the current. You could use a comparator to control a MOSFET to switch the battery out of the circuit when it gets down to 2.5V.

In a pinch, you could use a comparator as a slow opamp so you can use something like LM393 (dual comparator). You want the current sense voltage to be low (so use something like a 0.2 ohm resistor). You'll need the common mode input voltage to be low. LM393 allows 0V on the inputs.

When I was testing Li-ion cell capacity, I ended up buying a 4-channel board that charged and discharged at around 1A. From AliExpress:
View attachment 368339
Yea I know all about those from China I have one. remember though I am here trying to learn not find the fastest or cheapest option
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Ok here is what I came up with to eliminate a lot of what would have cost me more and boiled it down to just 2 Ic's in the Mosfet control portion not shown for simplicity. From reading the datasheet on the voltage detection IC the STM1061 with a 2.8 volt reference inside the chip so when the battery level gets down to that preset lower point the chip locks on an active low signal. I need an active High signal so I was hoping to use an LM358N as an inverting buffer but I'm unsure if this will work. If not I will try other solutions till I find the right one.Voltage manage.jpg
 
Last edited:

dl324

Joined Mar 30, 2015
18,362
here is what I came up with
What is the power supply voltage?

Why are you using two different ground symbols?

What are the polarities of the MOSFET and BJT (and part numbers)?

Why is the VDD pin of the IC connected to ground and the VSS pin connected to the positive terminal on the battery under test?

What is the current control signal?

The output voltage of the IC is open drain, so you need a pull-up resistor. What voltage is it factory set for?

You have the opamp configured as a voltage follower. I'm not sure what you expect it to do with the output from the voltage detector.
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
This is the part number for the voltage detector I was thinking about. part number: STM1061N28WX6F internal voltage set to 2.8V if the battery in question falls below that level cut off the MOSFET current drain. I could do it with a comparator but I thought I might give this a try. I don't own an arduino yet but I do have my eye on making this more digital. the options are still open for any of that. but for now old analog kinda guy needs to learn with old analog ideas first then we can start speaking in code. I am retired nothing better to do and thought I would expand my horizons a bit and relearn an old hobby I had before I entered University for math/physics not Electrical engineering. I don't really care that much if when I try these things they simply melt on the spot. That's why I'm here to learn I may be old and in some ways feeble but my brain is still very active and I'm not afraid of the math or the failures Failures I found is always how I learned best. For right now and for this pseudo project the 18650 battery does not exist the circuit will be fooled into thinking a power supply is the battery under test. I can speak much about the physics behind the LI-ion cells but that is all theoretical and and not really how the practical world works once Murphy get's in there anything can happen and me and Murphy are the best of buddies.
 
Last edited:

dl324

Joined Mar 30, 2015
18,362
This is the part number for the voltage detector I was thinking about. part number: STM1061N28WX6F internal voltage set to 2.8V
I see that from reading the text, but I was just looking at the schematic when I posted my questions.

What are the answers to the rest of my questions?

Are you determined to design this on your own? Or are you willing to take some circuit suggestions?

Do you already have the voltage detector IC? Do you have a problem with using a voltage comparator? It looks like the detector IC costs 2-3X what LM393 goes for. Plus, STM1061 appears to be SMT. 2.8V is neither the usual low voltage cutout (2.5V), or the conservative voltage (3.0V). Why did you pick that voltage?

I also just noticed that you're using two different conventions for crossing wires with no connection. I'd suggest sticking with the dot convention and lose the hump. The humps with connection dots style went out in the 1960's (thankfully).

Also, your posts would be easier to read if you used paragraphs to organize your thoughts.
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Circuit suggestions are always welcome What I am looking for is to learn more about the new things that have come about since I was out of this and living a different life. Now I've slowed down but I have a ton of parts I have either been sent or have acquired from years as a lad just taking electronics in. I still have some of thew things I built from years and years ago.
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Yes I have had 10 for the last 3 years that someone just gave to me. but that is neither here nor there I just thought I would give it a shot that way. I have no problem using any OP amp IC I have and I have lots LM350P LM 324's those I have and the 393's also. Over the years of little power supplies I have built. I have been able to stay at least not losing all I learned so there was a few little amps and sensor amplifiers and the like but now with more time. What the hell right call it a bucket list thing maybe reinvent the wheel or something.
 

dl324

Joined Mar 30, 2015
18,362
Circuit suggestions are always welcome
Here's an adjustable current sink and battery disconnect circuit:
1781750388440.png
EDIT: swapped inputs on comparator.
EDIT 2: Q1 needs to be a power device like IRLZ44N.

The zener diode voltage is the cutout voltage. With the values of R2-4, current can be set from about 100mA to 2.07A.

Adjustments will likely be required. The 200 ohm pot will probably be more than 200 ohms. The opamp input offset voltage is 2-7mV, so that could affect the minimum current. R2 and R4 are 1% resistors. Both MOSFETs are logic level. You'll want to make appropriate substitutions to breadboard because they're SMT devices.

You can add hysteresis to the comparator if it oscillates around the cutout voltage.

You can replace the LM358 with the other comparator in the package to eliminate one IC. If you do that, you'll need a 10k pull-up resistor on the comparator output.

Circuit has not been breadboarded and has only been simulated on the simulator between my ears.
 
Last edited:

Thread Starter

robp1956

Joined Jun 12, 2026
19
Well funny you mention the 1N5222 in that circuit I have those exact Diodes on my order at the moment Found myself lacking in the lower voltages in zener diodes so I have those on my order orders $100.00 or more get free shipping and I would spend that and more if it was closer I would go there. when I started messing with this idea I had a similar circuit. I have to confess though I don't know MOSFETS but I was unsure of the sometimes quite different RDS numbers. Seems to me that the Mosfet with the higher on resistance would be eating the largest portion of the power drain. That was really my only worry with such a circuit. but as I said I have not played much with MOSFETS just yet. One of those kinda new things to me and one of my many relearning hurdles I have to get better with. Oh what once we had. Also is there a reason you chose different Op amps for the circuit ?
 
Last edited:

Thread Starter

robp1956

Joined Jun 12, 2026
19
As a side note here I am absolutely not set up for and SMD SMT soldering. I lack a hotplate for now. I have done some with a careful application of a hot air station. But I fear for the components should I keep doing that So hot plate it will have to be..
 

dl324

Joined Mar 30, 2015
18,362
Well funny you mention the 1N5222 in that circuit I have those exact Diodes on my order at the moment
I used it because I decided on a 2.5V cutout voltage for the Li-ion battery. If you wanted it to be higher, you could just use a higher voltage zener. I think the next value in my stock would have been 3.3V.
I have to confess though I don't know MOSFETS but I was unsure of the sometimes quite different RDS numbers. Seems to me that the Mosfet with the higher on resistance would be eating the largest portion of the power drain. That was really my only worry with such a circuit.
I chose MOSFETs because they'd dissipate less power than a BJT would.

AO3400 is rated for about 5A (at a higher threshold voltage). RDS is less than 20mOhms, so it would dissipate around 40mW at 2A. A BJT would dissipate watts at that current.
1781789852018.png

I started studying electronics in the mid-1970's and they didn't teach about MOSFETs. They were more curiosities at that time and didn't have anywhere near the capabilities they have now (in particular low threshold voltages, low on resistance, and high current capacities, and SMT wasn't that common back then). I learned about them pretty much on my own.
Also is there a reason you chose different Op amps for the circuit ?
I tend to choose LM358 and LM393 (both around 50-year-old designs) when nothing better is required. LM358 is an opamp and LM393 is a comparator. Aside from the compensated gain stage of the LM358 and the open collector output on LM393, they're pretty much the same in functionality. That's why I suggested using a comparator for the opamp if you wanted to eliminate one of the ICs. Comparators are okay as slow opamps (due to the lack of compensation).

The opamp needed to allow a low input voltage and the input stage of LM358 is PNP, so ground is allowed. These days, users are more likely to opt for a rail-rail input device (and pay a buck or so for it vs $0.25 for LM358). The issue I have with rail-rail input opamps is that they usually use a complementary input. I worry about distortion in the crossover point. Early rail-rail opamps used charge pumps to operate the internal circuitry at more than the supply voltage. That could introduce noise. So I only use rail-rail input/output opamps when I need something better than LM358. It's hard to study modern opamps/comparators because manufacturers don't include detailed schematics. Also, you need to know the threshold voltage of the MOSFETs to analyze the circuit. You can't assume single Vt because multiple Vt's in the same device aren't uncommon these days. It just requires a different gate implant.

Similarly for LM393. I wanted the output to be able to go to the positive rail. Modern comparators usually have push pull outputs and can't quite get to the positive rail. The limitation on input voltage swing is addressed by using a 9V power supply LM393 allow around 7V, so getting to around 4.2V isn't a problem.
I am absolutely not set up for and SMD SMT soldering. I lack a hotplate for now. I have done some with a careful application of a hot air station. But I fear for the components should I keep doing that
For home use, I think a hot air tool is better than a hotplate. With a hotplate, I'm concerned about exceeding the maximum allowed soldering times (like 10 seconds). For commercial applications, the equipment can control the temperature and time better.

For most of the SMT devices I use, I use a soldering iron and 0.015" solder wire. When I try using paste (without a stencil), I usually end up not using enough solder and have connectivity issues over time.
 
Last edited:

Thread Starter

robp1956

Joined Jun 12, 2026
19
You can solder most SMT components with a soldering iron.
Not with these old hands and eyes. I need a microscope to even see them let alone solder them. I had enough trouble with them every time I did any sort of repair on any SMD things. Last time I did it was with one of my grandsons Arduino things a NANO I think that he blew the regulator in it. that had a simple 3 pin regulator in SMD package. It felt like I was heating it up so much that it would have melted a hole in the earth. Not fun and I fear for the components I attack with such a method.
 

Thread Starter

robp1956

Joined Jun 12, 2026
19
Yea I have a similar collection of aids for doing such work but each one comes with it's downsides. While they do a good job for the most part the field of view can get rather narrow with some. I have been eyeing a soldering microscope lately and I though a decent unit would climb into the thousands of dollars. this one seemed to have little or no lag in movement under the microscope. a few years ago I looked into one that was even more money and the lag under it was really bad like commanding a rover from earth and watching it move on mars a few minutes later. I was impressed with the new one I saw. and it was under the 300.00 mark. I may just take the leap soon.
 
Top