Scalable low power DIY "smart" BMS, with math and configurable parameters. - Page 1
Forum section: electronics / projects

author: Refrigerator
author_rank: Super Contributor
timestamp: July 22, 2023, 04:11:14 pm
content: Some time ago i developed a very simple circuit that performs differential measurements of cells in a cell stack.This circuit is also internally temperature-compensated, has exceptional noise immunity and consumes close to zero current when not used.It is also infinitely scalable, only limited by the maximum voltage of transistors used.And the circuit can be multiplexed into a single output, meaning that the measurement of any number cell stack can be done with a single ADC channel.This nifty little circuit was developed with the idea of building a DIY BMS, that is low cost and can be custom configured for the battery pack it's used with.Also, since the BMS would have a microcontroller, some more advanced features could be implemented, like serial comms, capacity measurement as well as parameter configurations for balancing, charging, discharging etc.As of now i have built and tested a 10S version of my cell measurement circuit. The circuit works well and requires minimal calibration to make accurate.Currently i'm stuck at the low power part. I want to get familiar with the low power modes of the MCU i'm using first and then design my code around the sleep modes. The goal is minimal power consumption for longest operation.At first i tried using the LGT8F328p (atmega328p clone) and managed to get about 3,5mA of current draw. After that i start running into the area of diminishing returns. And 3,5mA is way too much draw for a mid-sized battery pack, so i'm also looking at other options.Now i'm reading up on the low power modes in the STM32F103C8T6, which is found in the blue pill. I'm staying on mainstream MCU's just to hopefully cut down on development time.STM32 also has much more processing power than the atmega, which would allow it to run for shorter periods as it runs calculations and measurements. That and it also has much lower power consumption than the atmega, making it the more attractive option.I'll keep this thread going as i develop my BMS. Also i'm open to any kind of input.

author: Refrigerator
author_rank: Super Contributor
timestamp: July 22, 2023, 08:51:12 pm
content: Another thing i am focusing on right now is the supply to the microcontroller.I could connect an LDO off the first cell in the pack, like Makita does in their packs, for example, but i don't like the unbalanced drain on the pack.And Makita packs are known to lose the first cell in the pack because of this unbalanced drain.So even of it's less efficient i've decided to have a regulator step down the entire voltage from the pack, so that the drain on all cells is balanced.Currently i'm playing around with a linear regulator design that seems to work quite well and only has a 100-ish µA quiescent current.I'm sure lower current draw regulator IC's exist, but i'm working with up to 42V here and i don't think i'll find any that will take that.The discrete design i've come up with manages to handle current draw jumps quite well.Currently, with a load switching between 30µA and 3mA my regulator keeps the voltage deviation within 600µV.One problem with this design is that it absolutely needs that output capacitor, otherwise it's not stable.

author: Refrigerator
author_rank: Super Contributor
timestamp: July 22, 2023, 09:16:24 pm
content: Tuning some resistor values made the quiescent current of the regulator go down to about 40µA.But also came at the cost of output stability, which now has a deviation of about 1mA when transitioning between loads.Of course, this regulator will not have good temperature stability, but everything should be fine as long as i can make use of the internal reference in the MCU.

author: Refrigerator
author_rank: Super Contributor
timestamp: July 22, 2023, 09:40:55 pm
content: With some effort i've modified my two transistor DCDC converter to operate at a very low power level.It has two modes of operation, first is the linear mode and the second is DCDC mode.In linear mode it has a quiescent current draw of about 40µA, and in DCDC mode it becomes impossible to measure due to the pulsed operation.Voltage regulation under load is ok with about 35mV of deviation between a 30µA and a 3mA load.A DCDC converter in this application would have the added benefit of higher efficiency and thus longer run time for the MCU.

author: Refrigerator
author_rank: Super Contributor
timestamp: July 22, 2023, 09:59:40 pm
content: An interesting thing happens when the DCDC converter starts working.Even though the average efficiency is barely over 6%, when loaded with 3mA it draws less than 3mA from the input.Meaning, that even though it's terribly inefficient, it would make my MCU run for about 20% longer, when compared to a linear regulator.

author: Psi
author_rank: Super Contributor
timestamp: July 22, 2023, 10:06:38 pm
content: It isn't always better to run the MCU at max cpu clock so you can get the calculations done fast and go back to sleep.You want to find the sweet spot for your MCU, code complexity and wake time needed.For applications without much hard math to crunch you often want quite a slow CPU clock. Maybe 100-500khz.A lot of the time the CPU is waiting for other things anyway.So you definitely want to use a MCU where you can dynamically adjust the CPU clock frequency in code.It makes it easer to play around and see what works best. There are lots of MCU that can do this. Pretty sure most/all STM32's can. Some ATTiny/Mega's can too.A JouleScope is very useful for sleep/wake current consumption testing if you can afford the price. Their effective dynamic range is awesome (they just change current range insanely fast you don't miss anything when waking up/sleeping.)