I've designed an AtTiny85 based Lithium-Ion battery protection/boost circuit that monitors the battery voltage and cuts the battery power to the external powered circuit when the battery dips below a predetermined voltage. The battery monitor part of the circuit is working well but I also want to monitor and display (on an optionally attached I2C LCD) the output voltage of the DC/DC boost converter. To monitor the output voltage I am using the voltage divider (R1 and R2).

enter image description here

I'm using an internal measurement of the ATtiny85 to monitor the battery voltage (measuring the 1.1v bandgap voltage using Vcc as a reference) which works well and is fairly accurate. The problem is with measuring the Boost Converter output voltage. Through much head scratching and hair pulling I discovered that the reason I can't accurately measure the Boot Converter output voltage is because the Boost ground is not the same as the battery ground. (i.e. MOSFET drain verses MOSFET source). Depending on the battery voltage there is anywhere between 180mV to 250mV difference between the drain and source side of the MOSFET pins (when the gate is on). Since the AtTiny85 is grounded on the source side of the MOSFET, the ADC measurment on PB3 is biased by the drain side of the MOSFET in a non-linear fashion. If I move the ground side of R2 over to battery ground I can accurately measure the boost output voltage but with a couple of undesired results. One being the voltage divider will continuously drain ~500uA of current, even after the MOSFET is switched off. The second undesirable effect is that for some reason, the boost output voltage will drop to about 3V when the battery voltage approaches around 3.2V.

When R2 is grounded to the MOSFET drain (as in the schematic) these issues do not occur but the boost voltage measurement is off by ~0.5 to 1.2V.

So, my question is how to accurately measure the boost output voltage without the negative effects described above?

Additionally, what is the a voltage difference between the MOSFET drain and source when the MOSFET is switched ON? I don't see anything in the datasheet (that I understand) which accounts for this drop.

For reference the load on the boost converter in my test setup is the LCD (with backlight) and an ~100mA LED laser.


2 Answers 2


I would make another measurement at the transistor drain and subtract and subtract.

A MOSFET is not like a mechanical switch; it is not simply "on" or "off". The drain-source voltage depends on the magnitude of the voltage on the gate as well as the drain current. The datasheet probably provides graphs of this relationship, but only the typical characteristics will be shown. The datasheet probably will not provide information you can use to accurately predict the drain voltage...there is just too much variation in parts.

By the way, you have two resistors marked R1 in your schematic...how does that happen?

  • \$\begingroup\$ Two R1's? Wow I'm surprised Eagle let me do that. \$\endgroup\$ Commented Oct 6, 2018 at 23:00
  • \$\begingroup\$ I've measured the actual boost output voltage (with a multi-meter) verses the value read and scaled from the AtTiny85 ADC over a wide range of Vbat inputs. The output Voltage is a consistent 5V while the ADC readings measure it to be anywhere from 4.9 to 7V. If it were a linear or even predictable relationship I could just use a table to adjust the voltage reading. The ADC reading verses actual voltage is more like a random value. \$\endgroup\$ Commented Oct 7, 2018 at 0:14

A Diff Amp can easily measure the battery voltage converted to any 0V reference.

However this choice of FET with Vgs(th)=Vt of 2.5 max does not meet the criteria for a good choice with Vgs> 2.5 to 3x Vt , worst case threshold for Vt with a Vbat from 3.1 to 3.8

I just noticed you do not show any inductor or just diode in your schematic. Is it working with long wires?

Considering it is designed for 2A with suitable heatspreader and 10W out is reasonable for USB, why make it impossible to monitor and avoid giving design criteria? (Specs)

I suggest you follow the recommended design if they meet your criteria and monitor the Vfb on pin 3, which is the ratio scaled of output @ 5V


These are also dirt cheap to buy.

  • \$\begingroup\$ The AtTiny85 actually has a Diff ADC/Amp but I don't have enough pin's available to use it. Pin 1 (RESET) can be reprogrammed via fuses to be used as an I/O pin but I don't have the high voltage programmer needed to deal with that scenario. \$\endgroup\$ Commented Oct 6, 2018 at 23:04
  • \$\begingroup\$ A tiny SOT23 RRIO Op Amp can convert the diff signal to single ended. Or use INA. But pls review your FET choice \$\endgroup\$ Commented Oct 6, 2018 at 23:07
  • \$\begingroup\$ I don't understand the issue with the FET choice. The datasheet says +-20V for Vgss (Gate-Source Voltage) and 1.0-2.5V for Vgs(th) (Gate Threshold Voltage). What is out of spec? \$\endgroup\$ Commented Oct 6, 2018 at 23:55
  • \$\begingroup\$ Sorry if it's not clear in my schematic but the boost section is an arduino module which is likely wired similar or identical to the schematic you've linked. \$\endgroup\$ Commented Oct 6, 2018 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.