Today's Deals (in


transistors - Zero or low-current voltage divider for switch identification
  • n.taco

    Is it possible to design a voltage divider circuit with switches that uses zero current, or very low current? Would it work to use a transistor to connect/disconnect the end of resistor string from ground?


    The circuit will do two things. Each switch in the circuit will wake up a IC (ATMEGA328P) by using a transistor to send an interrupt pin LOW. Once the IC wakes up, the ADC will sample the voltages coming from the circuit, allowing the IC to know which button was pressed.

    The entire project will be battery operated, and having this voltage divider may significantly impact battery life.

    The project will 1) read files from an SD card, 2) go to sleep, 3) wake and play sounds when one of 16 buttons is pressed, and 4) go to sleep and repeat process starting at #3 on button press. I anticipate that when it is running it have a significant current draw.

    Existing Voltage Divider Circuit

    enter image description here

    Possible Transistor Solution

    Placing a transistor between the end of the resistor string and ground, and having the button press activate the transistor, connects the end of the voltage string to ground. This will result in an initial voltage reading of 5V, and once the transistor is on, the actual read voltage will be the intended voltage. I have no idea if this will work.

    possible voltage divider circuit with transistor

    Other Solutions

    Per question 28897 I could use high values of resistors such as 10 MOhm. But this will still have a current draw of hundreds of nA. I'd prefer zero.

  •  Answers:

  • Nick Alexeev

    New answer

    Your approach can work. But, your 2nd schematic has a bug, I think. The ADC will always see Vbe of the transistor, which is always 0.7V or so.

    This variation shouldn't have this problem, because there's a resistor R39 between base and ADC.

    enter image description here

    Old answer, which wasn't an answer

    The divider can be switched with a transistor to save the battery. However, it has to be a high side switch. If you switch at the ground, then the battery voltage will appear on the A/D pin, which could damage the input.

    (Originally, the schematic was posted in this thread.)

  • pjc50

    You don't even need a transistor to disconnect the resistor string, you can just connect it to an MCU output pin. Set it to the same value as the other end of the string, and it will use near-zero current. I have used this approach and it works fine.

    (In your diagram, give the transistor its own ground and connect the MCU pin to the bottom of the resistor string).

  • Alfred Centauri

    Is it possible to design a voltage divider circuit with switches that uses zero current...

    This should do the trick and no ground switching required. A divider is connected to the battery only when a switch is closed and the ADC input is pulled to ground when all switches are open.

    For 5V Vcc, the ADC input is:

    • 5.0V = SW1 closed
    • 3.3V = SW2 closed
    • 1.7V = SW3 closed
    • 0V = all switches open

    Of course, you can adjust the resistor values to your liking.

    enter image description here

  • supercat

    Given two I/O pins with reasonably-consistent switching thresholds, one could wire a grounded cap to each processor pin via small resistor, tie one cap to each end of the resistor string, and have each switch connect a tap on the string to VDD or ground (whichever is more convenient; I'll assume VDD for this discussion). Have significant resistance between either end and the first switch. Sometime when no switch is pushed, ground both pins long enough to discharge the caps; then float one and set the other to VDD. Time how long it takes for the floating pin to change state. If the inputs' thresholds might differ, repeat the test for the other input. Then ground both pins, and then float them--this is the idle state.

    Once a pin has been observed to change state, ground both pins long enough to discharge the cap, and float them. Time how long it takes for each pin to change state. The ratio of this time to the baseline measured above will tell you the resistance from each pin to VDD. Ensure that the sum of the two measurements is reasonably close to the total resistance of the string (otherwise the button isn't making good contact, so the reading may be faulty).

    If the processor may draw excess current when inputs are floating away from the rails, it may be a good idea to periodically discharge the caps even when no button is pushed. If this is done, quiescent currents for the system should be pretty minimal.