Wiki source code of Power controller

Version 18.1 by Mathias Larsen on 2026/09/22 14:51

Hide last authors
Mathias Larsen 14.2 1 == Connector pinout ==
Mathias Larsen 6.2 2
Mathias Larsen 14.6 3 |=(% style="width: 281px;" %)Pin|=(% style="width: 135px;" %) |=(% style="width: 157px;" %)comment|=(% style="width: 132px;" %)
Mathias Larsen 14.9 4 |(% style="width:281px" %)1|(% style="width:135px" %)CANH|(% style="width:157px" %) |(% style="width:132px" %)
Mathias Larsen 14.6 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" %)
Mathias Larsen 14.7 12 |(% style="width:281px" %)9|(% style="width:135px" %)Accumulator|(% style="width:157px" %) |(% style="width:132px" %)
Mathias Larsen 14.6 13 |(% style="width:281px" %)10|(% style="width:135px" %)Front|(% style="width:157px" %) |(% style="width:132px" %)
Mathias Larsen 14.7 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" %)
Mathias Larsen 14.6 16 |(% style="width:281px" %)(((
Mathias Larsen 14.2 17 13
Mathias Larsen 14.7 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" %)
Mathias Larsen 14.9 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" %)
Mathias Larsen 14.7 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" %)
Mathias Larsen 14.8 36 |(% style="width:281px" %)31|(% style="width:135px" %)Buzzer|(% style="width:157px" %)Is brake light in wiring harnes|(% style="width:132px" %)
Mathias Larsen 14.9 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" %)
Mathias Larsen 14.2 41
42
43
Mathias Larsen 6.2 44 == Microcontroller Pinout ==
45
Mathias Larsen 11.1 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
Mathias Larsen 7.1 47
48
Mathias Larsen 2.4 49 |=Physical pin|=Electrical pin|=(((
50 Description
51 )))
Mathias Larsen 4.2 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)
Mathias Larsen 7.2 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
Mathias Larsen 7.3 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
Mathias Larsen 8.1 64 |17|PB1|PWM: enable Fan 1
Mathias Larsen 7.4 65 |18|PB2|Input: V-sense
Mathias Larsen 5.1 66 |19|VSSA|Voltage source: Ground
Mathias Larsen 9.1 67 |20|VREF|Voltage reference (Internal voltage refferance)
Mathias Larsen 5.1 68 |21|VDDA|Voltage source: Power (+3V3)
Mathias Larsen 7.4 69 |22|PB10|Digital output: LED 8
Mathias Larsen 5.1 70 |23|VSS|Voltage source: Ground
71 |24|VDD|Voltage source: Power (+3V3)
Mathias Larsen 7.1 72 |25|PB11|Current 1 Internal components
73 |26|PB12|Current 9 Supply 12 V Pumps inverter and datalogger 
Mathias Larsen 8.1 74 |29|PB15|PWM: enable fan 2
Mathias Larsen 13.1 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 )))
Mathias Larsen 7.4 79 |32|PA10|Input ASMS signal
Mathias Larsen 12.1 80 |33|PA11|CAN-BUS RXD
81 |34|PA12|CAN-BUS TXD
Mathias Larsen 5.1 82 |35|VSS|Voltage source: Ground
83 |36|VDD|Voltage source: Power (+3V3)
84 |37|PA13|SWDIO
85 |38|PA14|SWCLK
Mathias Larsen 9.2 86 |40|PB3|Digital output: LED 3
87 |41|PB4|Digital output: LED 4
88 |42|PB5|Digital output: LED 5
Mathias Larsen 10.1 89 |43|PB6|Digital output: Enable Pump 1
Mathias Larsen 9.2 90 |44|PB7|Digital output: Enable Pump 2
91 |45|PB8|Digital output: LED 6
Mathias Larsen 5.1 92 |46|PB9|LED 7
93 |47|VSS|Voltage source: Ground
94 |48|VDD|Voltage source: Power (+3V3)
Mathias Larsen 2.1 95
Mathias Larsen 14.22 96 == Digital outputs ' ==
Mathias Larsen 14.20 97
Mathias Larsen 14.22 98 3v3
99
100 24V
101
Mathias Larsen 14.21 102 == Current measurment ==
103
Mathias Larsen 17.1 104 == Known issues ==
Mathias Larsen 14.20 105
106 12 V did not work
107
Mathias Larsen 16.1 108 Current measurement not tested
109
110
Mathias Larsen 14.1 111 == Features to add ==
112
113 Add mosfets to cut power if the Lv battery is to low to save power
Mathias Larsen 16.1 114
115 Add a power distrobution for Autonomus system
Mathias Larsen 17.1 116
117
118 == BOM(bill of materials) ==
119
Mathias Larsen 18.1 120 ~|=Part Number|=Type|=Description|=Qty|=Item ID
121 ~|STM32G431CBT6|b|Microcontroller|1|1288-LV-00056
122 ~|01550900DR|b|Fuseholder for nanofuse2|9|1288-LV-00057
123 ~|0466.125NR|b|In-line fuse 125 mA|1|1288-LV-00058
124 ~|776231-1|b|Ampseal 35 pin connector|1|1288-LV-00059
125 ~|76829-0002|b|Mega Fit 2 pin connector|1|1288-LV-00060
126 ~|44914-0401|b|Mini Fit 4 pin connector|1|1288-LV-00061
127 ~|1461247-3|b|24VDC relay|1|1288-LV-00062
128 ~|BSS123NH6327XTSA1|b|Mosfet N-channel SOT-23|6|1288-LV-00063
129 ~|BSS83PH6327XTSA1|b|Mosfet P-channel SOT-23|2|1288-LV-00064
130 ~|BSC084P03NS3GATMA1|b|P-channel mosfet PG-TDSON-8-1|2|1288-LV-00065
131 ~|NCV7344D13R2G|b|CAN FD transceiver|1|1288-LV-00066
132 ~|INA4180A4IPWR|b|Current sense amplifier, quad channel|3|1288-LV-00067
133 ~|AP64060WU-7|b|Synchronous step-down converter|1|1288-LV-00068
134 ~|AP2112K-3.3TRG1|b|3.3V LDO, PDS05|1|1288-LV-00069
135 ~|TPS56A37RPAR|b|10A synchronous buck converter|3|1288-LV-00070
136 ~|ASE-8.000MHz-E-T|b|8MHz Oscillator|1|1288-LV-00071
137 ~|824094024|b|TVS diode, SOT-23-3L|1|1288-LV-00072
138 ~|824500261|b|TVS diode, DO-214AC|1|1288-LV-00073
139 ~|150282M167310|b|LED red/blue/green|9|1288-LV-00074
140 ~|WSLF25122L000FEA|b|Res Metal Strip, 2mΩ, 2512|9|1288-LV-00077
141 ~|CR0603-FX-1002ELF|b|SMD chip resistor, 10KΩ, 0603|22|1288-LV-00078
142 ~|PCB|m|Self-designed PCB|1|1288-LV-00171
143 ~|CR0805-JW-472ELF|b|SMD chip resistor, 4K7Ω, 0603|9|1288-LV-00189
144 ~|CR0603-FX-1001ELF|m|SMD chip resistor, 1KΩ, 0603|7|1288-LV-00190
145 ~|CRCW060352K3FKEA|b|SMD chip resistor, 52K3Ω, 0603|3|1288-LV-00192
146 ~|CRCW060320K0FKEA|m|SMD chip resistor, 20KΩ, 0603|3|1288-LV-00193
147 ~|ERJ-6ENF3833V|m|SMD chip resistor, 383KΩ, 0603|3|1288-LV-00194
148 ~|CRCW0603100KFKEA|m|SMD chip resistor, 100KΩ, 0603|3|1288-LV-00195
149 ~|RC0603FR-105K1L|m|SMD chip resistor, 5K1Ω, 0603|1|1288-LV-00207
150 ~|CRGCQ0603F27K|b|SMD chip resistor, 27KΩ, 0603|1|1288-LV-00208
151 ~|CR0603-FX-3480ELF|b|SMD chip resistor, 348Ω, 0603|9|1288-LV-00216
152 ~|CC0603KRX5R6BB475|m|MLCC SMD, 4.7µF, 0603|1|1288-LV-00227
153 ~|CL10B104KA8NNNC|m|MLCC SMD, 100nF, 0603|9|1288-LV-00228
154 ~|CL10B105KA8NFNC|m|MLCC SMD, 1µF, 0603|2|1288-LV-00229
155 ~|CL10B103KB8NNNC|m|MLCC SMD, 10nF, 0603|10|1288-LV-00230
156 ~|885012206020|m|MLCC SMD, 100nF|2|1288-LV-00231
157 ~|885012006051|m|MLCC SMD, 10pF|2|1288-LV-00232
158 ~|885012208124|m|MLCC SMD, 2.2µF, 0603|2|1288-LV-00233
159 ~|885012108022|m|MLCC SMD, 10µF, 0603|1|1288-LV-00234
160 ~|885012206071R|m|MLCC SMD, 100nF, 0603|1|1288-LV-00235
161 ~|885012107014|m|MLCC SMD, 10µF, 0804|2|1288-LV-00236
162 ~|MBASU105SB5104KFNA01|m|MLCC SMD, 100nF, 0402|2|1288-LV-00237
163 ~|885012209073|m|MLCC SMD, 2.2µF, 1210|6|1288-LV-00238
164 ~|885012207098R|m|MLCC SMD, 100nF, 0805|3|1288-LV-00239
165 ~|885012206042|m|MLCC SMD, 22nF, 0603|3|1288-LV-00240
166 ~|885012206046|m|MLCC SMD, 100nF, 0603|3|1288-LV-00241
167 ~|C0603C300F3HACAUTO|b|MLCC SMD, 30pF, 0603|3|1288-LV-00242
168 ~|885012208069|m|MLCC SMD, 10µF, 1206|9|