# Circuit to measure a 9V battery with a 3.3V logic microcontroller

Discussion in 'Analog & Mixed-Signal Design' started by ultegra, Jan 16, 2017.

1. ### ultegra Thread Starter New Member

Jun 27, 2014
4
0
Hello,
I need to measure the voltage of a 9V battery (that drives an electrovalve) with the analog pin of a microcontroller that works with a logic of 0V for LOW and 3.3V for HIGH. The microcontroller is powered by another 3.7V battery. It is imperative that the circuit to measure this voltage does not drain any current from the 9V battery. I had planned to do it with a mosfet transistor (see img01.jpg) but I can not find transistors with a minimum Vgs (th) of more than 6V. How could I do it? Thank you.

2. ### LesJones Well-Known Member

Jan 8, 2017
1,917
534
You could use a P channel mosfet and drive the gate with an NPN transistor.

Les.

3. ### ultegra Thread Starter New Member

Jun 27, 2014
4
0
Thank you Les! How would the NPN transistor be connected? I'm starting with analog design and my knowledge is very limited

4. ### LesJones Well-Known Member

Jan 8, 2017
1,917
534
The emitter of the NPN would be connected to the ground rail. The base would be connected to the digital out pin of the micro.The collector would be connected to the gate of the P mosfet via a resistor (Say 10K) . The gate of the mosfet would be connected to it's source by a resistor (Say 100K) The source of the mosfet would be connected to the + 9V and the drain to the top of the potential divider. You could use a small N channel mosfet in place of the NPN transistor.

Les.

5. ### ultegra Thread Starter New Member

Jun 27, 2014
4
0
Thanks again Les. First, there is an error in the circuit (img01.jpg), the drain and source pins are interchanged.
The circuit that you propose could be the one of the image img02.jpg?
In that case, I do not understand how the voltage at the gate will be able to rise high enough to switch the mosfet to saturation. I need a Vgs (th)>-5.5 V. Sorry for my ignorance.

6. ### LesJones Well-Known Member

Jan 8, 2017
1,917
534
It is correct except the top of R4 should go to the source of the mosfet.(Battery +9 volts.)When Q2 is not conducting R4 holds the gate to the same voltage as the source. When Qs conducts it pulls the gate voltage to about 8 volts negative of the source which will make the P mosfet conduct. (Think like it was an N channel but the voltages reversed.) Choose a P channel mosfet that will be fully turned on with 8 volts between gate and source. It will not work properly when the 9 volt battery gets below about 5 volts unless you can find a device with a very low trhreashold voltage.

Les.

ultegra likes this.
7. ### ultegra Thread Starter New Member

Jun 27, 2014
4
0
Thank you very much Les, now I have understood the circuit. I simulated it and it works fine but by drain pin drain about 100nA and by the Gate about 10 nA when the mosfet is cut off. This is too much for a 9V battery and about 200 mAh capacity. In about 75 days it would deplete the 9V battery even if it was not used. Maybe try something that is not possible.
I had intended to use a bilateral switch like this one (http://www.nxp.com/documents/data_sheet/74LVC4066.pdf) but also drains about 100 nA.

8. ### ScottWang Moderator

Aug 23, 2012
6,481
1,001
It seems the Rds of TP0604 is too big more than 2Ω(Vgs=-5V), so you need to find some other P ch mosfet with Rds less than 10 mΩ.

9. ### LesJones Well-Known Member

Jan 8, 2017
1,917
534
You could just use a good old fashioned relay.

Les.