# Buck converter/ NiMH charger circuit review

I'm going to be charging an embedded NiMH battery and I'd like to use a switching charger to minimize heat production. For various reasons, I haven't found an off-the-shelf charger IC that would work for me, so I plan to control current with a buck circuit and use my MCU for monitoring and termination (I have a thermistor for monitoring as well). @Bruce-Abbott was helpful getting me on the right track in response to my previous question about how to to this.

I've designed a circuit but I was hoping to have it reviewed for glaring errors, as I'm a beginner at all of this :). I used the TI buck converter design spreadsheet for arriving at inductor and capacitor values. I'm using a 1 Mhz PWM frequency so I can use a small chip inductor.

I still have a number of questions:

-- Will my 3.0 V power supply be high enough to supply 200 mA to the battery (assuming a full battery voltage around 1.6 V)? The series Schottky should drop around 0.3 V and the sense resistor drops 0.2 V. I believe the Schottky is needed to prevent reverse flow when the device is powered down (I tried to select the Schottky for low reverse current).

-- I'm somewhat unclear on the sense resistor. It has to be a high-side resistor because I want to keep the battery at the same ground potential as the rest of my device. I've read that there are some difficulties with high-side sensing, but I believe that's only true with lower resistor values. If I understand correctly, if I'm okay with 10 mA error in my current measurement, that corresponds to a difference in voltage drop across the resistor of 0.01V. With the 12-bit ADC on the MCU I'm using I can get steady readings within a few millivolts, so this should be sufficient, correct? In reality I probably only really need to maintain the current within 25 mA.

-- Do I have to read the sense resistor differentially, or can I just take two sequential readings? Is the advantage of differential reading just that it can magnify the voltage, or is it necessary to have simultaneous readings?

The circuit:

• Which MCU are you using? Commented Jun 22, 2023 at 20:47

1. R24 is going to destroy the MOSFET. It'll make switching so slow that it will operate in the linear region, turning your switching regulator into a very bad linear regulator. Use a MOSFET driver and no gate series resistor. 1MHz is really fast for a PWM signal, the circuit can't tolerate almost any delay at all.

2. Your 3V supply will be enough to charge the battery.

3. The high-side current sensing is fine, although it will waste a tiny bit of power. You have to use a differential ADC conversion; converting the channels one by one won't work well because of voltage ripple.

4. Your reasoning that you need D6 to prevent reverse current flow is correct.

5. Make the microcontroller ramp the PWM duty cycle (and therefore current) up slowly. For example, when you sample 10 times per second, you could ramp it up or down by 1% every time, which results in a current delta of at most 30mA (1% * 3 Volts / 1 Ohm). If you want more accuracy, sample more often (i.e. 100x per second) and ramp less per sample.

About the gate driver: Your MOSFET has a maximum gate charge of 13nC and a typical microcontroller can deliver 20mA at its output. This means that a transition will take at least 13nC / 20mA = 650ns, and due to the exponential decay of charging a RC circuit, it'll take about 3x as long - about 2µs. This is already twice as long as an entire period of your desired 1MHz switching frequency. Since you have to switch twice per PWM cycle, you'll spend 4µs out of every cycle on switching time. As you want low losses, the PWM period should be at least 10x as long as your switching time, which is 40µs. In other words, you could realistically expect to switch the MOSFET at 25kHz without a gate driver (and an appropriate gate series resistor to limit the current).

Driving the MOSFET in this circuit without a fast gate driver is utterly infeasible.

• Wow, okay-- I didn't realize that I would have to sample the current that fast. I was under the impression that I could sample it occasionally and adjust if necessary, but I guess that was naïve :). Unfortunately I can't sample nearly that fast because my MCU is doing a lot of other things. My space is also very limited so I don't think I can go with a much larger inductor. I don't suppose you have a suggestion for another switching constant-current source? I've considered LED drivers, but they all seem to need a low-side sense resistor, which I don't think I can use with the battery in situ. Commented Jun 22, 2023 at 17:10
• I think we do not need such a fast current regulation loop. With C10 included, soft ramping up the current and taking 10 samples per second we are on the safe side charging a NiMH cell.
– Jens
Commented Jun 22, 2023 at 17:16
• @Jens You're right, with C10 it should be possible to slowly ramp up as the current will be somewhat proportional to the duty cycle because of R25. Corrected! Commented Jun 22, 2023 at 17:24
• @AndrewMowry I was wrong about having to remove C10; as Jens suggested, keeping C10 will allow you to sample quite slowly as long as you ramp the PWM duty cycle carefully. (The current will fully settle during each sampling cycle.) Commented Jun 22, 2023 at 17:26
• Okay, thanks! Regarding R24, is adding a driver the only option? What lower frequency would allow me to drive the MOSFET directly from the MCU? Commented Jun 22, 2023 at 17:31