...
Starter project link: https://github.com/lhr-solar/StarterProjects
Background:
The Problem
When we draw current from a battery it also produces heat, which induces a high current draw. If a battery gets hot enough, it will enter a thermal runaway where it gets so hot that it draws much more current than normal, producing more heat and drawing more current until the battery explodes (not good). There are a lot of preventative measures you can take to avoid thermal runaway like passive cell balancing. The simplest option to prevent the battery from getting too hot is controlling fans to dissipate heat in the battery box.
...
During layout keep the capacitors close to the pins you’re trying to filter noise to.
Add 2 100 uF capacitors in parallel with the 12V and GNDPWR line
Current Limiting:
The gate to drain of a mosfet acts as a weak capacitor (cuz semiconductor physics don’t ask me), so for various reasons, we need to limit current on the input of the gate, so add a resistor in series with the gate ( a 100k ohm resistor works fine).
...
To mitigate this we set the gate voltage of the gate to another voltage when no signal is being applied . Through through a pull-up resistor or pull-down resistor. A pull-up resistor pulls the signal to some voltage (usually VCC →, in this case, it’s 12V). A pull-down resistor pulls it down to GND.
...
Stuff like motors and fans acts as an inductor, meaning they store current and then dump it all out. When we suddenly switch off an inductive load, the inductor will try to dump out all this stored current (because by opening the switch we’ve removed the current source essentially). To prevent this dump from causing big current spikes through our system we add a flyback diode in parallel with the inductive load (also called snubber diode, freewheeling diode, etc).
...