0
\$\begingroup\$

First post here from a hobbyist electronics guy so please bear with me. I'm happy to do whatever I can to improve my question for the community.

For a bit of a backstory, I have a project that requires an RTC for a Raspberry Pi. I need the RTC to be thin, at least thinner than most modules you can buy, and I want to be able to read the voltage of the battery so I can get a warning if the voltage gets low before it fails. So, I designed a board using the DS3231M for timekeeping and an ADC with a voltage follower to read the voltage without affecting the battery current draw much. The Op Amp is an LMC7101BIM5/NOPB and the ADC is an ADC081C027CIMK (see URLs below).

Here is the schematic, board layout, and zip'd eagle folder for reference: RTC Schematic and Board Eagle Files

When the board is attached to the Pi it works great; I can read the clock and can read the voltage from the battery through the ADC/voltage follower. But when I disconnect it with the battery in, the OSF gets tripped. I used this basic design for another RTC (without the battery voltage reading) so I'm sure the battery is connected fine. I used my multimeter and it turns out that while the battery reads ~2.8V when the Pi is on the voltage is <2.4V when power is removed.

My thinking is that it has to do with the Op Amp. I cut the trace connecting the battery to the voltage-reading circuit and the voltage went back to ~2.8V so my thinking is that it's a problem with the Op Amp implementation. I assume that it has to do with me operating under the assumption of an ideal Op Amp. I thought maybe the battery was attempting to power the circuit through the Op Amp, drawing too much current, and dropping the voltage. So I solder-bridged the trace I cut earlier, cut the trace to the Op Amp supply, and soldered in a diode (I don't care about the voltage drop as long as I can still "see" a voltage drop to give a low-voltage warning). This helped a little, but the voltage is barely >2.4V and the current is only somewhere around 1 mA.

Any help is appreciated, even if it's just about my schematic/board layout.

Also, it would kind of suck to switch designs at this point, but i think there may be battery ICs that handle this kind of thing. Would it be worth it to switch to something like that?

I can't post more than two links, so I'll post the component URLs as comments.

\$\endgroup\$
3
\$\begingroup\$

the problem is not the op-amp per se, but engineer's assumption of how the input and output pins of ICs behave when power is not applied to that IC.

Many engineers do not know that there are either ESD protection diodes or parasitic diodes (or both) at input and outputs of ICs. Datasheets do not make this obvious. Take a look at this article.

Thus, when VCC is removed from your ADC and opamp, there is a diode path from VBATT to the VCC net due to the ESD diode inside the opamp IC. Nearly all ICs will have this architecture. Go ahead and measure VCC with the connector removed and you will find it is about 1 diode drop below the VBATT voltage. This means your coin cell is powering the ADC and opamp when the connector is removed! That is why the coin cell voltage is drooping.

The simplest but a bit cheesy solution is to put say 100k resistance at the opamp IN+. This will reduce the current pushed into ADC and opamp. It would be about (2.8V - 0.6V) / 100k = 20 microAmps. It would increase the ADC error by whatever the input bias current of your opamp is times the 100k series resistance, and this would still be extra current draining your coin cell.

A better solution would be to use a small MOSFET to disconnect the opamp input whenever VCC is disconnected. But this would add 2 transistors and some resistors. I can sketch up a circuit if you want.

There really is not a simple, easy solution (other than the series resistor). It is actually quite a design challenge when you do this type of "hot swap" circuit, where you have to switch power to your circuit to different supplies on the fly or you have to handle non zero inputs even when power to your circuit is removed.

Hope that helps, -Vince

\$\endgroup\$
  • \$\begingroup\$ An interesting article. Your comment reminded me that I saw an excellent video about just this a while ago from EEVBlog: link. One of the issues is that it is so difficult to find these diodes mentioned in documentation. And I knew they may be used in certain ICs, but didn't realize they would be in an Op Amp. Thanks! \$\endgroup\$ – James Peterson Jun 22 '16 at 2:16
  • \$\begingroup\$ And earlier I had measured the voltage on Vcc and it was indeed somewhere around .6V (I think), right around where you might expect a diode drop to be. \$\endgroup\$ – James Peterson Jun 22 '16 at 2:23
  • \$\begingroup\$ Yup, good video. Actually, just about all IC IO pins (digital and analog) have this characteristic. In CMOS ICs, IO need to be protected from ESD (static discharge). A CMOS transistor's gate oxide is very voltage sensitive. This is not a problem with bipolar ICs but the normally reversed transistor junctions get forward biased when you drive inputs below GND or above VCC. Datasheets will only say do not drive inputs above say VCC+0.5V or go below GND-0.5V but won't explain why. \$\endgroup\$ – Vince Patron Jun 22 '16 at 3:08
  • \$\begingroup\$ I don't think I want to add the MOSFET to this revision board but I think it would be very helpful for future revisions. Could you possibly sketch up that circuit? \$\endgroup\$ – James Peterson Jun 22 '16 at 14:32
  • \$\begingroup\$ For this revision, I think I'm going to go with a resistor on the order of 10M Ohms. There's a convenient spot for it and the input bias current is typically around 1 pA for this Op Amp, so the offset should be nearly negligible. Thanks again! \$\endgroup\$ – James Peterson Jun 22 '16 at 14:54
0
\$\begingroup\$

Here's an alternate solution we had discussed, a circuit to disconnect VBATT from the opamp input when VCC is not applied. For the P-channel MOSFET, just pick a small low power one that has low threshold voltage to make sure 3V turns it on completely. Note that very low VBATT will not turn on the MOSFET so it limits how low a voltage you can measure. -Vince

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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