Wiki source code of Power controller

Version 20.1 by Mathias Larsen on 2026/09/22 16:36

Show last authors
1 == Connector pinout ==
2
3 |=(% style="width: 281px;" %)Pin|=(% style="width: 135px;" %) |=(% style="width: 157px;" %)comment|=(% style="width: 132px;" %)
4 |(% style="width:281px" %)1|(% style="width:135px" %)CANH|(% style="width:157px" %) |(% style="width:132px" %)
5 |(% style="width:281px" %)2|(% style="width:135px" %)CANL|(% style="width:157px" %) |(% style="width:132px" %)
6 |(% style="width:281px" %)3|(% style="width:135px" %)FAN 1 PWM|(% style="width:157px" %) |(% style="width:132px" %)
7 |(% style="width:281px" %)4|(% style="width:135px" %)FAN 2 PWM|(% style="width:157px" %) |(% style="width:132px" %)
8 |(% style="width:281px" %)5|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
9 |(% style="width:281px" %)6|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
10 |(% style="width:281px" %)7|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
11 |(% style="width:281px" %)8|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
12 |(% style="width:281px" %)9|(% style="width:135px" %)Accumulator|(% style="width:157px" %) |(% style="width:132px" %)
13 |(% style="width:281px" %)10|(% style="width:135px" %)Front|(% style="width:157px" %) |(% style="width:132px" %)
14 |(% style="width:281px" %)11|(% style="width:135px" %)Power fan|(% style="width:157px" %) |(% style="width:132px" %)
15 |(% style="width:281px" %)12|(% style="width:135px" %)Power fan|(% style="width:157px" %) |(% style="width:132px" %)
16 |(% style="width:281px" %)(((
17 13
18 )))|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
19 |(% style="width:281px" %)14|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
20 |(% style="width:281px" %)15|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
21 |(% style="width:281px" %)16|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
22 |(% style="width:281px" %)17|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
23 |(% style="width:281px" %)18|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
24 |(% style="width:281px" %)19|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
25 |(% style="width:281px" %)20|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
26 |(% style="width:281px" %)21|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
27 |(% style="width:281px" %)22|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
28 |(% style="width:281px" %)23|(% style="width:135px" %)GND|(% style="width:157px" %) |(% style="width:132px" %)
29 |(% style="width:281px" %)24|(% style="width:135px" %)12V|(% style="width:157px" %) |(% style="width:132px" %)
30 |(% style="width:281px" %)25|(% style="width:135px" %)12V|(% style="width:157px" %) |(% style="width:132px" %)
31 |(% style="width:281px" %)26|(% style="width:135px" %)12V power pump1|(% style="width:157px" %) |(% style="width:132px" %)
32 |(% style="width:281px" %)27|(% style="width:135px" %)12V Power pump2|(% style="width:157px" %) |(% style="width:132px" %)
33 |(% style="width:281px" %)28|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
34 |(% style="width:281px" %)29|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
35 |(% style="width:281px" %)30|(% style="width:135px" %)GND|(% style="width:157px" %)Blob with tin|(% style="width:132px" %)
36 |(% style="width:281px" %)31|(% style="width:135px" %)Buzzer|(% style="width:157px" %)Is brake light in wiring harnes|(% style="width:132px" %)
37 |(% style="width:281px" %)32|(% style="width:135px" %)Brake light|(% style="width:157px" %)Is buzzer in wiring harnes|(% style="width:132px" %)
38 |(% style="width:281px" %)33|(% style="width:135px" %)24V|(% style="width:157px" %)reserve|(% style="width:132px" %)
39 |(% style="width:281px" %)34|(% style="width:135px" %)24V|(% style="width:157px" %)reserve|(% style="width:132px" %)
40 |(% style="width:281px" %)35|(% style="width:135px" %)24V|(% style="width:157px" %)sensor card|(% style="width:132px" %)
41
42
43
44 == Microcontroller Pinout ==
45
46 The power controller uses a microcontroller to control the pumps, fans, buzzer, and brake light. It also features current monitoring and LED indicators. The Microcontroller used in this system is STM32G431CBT6
47
48
49 |=Physical pin|=Electrical pin|=(((
50 Description
51 )))
52 |1|VBAT|Power source from a backup battery if a RTC would be used (Connected to +3V3 in this case)
53 |5|OSC_IN|Clock input (8MHz oscillator)
54 |7|NRST|Negative reset which can be connected to a button (Connected to +3V3)
55 |8|PA0|Analog signal: Current 6 Supply 24V resserve
56 |9|PA1|Analog signal: Current 7 Supply 24V resserve
57 |10|PA2|Analog signal: Current 5 Supply sensor card
58 |11|PA3|Analog signal: Current 4 Supply front
59 |12|PA4|Analog signal: Current 3 Supply accumulator
60 |13|PA5|Analog signal: Current 2 Supply fans
61 |14|PA6|Digital output LED 9
62 |15|PA7|Digital output LED 2
63 |16|PB0|Analog signal Current 8 Supply buzzer, brake light
64 |17|PB1|PWM: enable Fan 1
65 |18|PB2|Input: V-sense
66 |19|VSSA|Voltage source: Ground
67 |20|VREF|Voltage reference (Internal voltage refferance)
68 |21|VDDA|Voltage source: Power (+3V3)
69 |22|PB10|Digital output: LED 8
70 |23|VSS|Voltage source: Ground
71 |24|VDD|Voltage source: Power (+3V3)
72 |25|PB11|Current 1 Internal components
73 |26|PB12|Current 9 Supply 12 V Pumps inverter and datalogger 
74 |29|PB15|PWM: enable fan 2
75 |30|PA8|Digital output Enable buzzeer(On the car it is Brake light)
76 |31|PA9|(((
77 Digital output Enable brake light(On the car it is the buzzer)
78 )))
79 |32|PA10|Input ASMS signal
80 |33|PA11|CAN-BUS RXD
81 |34|PA12|CAN-BUS TXD
82 |35|VSS|Voltage source: Ground
83 |36|VDD|Voltage source: Power (+3V3)
84 |37|PA13|SWDIO
85 |38|PA14|SWCLK
86 |40|PB3|Digital output: LED 3
87 |41|PB4|Digital output: LED 4
88 |42|PB5|Digital output: LED 5
89 |43|PB6|Digital output: Enable Pump 1
90 |44|PB7|Digital output: Enable Pump 2
91 |45|PB8|Digital output: LED 6
92 |46|PB9|LED 7
93 |47|VSS|Voltage source: Ground
94 |48|VDD|Voltage source: Power (+3V3)
95
96 == Digital outputs ' ==
97
98 3v3
99
100 24V
101
102 == Current measurment ==
103
104 == Known issues ==
105
106 12 V did not work
107
108 Current measurement not tested
109
110
111 == Features to add ==
112
113 Add mosfets to cut power if the Lv battery is to low to save power
114
115 Add a power distrobution for Autonomus system
116
117
118 == BOM(bill of materials) ==
119 |=Part Number|=Description|=Ref Des|=Qty|=Manufacturer|=MPN|=Status|=Unit Price|=Ext Price
120 |CC0603KRX5R6BB475|Chip Capacitor, 4.7µF +/-20%, 10V, 0603|C1|1|Yageo Group|CC0603KRX5R6BB475|Volume Production|0.2094|0.2094
121 |CL10B104KA8NNNC|MLCC, 0.1 uF, 25V, ±10%, X7R, 0603|C2, C3, C4, C8, C9, C10, C14, C15, C16|9|Samsung Electro-Mechanics|CL10B104KA8NNNC|Volume Production|0.0085|4.41
122 |CL10B105KA8NFNC|MLCC, 1uF, 25V, 10%, X7R, 0603|C5, C7|2|Samsung Electro-Mechanics|CL10B105KA8NFNC|Volume Production|0.0434|173.60
123 |CL10B103KB8NNNC|MLCC, 10nF, 50V, +125C, X7R, ±10%, 0603|C6, C101, C201, C301, C401, C501, C601, C701, C801, C901|10|(( fatal error – no data ))| | | | |
124 |885012206020|MLCC, General Purpose, 0603, 100nF, 10V|C11|1|Wurth Elektronik|885012206020|Volume Production|0.089|0.089
125 |885012006051|MLCC, General Purpose, 0603, 10pF, 50V|C12, C13|2|Wurth Elektronik|885012006051|Volume Production|0.10312|0.20623
126 |885012208124|MLCC, General Purpose, 1206, 2.2µF, 100V|C17, C19|2|Wurth Elektronik|885012208124|Volume Production|0.25206|0.50413
127 |885012108022|MLCC, General Purpose, 1206, 10µF, 50V|C18|1|Wurth Elektronik|885012108022|Volume Production|0.89368|0.89368
128 |885012206071R|MLCC, General Purpose, 0603, 100nF, 25V|C20|1|Wurth Elektronik|885012206071R|Volume Production|0.10312|0.10312
129 |885012107014|MLCC, General Purpose, 0805, 10µF, 16V|C21, C22|2|Wurth Elektronik|885012107014|Volume Production|0.43309|2.17
130 |MBASU105SB5104KFNA01|MLCC, 50V, 10%, X5R, 0.1uF, 0402|C23, C24|2|TAIYO YUDEN|MBASU105SB5104KFNA01|Volume Production|0.0326|9.85
131 |GRM32ER71H475KA88L|MLCC, 1210, 4.7uF, 50V, ±10%, X7R|C902, C903|2|Murata|GRM32ER71H475KA88L|**Not Recommended for New Design**|0.21769|0.43538
132 |GRM188R71A225KE15D|MLCC, 0603, 2.2uF, X7R, 10V|C904|1|Murata|GRM188R71A225KE15D|Volume Production|0.153|0.153
133 |CC0402KRX7R6BB104|Chip Capacitor, 100nF +/-20%, 10V, 0402|C905, C908|2|Yageo Group|CC0402KRX7R6BB104|Volume Production|0.0051|0.0102
134 |GRM1555C1H102JA01J|MLCC, 0402, 1nF, 50V, ±5%, C0G|C906|1|Murata|GRM1555C1H102JA01J|Volume Production|0.007|0.028
135 |GRM1555C1H4R3CA01D|MLCC, 0402, 4.3pF, 50V, C0G, ±0.25pF|C907|1|Murata|GRM1555C1H4R3CA01D|**Not Recommended for New Design**|0.10312|0.10312
136 |GRM32ER61E226KE15L|MLCC, 1210, 22uF, 25V, X5R|C909, C910, C911, C912|4|Murata|GRM32ER61E226KE15L|**Not Recommended for New Design**|2.21|8.84
137 |824094024|WE-TVS TVS Diode, SOT23-3L, 2 Channel, 24V, 38pF|D1|1|Wurth Elektronik|824094024|Volume Production|0.91659|0.91659
138 |824500261|WE-TVSP SMT Power TVS Diode, DO-214AC, 400W, 26VDC|D2|1|Wurth Elektronik|824500261|Volume Production|0.28529|1.43
139 |150282M167310|WL-SFTD Full-color Top LED, 2828, R/G/B, 70°|D101, D201, D301,