# SparkFun Forums

### Controlling voltage on pull-up input pin

Have questions about a SparkFun product or board? This is the place to be.

### Controlling voltage on pull-up input pin#199495

By irwinr
#199495
Hello,

I have a problem that I initially thought would be easy to solve, but after hours of researching I'm coming up a bit stumped.

I have a multi-cell (16 cells in series, 48v) lithium battery that is monitored by a BMS. That BMS controls a battery charger. The BMS and charger are purchased separately and are different brands but both units include "standard" ways to interface with each other:

1.) The BMS offers an output signal that can vary a voltage (in reference to ground) between 0v and 5v. This signal is meant to tell the charger how much current it's allowed to push into the battery. 5v = 70 amps, and 0v = 0 amps with a linear progression in between (IE: 2.5v = 35 amps, etc)
2.) The charger offers an input that (in the manual) states it can "read" a voltage and use that voltage to set the charger current. IE: 0v = 0 amps, 2.5v = 35 amps, and 5v = 70 amps.

This should be a piece of cake right? Just connect the output from the BMS to the input on the Charger and problem solved.... Or so I thought.

After getting my hands on the charger: I come to realize that the "input pin" is actually read using a pull-up resistor tied to a 5v voltage source inside the charger itself. The charger then reads the voltage on this pin and views 5v as "pulled high" and if you connect that pin to ground it's "pulled low" to 0v. They expect you to connect a potentiometer between the pull-up pin and ground to then adjust the "pulled-up voltage" between 5v and 0v based on the resistance of the potentiometer.

So: I need a way to use the voltage from my BMS to control resistance between the input pin on the charger and ground. So that when the BMS is pushing out 5v, the resistance between the chargers input pin and ground should be very high, leaving it floating at 5v, and when the voltage on the BMS goes down I want the resistance between the charger's 5v input pin and ground to decrease so that it's "pulled down" to about the same voltage as the BMS.

I'm thinking a simple transistor might be able to accomplish this, with the charger input pin tied to the base, the BMS output tied to the collector and the emitter connected to ground. In theory this arrangement would make it so that anytime the voltage on the charger's input pin was higher than the BMS: The base voltage being higher than collector would drop the resistance until the base and collector are very close in voltage right?

I think I can also configure the charger to operate on an inverse voltage ramp and make it so 0v = 70 amps and 5v = 0 amps. In this case I wonder if I could use the same transistor but tie the BMS output to the base and the charger input pin to the collector and make it so when the BMS is at 5v the transistor is effectively saturated pulling the chargers input pin down to 0v, and when the BMS output drops to 0v the transistor goes into cut-off mode and allows the chargers input pin to float high.

I have very little experience building circuits with transistors, so I'm hoping someone can tell me if this arrangement will work (And if so, what specific transistor should I use) or if not: Is there a better way of solving this problem?

Thanks,
-Jeremy

### Re: Controlling voltage on pull-up input pin#199600

By declanshanaghy
#199600