Hello, I intend to make a very primitive bms with which I can monitor the voltage of four 18650 batteries connected in series. The problem was that a short circuit was caused when connecting the batteries to the analog pins. The code I used was the following.
The problem was that a short circuit was caused when connecting the batteries to the analog pins. The code I used was the following.
It's not a short circuit. It's an over voltage.
You need to stop and learn basic electronics. What you are doing is pure negligence. It is very obvious that the
voltage of each battery gets added to the previous so only one of them is actually wired correctly (The bottom one)
All of the rest violate every principle of basic electronics and arduino wiring. You shouldn't be wiring things if you
don't know what you are doing. It's fine to post this question. The problem is that you posted it too late, AFTER you
wired it. If you don't know what you are doing then don't do anything until you do. Ask first , then do, not the other
way around. If you were just posting because you wired a led backwards that would be completely different than
what you did. There is a way to accomplish what you are trying to do that involves voltage dividers and math in the
code to calculate the input voltage of each voltage divider.
This is just wrong.
If the batteries are charged:
A3 has 8.6 volts on it (3.6V over the maximum)
A2 has 12.9V on it (7.9V over the maximum)
A1 has 17.2V on it (12.2V over the maximum)
The problem was that a short circuit was caused when connecting the batteries to the analog pins.
You don't have a short, but depending on those resistor values you may have fried the Arduino! ...10K resistors should safely limit the current and then there are small (low current) :"protection diodes" in the ATmega chip to prevent over-voltage.
So, A4 sees 3.7V
A3 sees 7.4V
A2 sees 11.1V
A1 sees 14.8V
And higher if the batteries are charged to 4.2V.
One way you can do this is to use voltage dividers to keep the voltage <=5V.
Your mission: find R1 thru R6 such that V(A1), V(A2), V(A3) do not exceed 5V.
You also want low current draw so the resistors don't excessively drain the batteries.
I'd start with a common value for R2,R4,R6 and calculate for R1, R3, R5. Say 5K.
For example if R5 is 3.9K and R6 is 5K, that V(A3) = 7.4V * 5000/(3900 + 5000) = 4.41V
and if the batteries are fully charged, then V(A3) = 8.4 * 5000/(3900 + 5000) = 5.006, which is higher the 5V reference used by the ADC in an arduino, so the readings will max out at 1023. So, select a different R5 and recalculate,