board
Solar MPPT Power System
Public Unreviewedby TylerK
A 30 W solar battery charger with regulated 5 V and 3.3 V rails: an STM32G031 running perturb & observe MPPT and a CC/CV charge state machine, steering a TI LM5175 4-switch buck-boost through a single analog control input. Four-layer KiCad board, schematic and PCB generated from Python, with an electrothermal simulation run against the published board file.
main
TylerK
Replace discrete-analog board with MCU/IC redesign: STM32G031 P&O MPPT + CC/CV firmware, LM5175 buck-boost, INA180 curr…
e48ba30
1mo ago
#include "status_led.h"
#include "main.h" /* CubeMX-generated: LED1_GPIO_Port/Pin, LED2_GPIO_Port/Pin */
#define FLOAT_BLINK_PERIOD_MS 1500U
void status_led_init(void) {
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
}
void status_led_update(charge_state_t state, uint32_t now_ms) {
switch (state) {
case CHG_STATE_BULK:
case CHG_STATE_ABSORPTION:
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
break;
case CHG_STATE_FLOAT:
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin,
((now_ms % FLOAT_BLINK_PERIOD_MS) < (FLOAT_BLINK_PERIOD_MS / 2)) ? GPIO_PIN_SET : GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
break;
case CHG_STATE_FAULT:
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET);
break;
}
}