How can I create a battery level circuit
Firstly, if I understand your schematic right, you're not "dividing" anything there. If the ringed red symbol is where you are connecting the ADC then either you will see near 4V on there (if it's only connected to the ADC), or 0V (if it's connected to ground).

You should be connecting the ADC between the resistors to get a reading.

Secondly, you should be using a P-channel MOSFET, not a PNP transistor. You can use a PNP transistor, but you will have to subtract the voltage drop imposed by the transistor from your calculations to get any meaningful reading. With a P-channel MOSFET, the on-resistance would be (or should be if you choose a sensible one) negligible compared to the resistance of the voltage divider.

You are right that you can't exceed 1V on the ADC, so you will have to size your resistors accordingly. You aren't restricted to just using a pair of 10K resistors - you can choose any values you like that yield the correct result.







simulate this circuit &ndash; Schematic created using CircuitLab

In this example, 10K and 2.2K give you no more than 0.9V from a 5V input. (Tip: choose an input voltage slightly higher than you expect to give a small safety margin).

I calculated those by:


Use the voltage divider formula R2 = R1×(1/((VIN/VOUT)-1)) to calculate the lower resistor (2500Ω).
Choose the next lowest "common" resitor (2200Ω)
Re-calculate the new output using the chosen resistor values using VOUT = (R2/(R1+R2))×VIN (0.9V)