Hi, I'm playing with a low power project which runs on 3V3 supplied by AA batteries. I would like to measure the battery voltage via a voltage divider and analogRead(); but to keep the power drain down switch the voltage divider off between measurements. So my question is..... is it better to switch using a P channel enhancement mosfet so that the MCU pin is HIGH to switch off or an N channel enhancement mosfet so that the MCU pin is LOW to switch off? I've been using what I have which is a BSS84 (Pâchannel enhancementâmode fieldâeffect transistor) - OFF with MCU pin HIGH...... but suspect I might have to use something else.
Most people just use a very high impedance voltage divider (e.g 10Meg), with a 10 nF capacitor from voltage divider tap to ground, and live with the 330 nA current drain.
For other advice, tell us more about your project.
Thanks jremington, Its nothing too exciting - a temperature sensor logging to an SD card but I would like to try and get the best battery life I can, partly just out of interest. I remember talking to someone about a high resistance voltage divider to do this and they recommended a switching version so I thought I would try The circuit currently looks like this.
The voltage divider is the least of your problems.
The SD card is very power hungry when active, and many beginners make the mistake of opening the file, writing one line of data, and closing it again, for a thousand-fold increase in average current consumption and error rate.
Thanks folks, I guess what I'm hoping to find out is which transistor type might be best used for low power switching which could be used to switch the periferals on a mattery powered device, including SD card, as required? I'm taking a stab at an Enhancement mode N type Mosfet but I don't have enough experience to know if this is correct or not
You'd have to find a MOSFET that will switch fully on with only 3.3V on the gate.
The analog input of the AVR (chip on an Arduino) has a very high input impedance. It is commonly said that you should drive the analog inputs with no more than 10k source resistance. However, this is because there is an internal capacitance that must be charged when switching from one analog input to another.
If you do as @jremington suggests, the 10nF capacitor will charge that internal capacitance quickly. 20M ohms will have a negligible effect on battery life as that is about 165nA at 3.3V. If you switch this on and off, it will take about a quarter of a second to stabilize. If you just leave it connected, it will always be ready.
"23.6.1Analog Input Circuitry The analog input circuitry for single ended channels is illustrated in Figure 23-8 on page 212 An analog source applied to ADCn is subjected to the pin capacitance and input leakage of that pin, regardless of whether that channel is selected as input for the ADC. When the channel is selected, the source must drive the S/H capacitor through the series resistance (combined resistance in the input path). The ADC is optimized for analog signals with an output impedance of approximately 10kď or less. If such a source is used, the sampling time will be negligible. If a source with higher impedance is used, the sampling time will depend on how long time the source needs to charge the S/H capacitor, with can vary widely. The user is recommended to only use low impedance sources with slowly varying signals, since this minimizes the required charge transfer to the S/H capacitor. Signal components higher than the nyquist frequency (fADC/2) should not be present for either kind of channels, to avoid distortion from unpredictable signal convolution. The user is advised to remove high frequency components with a low-pass filter before applying the signals as inputs to the ADC."
Thanks folks, much appreciated. I am still experimenting and learning and will try all of these things. Currently I've found that switching the power to the 10K voltage divider saves about 1mA, I will try with some higher values too and see what happens. Cheers.