1
\$\begingroup\$

So, I built this simple circuit for measuring voltage from a battery pack to an Arduino.

The thing is, I want to measure the first cell and then the voltage from the whole battery pack: using two transistors for changing the voltage divider input (check the image so that you know what I mean.)

I do not want to apply a constant load to the battery, that's why I'm using transistors to turn on and off the voltage divider circuit.

Here's the circuit:

Simple circuit for measuring the battery pack voltage

I'm using a simple calculation when reading from pin A0: 0-1023 (analog range) reading to 0-25 volts (as the voltage divider is at a 5:1 ratio.)

My question isn't about the code. Here's the situation:

When both transistors are off, I get a 0 Volts reading (as it should).

When the first transistor is on, and the second is off, I get a ~4.2v reading (as it should.)

The problem is when the second transistor is on (and the first is off). I get the SAME reading (~4.2v) instead of 8.4v (the whole battery pack voltage.)

Adding diodes between each collector and the voltage divider for protection didn't alter my results.

I'm really confused about this.

UPDATE Note: Each battery cell is rated at 4.2v.

Real Schematic:

Real Schematic

\$\endgroup\$

closed as unclear what you're asking by Elliot Alderson, Voltage Spike, Finbarr, Bimpelrekkie, Dmitry Grigoryev Apr 11 at 9:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    \$\begingroup\$ Please add a schematic. A wiring diagram doesn't count and is nigh-impossible to understand. That said, you seem to be using BJTs for this. BJTs are not suited for this use due to their saturation voltage. \$\endgroup\$ – Hearth Apr 6 at 22:21
  • 1
    \$\begingroup\$ Also... can the arduino survive 18V input? even if it can survive it why are you using it? It doesn't need more than a little above 5V, say 7V. \$\endgroup\$ – Hearth Apr 6 at 22:33
  • \$\begingroup\$ It's not 18v, i know in the image i'm using 9v batteries but in reality it's a Li-po battery pack. (As i said above the 9v batteries). \$\endgroup\$ – John Sockert Apr 6 at 22:38
  • \$\begingroup\$ Is there any way i can make that circuit work? Maybe changing those bjts for power transistors like a MOSFET? \$\endgroup\$ – John Sockert Apr 6 at 22:39
  • 1
    \$\begingroup\$ What you want to do can be done with MOSFET's. But you have to post a real schematic so we can figure out what you actually did without looking up everything, including whether BC548 is NPN or PNP, etc. Then someone should be able to suggest a minimal change that will work. You might also try googling this. It is a common problem, how to use a divider to sample a high voltage but disable the divider when you don't want to load the voltage. Usually I use an NMOS to switch the gate of a PMOS which is pulled up to the high voltage (battery or whatever). \$\endgroup\$ – mkeith Apr 6 at 22:43
3
\$\begingroup\$

The issue is that you're using a low-side switch configuration in a high-side switch application. You can keep most of what you have if you just change to a high-side switch using PNP instead of NPN transistors. Something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Thank you for your help Heath! I really appreciated it! \$\endgroup\$ – John Sockert Apr 8 at 5:36
  • \$\begingroup\$ At first glance I think this will work. But if good accuracy is required, Q1 and Q2 could be replaced with MOSFET's to avoid the collector-emitter drop. And those diodes will drop voltage, too. It might be best to reconsider a few parts of the circuit unless great accuracy is not required. \$\endgroup\$ – mkeith Apr 8 at 7:46
0
\$\begingroup\$

Your problem is that the emitter voltage on the transistor can't go higher than the base voltage.

You're measuring the base voltage, minus two diode drops, not the collector voltage.

You could try using an "analog switch" or "analog mux" IC instead of a single transistor. Pay attention to the allowed voltage range for the signal pins.

\$\endgroup\$
0
\$\begingroup\$

enter image description here

Figure 1. Circuit from OP.

This won't work. Your transistors are wired as voltage followers. The emitter voltages will be about 0.7 V below the base voltage. This is confirmed by

When the first transistor is on, and the second is off, i get a ~4.2v reading (as it should.) The problem is when the second transistor is on (and the first is off). I get the SAME reading (~4.2v) instead of 8.4v (the whole bpack voltage).

The emitter of either transistor can't go above about 4.3 V.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. A simple solution using two analog inputs.

This will reduce the voltage by a factor of two on each measurement input.

\$\endgroup\$
  • \$\begingroup\$ "I do not want to apply a constant load to the battery, that's why i'm using transistors to turn on and off the voltage divider circuit." \$\endgroup\$ – Ben Voigt Apr 6 at 23:25
  • \$\begingroup\$ OK, but do you understand now why your circuit doesn't work (which is the title of your question)? \$\endgroup\$ – Transistor Apr 6 at 23:54
  • \$\begingroup\$ Thanks, @Ben. It's also helpful if I don't try to respond to comments using my phone just before I fall asleep in bed! \$\endgroup\$ – Transistor Apr 7 at 8:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.