Selecting different charge currents using one IO with low, high and HiZ state - Page 1
Forum section: electronics / beginners

author: Goature
author_rank: Contributor
timestamp: June 02, 2022, 01:18:54 pm
content: Hi!I'm working on a circuit where I only have one digital output left, but want to select between 3 charge currents.I'm using the BQ24020DRCR charger, which has an ISET1 pin. From my understanding it's a 2.5V source, and the current drawn selects the maximum charge current. Typically using a resistor, like this R_set = (320 * 2.5V) / RSo a 800ohm resistor gives 1A. A 8000ohm resistor gives 100mA.Is there a neat way to select between 3 different resistors (or currents) using a single 1.8V digital output line, that can push, pull and float (high impedance)?I was trying to make this work with a couple of resistors (pnp and npn), that each pulled their own resistor. And a third 8k resistor pulled the ISET1 pin directly to GND, so that a floating state gives 100mA. But the way I connected the transistors made them continously conduct (since the pnp could give bias current to the npn, etc etc.)Do you have any suggestions on a transistor topology that would allow this? Or something completely different maybe?

author: Ian.M
author_rank: Super Contributor
timestamp: June 02, 2022, 03:10:32 pm
content: It depends - what range of currents do you need?Driving the bottom end of the Iset resistor from the I/O pin reduces the effective Vref to 2.5V-1.8V (=0.7V) when the pin is high so gives you 28% of the max current (max. when its low). You can then add a pulldown to the I/O pin to set the current when its tristated, subject to the constraint that the resulting potential divider doesn't take the pin over 2V, limiting the third current to >20% of the max current. How close you can get to the max. current when tristated is limited by the min. pulldown resistance you can use as the Ioh of the I/O pin as the I/O pin must drive the pulldown to near 1.8V when the pin goes high to choose min. current.

author: Sauli
author_rank: Contributor
timestamp: June 02, 2022, 03:59:18 pm
content: Try to figure out what this givesIf you can output PWM to that pin, you can set any current limit you want.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 02, 2022, 04:58:41 pm
content: You may also have software-configurable pull-up and pull-downs. This gives you five choices! Not all might be usable, depending on internal pull-up/down resistor values and their tolerances, of course.Add a series resistor and work it out in Excel. Only Ohm's law needed.I did use this trick to adjust output voltage of a boost regulator, basically using normal feedback loop but injecting current to the 1.2V FB node, from IO pin, through a single resistor. One-component (0.001$ resistor) 5-step digitally controllable output voltage. (See attachment.)

author: Goature
author_rank: Contributor
timestamp: June 02, 2022, 05:27:02 pm
content: @Ian M. Good thinking! I will be able to get all the charging current I want this way (100mA, 500mA, 1A)I'm a bit concerned about having the 2.5V from the charger ISET1 pin going into the high 1.8V digital output. How do you think that will affect the circuit? The MCU i'm running is nRF52840. The current going into the output pin will be around 1mA. I guess it will affect the 1.8V line?

author: Ian.M
author_rank: Super Contributor
timestamp: June 02, 2022, 05:40:37 pm
content: As long as you satisfy the constraint that the potential divider doesn't let the tristate mode I/O pin voltage exceed 2V, you wont get much, if any of that 1mA going into the 1.8V rail. You wont be able to get the 10:1 range between 1A and 100mA by my method - the best it can do is 3.6:1.

author: Goature
author_rank: Contributor
timestamp: June 02, 2022, 06:40:47 pm
content: Had another go. Any comments on this circuit? Now I'm able to select 100mA, 500mA and 1A safely. A bit concerned about the variation/repeatability of those diodes at different temperatures.Falstad simulation:http://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxEOxCQBYqEBTAWjDACgAnEFGycMFN17d8UEZDYBzIXxR48MkNjRiJXHrNEbu8sRnhsASoryzhNBXz7CU0JFah2p1Adx4vB2q0Y-highFcwQgdrPjBoS1UnAGUQOk9RQMSovgAzAEMAGwBnBjEUNhylBBT45REoiEzchk4SsuxSnSr4CQB3BpbFOUs2TqbG5oE+gBMerV00BUEwADlsGjZx3squ6e5wBaW0rpGlSBpwOSVZu0dIQulcI7AaI5vwDEJVfpMzcNc1A9vXbVZBJo4GwAPZKChHMKkbjnGBwQgoeybKjYNhAA

author: Siwastaja
author_rank: Super Contributor
timestamp: June 03, 2022, 05:33:23 am
content: Quote from: Goature on June 02, 2022, 05:27:02 pmInternal protection diodes will conduct. Series resistance you will have to add will protect from damage. But this affects voltage levels: with diode from the pin to Vdd, pin is clamped to approx. Vdd+0.3V = 2.1V.Equivalent circuit is two voltage sources V1 and V2 connected together by R. V2 is always 2.5V.Assuming Rpu = 13k and Ppd = 13k (somehow I remember this is the case with nRF52, check the datasheet of course), and setting Rext = 13k as wellPin driven LO: V1 = 0V, R = 13kPin hi-Z with PD enabled: V1 = 0V, R = 26kPin hi-Z:, with or without PU enabled: V1 = 2.1V, R = 13k (protection diode conducts)Pin driven HI: V1 = 1.8V, R = 13kOf course, re-check my thinking.