# Voltage divider in combination with pull-down resistor

I am working on a project using the Attiny13 and a simple push button. Since I power the whole circuit with a 3.7V 18650 battery, I have to use a voltage divider to make it safe for the Attiny whenever the push button is pressed (the Attiny can only handle 3.3V on the input pins, but the battery voltage can go up to 4.2V).
For the divider however, I use a 100kΩ and a 300kΩ resistor to create a voltage of 1.88V (when the battery is nearly empty) and 3.15V (when the battery is full). Here is my schematic: I am wondering why there is only a voltage of around 0.4V at the Attiny's input pin when I press the button. I guess that the pull-down resistor is too small (at least compared with the two from the voltage divider) and if the button is pressed, all the current (and so the voltage) are going to GND instead of flowing through the Attiny. So, in order to make the circuit work as it should I have to either change the pull-down resistor to a bigger value or change to two resistors from the voltage divider to a much lower value (like 10Ω and 30Ω).

So my questions are:

1. Is my theory why this circuit behaves "weird" right?
2. If yes, should I use a pull-down resistor with a higher value OR a voltage divider with lower resistance?
3. What is the biggest possible pull-down resistor in this scenario?
• Are you using an LDO? The Attiny13 can handle inputs as high as the power supply voltage Vdd (plus a bit) and that can be as high as 5.5V. Can you supply a schematic? In any case, just pull up to the Vdd of the chip. Dec 19, 2020 at 18:12
• According to microchip's website the Attiny13 can work upto 5.5V, so it can be powered straight from the battery. Then it'll also safely allow that same voltage on it's inputs. Dec 19, 2020 at 18:12
• Ah, I didn't know that. But nevertheless please answer my questions ;). Sorry for the schematic, but when I upload it, it don't show up Dec 19, 2020 at 18:21
• If you really needed a voltage divider for the pushbutton you don't need an extra pull down resistor. You simply connect the middle point of the voltage divider to the Attiny input pin and feed the voltage divider trough the pushbutton. The bottom divider resistor acts as pulldown when the button is not pressed. Dec 19, 2020 at 18:43
• We should really see that schematic first before confirming that. Dec 19, 2020 at 19:08

Let's redraw the schematic in a more common form: simulate this circuit – Schematic created using CircuitLab

When the switch is closed, R3 and R2 are placed in parallel. Calculating the resulting total resistance gives us: $$Rparallel =\frac{R2 * R3}{R2 + R3} = \frac{300k * 10k}{300k + 10k} \approx 9677 \Omega$$

The voltage divider output voltage then becomes: $$Vout =\frac{Rparallel}{R1 + Rparallel} * Vin = \frac{9677}{100k + 9677} * 4V \approx 0,35V$$ Which is approximately the 0,4V you observed. So yes, your theory is correct.

However, according to the microchip website, the Attiny13 can work safely upto 5.5V. So you should be able to run it straight from the battery and it's inputs will always be able to safely accept voltages that lie within the supply voltage range.

In case you still want a voltage divider on the input, you do not need a separate pull down resistor. The bottom resistor of the divider will act as a pulldown when the button is not pressed if you feed the entire voltage divider trough the pushbutton: simulate this circuit