0
\$\begingroup\$

I need help/suggestions for the implementation of my schematic:

  • In the schematic image pasted below, particularly look only at the charging IC, boost converter, analog switch, and ATTiny 1616 controller part.

  • I have a push switch with an LED. I want this LED to display the charging status and the battery's critical level (it remains ON when charging and should blink when the battery is critically LOW.)

  • Here's the problem for which I used the analog switch: The CHG pin of the charging IC can control the LED when charging (remains ON when charging and OFF when charge is completed.) this will also happen even when the device is OFF using the En pin of the converter (therefore the controller is OFF.)

  • When the device is ON and the charger is disconnected, I want the control of the LED to shift to the digital pin of the ATTiny1616, which would blink when the battery is LOW. Even if at this point the charger is connected (the device is ON,) the control of the LED will shift again to the CHG pin of the charging IC. This switching is being done by the analog switch (https://www.lcsc.com/datasheet/lcsc_datasheet_2005271036_Diodes-Incorporated-74LVC1G3157FZ4-7_C526344.pdf).

  • I need help on whether this is a viable solution.

enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ Unrelated to your question - Rules and guidelines for drawing good schematics \$\endgroup\$
    – Lundin
    Commented Jul 4 at 6:16
  • 1
    \$\begingroup\$ You probably could, but perhaps it would be easier to not drive the LED directly from the charger IC but rather steal that signal and use external OR or AND gate. If you have pins to spare on your MCU, perhaps even just route it to your MCU directly and have your logic there and drive the LED from your MCU? \$\endgroup\$
    – winny
    Commented Jul 4 at 7:45
  • 1
    \$\begingroup\$ You need to ensure that under all possible conditions (including transient conditions) Vcc for the analog switch is always is high or higher than A, B0, B1. At most a few hundred mV less. \$\endgroup\$ Commented Jul 4 at 9:10
  • 1
    \$\begingroup\$ If the MCU is off, then your options are external logic or analog switch arrangement. \$\endgroup\$
    – winny
    Commented Jul 4 at 9:52
  • 1
    \$\begingroup\$ @SpehroPefhany it switch is powered by battery (1s LIPO). LED is also running from this source and since the switch controls the LED I don't think A, B0 or B1 would be higher in any case. \$\endgroup\$ Commented Jul 4 at 11:26

1 Answer 1

0
\$\begingroup\$

The CHRG pin on your battery charging chip is an open collector output. This means you can connect it directly to a GPIO pin on the ATTINY. If you enable the internal pull-up on that pin you can then directly read the state of the charger IC. Now you can connect the LED to another pin on the ATTINY and use logic in the ATTINY to make the LED so whatever you want based on the state of the charger and any other inputs you want to consider.

Here is a very similar circuit I did for a consumer electronics device where the LED does a pretty "breathe" heartbeat while the charger is attached and charging, a solid "on" when battery is full, and several blink patterns to indicate battery charge level during operation. You can also use other blink patterns to indicate other interesting conditions to the user. Note that on my battery charge controller, the state feedback pin is called STAT2, but is is also an open collector output and basically works the same as the one on your IC.

enter image description here

On an unrelated note - you probably can connect the ATTINY directly to VBAT rather than the output of the boost since it can happily run down to 1.8V. Since the ATTINY has such amazingly low sleep currents, you can just have it always sleeping except when something interesting is happening. It can then also disable the boost IC when it is not being used which will greatly reduce the continuous load on the battery. And while you are at it, do you really need to boost to 5V? Maybe you can use a lower voltage motor and then let the ATTINY PWM the motor to keep its power continuous over the full battery voltage range (see my article on how to measure the battery voltage internally).

\$\endgroup\$

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