3
\$\begingroup\$

My circuit has a battery charger and an ATMega88. The ATMega needs to sense the state of the battery charger - but if the battery is too low, the ATMega may not have power.

I know it's bad to drive a CMOS input more than 0.3V above VCC - you can power chips through the protection diodes, cause latch-up, etc.

I see three possible solutions:

1) Use a dual-supply bus transciever. http://www.ti.com/lit/ds/symlink/sn74lvc1t45.pdf This adds more cost than I'd like.

2) Put a 100K resistor inline with the signal, so that "not much" current flows into the powered-off circuit. I think this shouldn't cause latch-up or burn anything out, but could still power-up some circuitry and cause undesired operation.

3) Use divider resistors to step the signal down to <0.3V, and feed it into an ADC pin. This requires extra work and time to sense - and I'm still just a bit nervous about feeding any voltage/current into unpowered CMOS.

So I'm inclined to go with option 3, but hoping there's a better option I haven't thought of.

\$\endgroup\$
  • \$\begingroup\$ Why would the ATmega be unpowered even if the battery is too low? \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 5 '15 at 18:47
  • \$\begingroup\$ To protect the battery from damage, I have to turn off the LDO if the battery drains too far. Even with all chips in shutdown I'd be pulling about 100 uA from a 95% drained 150 mAh battery which would exhaust it in a few days - and I can't expect users to charge it right away. \$\endgroup\$ – ChrisPhoenix Sep 5 '15 at 23:20
5
\$\begingroup\$

The easiest way to deal with a digital signal like that is to feed it to a BJT or MOSFET with a pullup from the processor voltage. For example:

schematic

simulate this circuit – Schematic created using CircuitLab

The diode allows the input to go negative as well without damage to the processor or transistor. Brief spikes of +/-100V won't hurt anything, regardless of the processor power state. Cost is pennies, at most.

\$\endgroup\$
  • \$\begingroup\$ This looks like it inverts the signal - which is fine for my application, just want to make sure I understand. \$\endgroup\$ – ChrisPhoenix Sep 6 '15 at 6:00
  • \$\begingroup\$ Yes, it inverts the signal. \$\endgroup\$ – Spehro Pefhany Sep 6 '15 at 6:02
2
\$\begingroup\$

Would it be possible to add some circuitry so that the Atmega can be powered from whatever power source is supplying the battery charger? This is more complicated, and requires you to implement a "power path" solution where the batteries are disconnected from load while charging. But it eliminates the possibility of the Atmega being de-powered during charging.

Usually charger status outputs are open drain. If so, just pull up the output to the processor VCC. Then you don't have to worry about it.

Another option, cheaper and simpler than a transceiver, is a dual transistor (or two separate transistors) with one PMOS and one NMOS. See sketch below. When the M2 NMOS gate is high, charger output signal is connected to processor input. When M2 NMOS gate is low, processor input is isolated. Make sure the signal level is compatible. Also, if processor VDD is less than 3V, you will need to pick a different NMOS with a lower Vgs(th).

If desired, the NMOS gate could be driven by an IO pin instead of direct connection to VDD. But software would need to make sure to drive the gate high prior to reading the input. When the processor is de-powered, all its outputs will be low, so this is still safe in that situation.

Maybe you should post a link to the charger IC and tell us which status outputs you are monitoring so we can check if they are open-drain or not.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ On careful review of the datasheet (MCP73833) the "Power good" output is open-drain, but useless because it shouldn't be pulled above the input - which will often be disconnected. So I'll have to directly sense the USB VBus level. \$\endgroup\$ – ChrisPhoenix Sep 5 '15 at 23:35
  • \$\begingroup\$ I need to turn off the battery-supplied LDO if the battery goes too low. I guess I could add a second USB-powered LDO, with a diode downstream of it to keep current out when the USB was unplugged. But a resistor bridge seems simpler. I don't actually need the ATMega running during charge - I only sense charge state so I can turn it off when the charger's plugged in. \$\endgroup\$ – ChrisPhoenix Sep 5 '15 at 23:38

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.