Which IC *Likely* Controls Low Voltage Cutoff/Protection for my eBike? - Page 1
Forum section: electronics / beginners

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 08, 2021, 09:28:02 pm
content: I'm attempting to use a 36v battery with my 48v ebike controller, however, since my controllers low voltage protection is set to 40.5V, I need to manually change it to get my 36v nominal battery to utilize more capacity. I've read from EndLess-Sphere (website) threads that to decrease a controllers Low Voltage Cutoff/Protection (LVC/LVP), you need to change the resistance of a resistor divider. I, however, was not able to find out which integrated circuit (IC) monitors the battery voltage via the resistor divider.My controller Model: KT48ZWSRKT-SJT02L (48V, rated 22A, max 45A, LVP 40v)OEM: szktdz.comIC's on the Main PCB (PCB Model: KTE-18S5-F):- LM317T (linear regulator)(https://www.st.com/en/power-management/lm317.html)- 78M05 (linear regulator)(https://www.ti.com/lit/ds/symlink/lm78m.pdf)- STM8S105-C6 (micro-controller; quad flat package design) (https://www.st.com/en/microcontrollers-microprocessors/stm8s105c6.html)- LM324 (quad operational amplifier)(https://www.st.com/en/amplifiers-and-comparators/lm324.html)IC's on a Daughter PCB (PCB Model: KTE-QHE131028)- LM339 (quad voltage comparators)(https://www.st.com/en/amplifiers-and-comparators/lm339.html)- 8S003F3 (EEPROM)(https://www.st.com/en/microcontrollers-microprocessors/stm8s003f3.html)I understand that the LM317T, 78M05, and 8S003F3 *may* contain resistor dividers themselves, but will not affect the LVP (therefore I won't be messing with those). However, I am unsure whether it will be the LM324, LM339, or STM8S105 that will have the resistor divider that I will need to tinker with.Guidance would be appreciated. I have some electrical component experience and years of soldering experience. There are no trim-pots on the PCB's. I have images of the PCB if required (but I don't think is neccesary).Thanks!!

author: Manul
author_rank: Super Contributor
timestamp: March 08, 2021, 10:45:42 pm
content: Most likely the MCU (STM8S105). It probably goes from divider to MCU ADC input, in that case it is not just an UVLO, but also a battery gauge (measures battery voltage and calculates percentage). Use a multimeter to find a resistor which goes to 48V (there will not be a lot of them) and look what is around. If there is another resistor to ground and a trace going to MCU - this will be the divider. There will likely also be a small capacitor in parallel with the lower divider arm (for noise filtering).

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 08, 2021, 11:06:24 pm
content: Quote from: Manul on March 08, 2021, 10:45:42 pmOhhhh!!! This is a really smart way to find out which resistor it is!!! I didn't think about it, that 48v would have to be on one side. I'll give that a shot, thanks!Do you think the LM324 or LM339 would potentially be used to measure the battery voltage?

author: Manul
author_rank: Super Contributor
timestamp: March 08, 2021, 11:19:30 pm
content: Quote from: LooseJunkHater on March 08, 2021, 11:06:24 pmNo, I don't think. I think battery voltage goes to divider, so for example 0-48V range becomes 0-5V range. That 0-5V range then can be sampled by microcontroller ADC (analog to digital converter) and the actual battery voltage is then calculated in software (so it works like digital multimeter). At least it should be like this.Comparator can be used for low voltage protection, but it would only see if voltage is lower or higher then 40V. Like logic "1" or "0". So it is not very useful. When MCU measures the real voltage, it knows more, like how much charge there is, how much is left, etc.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 08, 2021, 11:44:40 pm
content: Quote from: Manul on March 08, 2021, 11:19:30 pmThat 5V part also makes sense, and I feel like that should help narrow down the testing area!Regarding the ST micro part, I would like to further narrow it down to which pins the voltage divider may be on, to reduce the risk of accidentally shorting something out or killing the PCB. Taking a look at the datasheet, I see there's a built-in ADC (which I assume is used to measure the battery voltage, from 0-5v, as you said earlier). I know for Arduino's they have specific ADC pins, but is the same not true for the MCU? I can't seem to find it's ADC pins.The IC package on the PCB is the LQFP48.___Edit: Nevermind; read the datasheet more carefully, and I see that there's multiple "AIN" (Analog In !) pins, with not all of them supporting the use of the internal ADC. This further narrows down what I need to probe.Edit 2: From my understanding of the datasheet, the analog pins at 15-24 of the LQFP48 package, and any of them could be used to measure the battery voltage.Is this correct?

author: Manul
author_rank: Super Contributor
timestamp: March 08, 2021, 11:58:24 pm
content: The MCU may also be running at 3.3V, but in this case my guess is 5V.Searching for ADC pins will not help, because:1. ADC inputs can be mapped to different physical pins2. There could be more ADC inputs, not just the battery voltageIf possible - disconnect the battery before trying to find the divider. Sometimes multimeter probe may slip and short something. With battery disconnected you can measure safely.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 09, 2021, 12:03:26 am
content: Quote from: Manul on March 08, 2021, 11:58:24 pmIt's doable, I currently have the controller apart and disconnected from the battery.Also, that's a good idea; I guess I can simply probe out the MCU and nearby resistor dividers and see which connect to 48V+ Battery Input

author: Manul
author_rank: Super Contributor
timestamp: March 09, 2021, 12:07:34 am
content: Yes, it seems pins 15-24. I still think it would be easier to trace from another end. Well, you see the board, so you know better.If you trace from 48V end, keep in mind that there could be a power switch (mechanical or mosfet) in the way.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 09, 2021, 06:32:45 pm
content: Quote from: Manul on March 09, 2021, 12:07:34 amSorry for not replying sooner.Regarding the PCB design, there are no switches (electrical or mechanical) that disconnect power from going to the ADC pins thankfully. The only mosfets that are on the board are to power the 3 motor phases.I've done a bit of probing on the PCB, and most of the ADC pins connect to the 48V+ Battery Input, with varying resistances between 130k-4meg (they're stable resistances as well, so it's not like caps are being charged up from my multimeter). However locating the resistors attached to the ADC lines has become quite troublesome, due to the phase wires + other floating wires flowing over the PCB.I'm thinking of connecting +3v at the 48V+ Battery Input, and then gnd at the ADC pins, limiting the current (to about 10mah initially using a constant current source + resistor, and then boosting it slowly to up to 50mah, in case 10mah isn't enough), and using my thermal camera to locate which 0603 / 0805 resistors are heating up. That way, I can quickly and easily locate the potential resistor divider.Thoughts on this tactic?

author: Manul
author_rank: Super Contributor
timestamp: March 09, 2021, 09:05:43 pm
content: Well, the upper arm of voltage divider is expected to be quite high value, can be like 50k, 100k. Probing from 48V to ADC pins will likely show all kind of leakage and is not reliable as you saw.Also because of high value resistor, it will not heat much, so I'm not sure if you will be able to see it on thermal camera. Trying to run current may not work as you expect and migh be dangerous for the board, so I suggest to not try.My suggestion - probe from 48V (using beeper) to resistors on the board. I mean, look for zero ohms, direct connection. If you do 1 resistor per 3 seconds, can not take very long.One more option is to power the board from lab power supply (48V) and measure voltages on ADC inputs. Vary the supply voltage a little and find the pin which also shows varying voltage. Note: some pins from these 15-24 might be configured as digital input or outputs, so be careful.You also can post a picture of the board if you like.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 09, 2021, 10:08:49 pm
content: Quote from: Manul on March 09, 2021, 09:05:43 pmHmm. Reading the datasheet, it appears that many of the ADC pins can also be used for outputting signals, such as I2C. I was just about to begin shorting ADC pins to ground to see which monitors battery voltage, but that appears to be a bad idea now, unless I use an inline resistor.Thoughts?Also I'll upload a picture in a second

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 09, 2021, 10:16:57 pm
content: Excuse the bad quality; my cellphone camera is pretty trash.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 09, 2021, 10:19:04 pm
content: Second pic, of what the entire board looks like. As you can see, the wires everywhere makes it difficult to probe around and measure things.

author: Manul
author_rank: Super Contributor
timestamp: March 09, 2021, 10:47:20 pm
content: Quote from: LooseJunkHater on March 09, 2021, 10:08:49 pmWell, I wrote my thoughts, two options, nothing else comes to my mind. Frankly, it does not look very hard to probe all resistors. Might be done in 5 minutes or so if components are just on one side of the board (which I presume is the case). Don't short pins. Better do it the boring way.

author: jerryk
author_rank: Regular Contributor
timestamp: March 09, 2021, 11:10:56 pm
content: I just did a similar type mod to a change a Lithium Ion powered jump pack to handle LFP. This required that I change the high and low voltage parameters for the internal battery pack. It's voltage dividers were on the inputs to the comparator(LM393) that compared the inputs against a fixed voltage reference(LM285Z) and the comparators outputs went direct to the MCU.You might try to trace the comparator outputs to see where they go.Jerry

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 10, 2021, 12:30:02 am
content: Quote from: Manul on March 09, 2021, 10:47:20 pmSorry, I didn't mean to be rude or anything; I was just thinking of different and potentially easier ways to test this out that you may/may not have thought of.I did what you suggested and probed all the ADC pins, and many of them were at 5V (neg probe on PCB ground, pos probe at the MCU ADC vias) at 41V input. One of them was at approximately 3v-ish, and when I used a 18v battery, that same point dropped to 1.5v-ish.On that aformentioned via (MCU pin 15), I added a 10k trimpot across the SMD resistor labelled "103". Varying the trimpot between 5-10k did not change the monitored voltage of the microcontroller, therefore I don't think MCU pin 15 is used to monitor the battery voltage (unless I added the resistor to the wrong place, which I don't think I did).Attached is an image showing where I added the trimpot.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 10, 2021, 12:32:40 am
content: Quote from: jerryk on March 09, 2021, 11:10:56 pmNow that I've learned a bit more about ADC's and my ebike controller, I'm not 100% sure if the comparator is being used for this reason. It's *possible* that it is (and that once the LVP is reached, it signals to the MCU to shutoff), however, the MCU is still monitoring the battery voltage (there's a setting on the motor controller to monitor the battery voltage).

author: Manul
author_rank: Super Contributor
timestamp: March 10, 2021, 12:48:58 am
content: Quote from: LooseJunkHater on March 10, 2021, 12:30:02 amIt really seems that you found the output of the divider and it indeed goes to ADC. You just need to verify. By the way, was it really pin 15, not 16?It is possible, that there is a series resistor between divider and MCU and you put the pot on that series resistor. In that case your pot did not change nothing, this is natural. Note, that this 10k resistor where you put the pot does not look like a lower divider arm, because none of its ends is connected to ground.This is the reason why I suggested to trace from B+ end. Because if you find the dividerinputit is then easier to follow how it is configured or where it goes, to MCU, comparator or something else. In fact, you might not be interested at all where the output goes, you just change the divider.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 12, 2021, 12:36:53 am
content: Woops, yes you are correct, it was indeed pin 16. Guess I don't know how to count lol. Anway, pin 16 of the MCU was a red herring; it monitors the motor power. I tested this by tombstoning the resistor, and noticed the monitor power progressively increases.The search goes on!Regarding tracing the pins from B+, it's been quite difficult to do, because there's many thin traces running alongside one another, however I am trying it out as well.

author: Manul
author_rank: Super Contributor
timestamp: March 12, 2021, 01:21:49 am
content: Quote from: LooseJunkHater on March 12, 2021, 12:36:53 amQuote from: LooseJunkHater on March 10, 2021, 12:30:02 amAs I understand, the motor was not running, so is it really motor power signal?By the way, battery voltage might be expected to be included in the calculation of motor power output.Quote from: LooseJunkHater on March 12, 2021, 12:36:53 amI think to put one multimeter lead on B+ and touch all resistors on the board looking for beep can not be hard. I often do this if I need to find something without a schematic diagram. Sometimes you just can't beat the old good buzzing method. It really helps if multimer has fast beep. Mine is quite fast, so sometimes I just "brush" the pins of IC packages or connectors at speed, something like 10 pins per second and very quickly find things. To buzz other components is not that quick, but still quite effective technique.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: March 12, 2021, 01:45:23 am
content: Quote from: Manul on March 12, 2021, 01:21:49 amSorry I should have further clarified; it was still correctly monitoring the voltage (41v input). There was no motor attached, however, the controller thought the "motor wattage" was progressively increasing (starting at 0w, and slowly increasing, up to 300w, at which point I shutoff the controller).Quote from: Manul on March 12, 2021, 01:21:49 amI tred this, but I think my multimeter probe tips are garbage (basic chinese ones that came with the Aneng 8008), because I was really not able to find any connections when checking around the MCU and around other components.Today I've been doing more of your first suggestion, and following the traces. The actual pin 15 of the MCU appears to have a resistor divider that attaches to ground, so I'll be messing with that one next.