ESP8266 and battery charge control MCP73871 - Page 1
Forum section: electronics / general

author: Kp91
author_rank: Newbie
timestamp: September 28, 2023, 04:23:58 pm
content: Hi everyone,I'm still not very expert and would like to have a double check of my design before fabrication (to avoid losing time and money). Hope you can help me with thisThe circuit (attached in .pdf) includes a simple ESP8266 module, connected to three LEDs and a buzzer, an analog pressure sensor, a battery charge control module and an I2C battery gauge.They are connected as follows:pressure sensor ADCbuzzer GPIO14battery charge control (MCP73871) GPIO12/13battery gauge SCL GPIO5battery gauge SDA GPIO4LEDs GPIO0/2/5The circuit also includes a battery management part, with a battery charge control unit (MCP73871) and a 3.7-3/3V buck-boost regulator (TPS63051RMWR).My doubts are:1. Can I use the GPIOs listed above for this purpose, even if some of them are normally involved in the board programming process? e.g., GPIO0 and GPIO2.2. Is a buck-boost regulator rather than an LDO linear regulator the right choice for this application?3. Are the input pins of the battery charge control unit (MCP73871) well connected to VUSB and ground? According to the datasheet, they should be set as follows:SEL = 0 (power from USB)PROG2 = 1 (USB max 500mA)nTE = 0 (timer enable off)CE = 1 (charge is enabled)Thanks a lot

author: globoy
author_rank: Frequent Contributor
timestamp: September 28, 2023, 05:51:38 pm
content: I think GPIO0 should be ok.At least for ESP32, Espressif recommends 1uF cap on nRST to ensure correct timing (I've seen it fail with 0.1uF due to USB UART driver timing on nCTS and nDTR). Don't know about the ESP8266 but I'd check their recommendations.The MCP73871 requires some capacitors on input, battery and output rails for stability that you don't have (see section 6 in the spec). Usually VPCC is configured using a pair of resistors so the part can limit current correctly. Depending on which variant you are buying you might consider enabling the timer as a safety feature for the battery.Not sure why you are tying the USB frame to ground using 33k resistors. I suppose this is yet another hotly debated subject but I usually just directly tie it to ground.TPS63051 is fine for PSU, especially if this is a one-off. But you could probably get by with a low-dropout linear regulator since you should probably be killing power to the system when the battery is 3.5V or so which would work fine with some linear regs. If you want to run the battery down even further than this is good solution. Actually what are your plans for a very low LiPo? Just let the in-cell protection circuitry kill power? This might be ok if that doesn't happen a lot but usually draining the battery to the levels those circuits trigger is hard on the battery.Not quite sure why you are using 12k resistors for some pull-ups. Not that it is a problem but you're also using 10k resistors elsewhere (e.g. on PROG3). Why not just use 10k everywhere and save yourself another part number?I'd check ADC input current requirements since you're using fairly high voltage divider resistors. Maybe you should add a cap on the input if the input doesn't vary that quickly.

author: Kp91
author_rank: Newbie
timestamp: September 29, 2023, 04:28:15 pm
content: Thanks @globoy for the quick and detailed response.I've always seen 0.1uF capacitors on ESP8266 datasheets and schematics, although the reset button has never worked in my past implementations, maybe that's why. That's very good to know.I added the capacitors to the MCP73871 and the voltage divider to VPCC. I might add the timer too, but I've noticed it is often activated also after times shorter than 4hrs (I suspect this is related to temperature faults). This makes the battery recharge much slower and sometimes the recharge seems to stop forever.You're right, the USB frame should be just tied to ground, I think I've taken the two resistors from some past projects and, since it was working, I didn't question myself too much.As for the PSU, my plan is actually to use the most reliable solution that allows my board to live the longest, that's why I opted for the TPS63051 buck-boost. Making the battery last longer is secondary, although I'd like to achieve a duration of 24hrs by using a 1200/1500mAh LiPo.I use both 12k and 10k resistors multiple times in the circuit, so I don't think I would save a part number anyway, as some 12k resistors are also suggested by the datasheets themself. Unless I replaced all the 12k with 10k, also for the nCTS and nDTR?I selected those voltage divider resistors cause I needed to optimize the signal resolution by only considering a smaller part of the full range. In my application, the sensor never acquires a value above 50% of its full range, so I don't think there will be any risk. However, I'll double-check this too, just in case.