Firmware for the LNSC-2420 solar charger. Based on libopencm3.
Find a file
2022-10-15 21:42:46 +02:00
doc Added pinout.txt 2021-06-12 18:45:42 +02:00
fxplib@896464ee67 Update fxplib (only license and documentation changed) 2021-06-13 14:45:34 +02:00
ldscripts Preparations for dedicated configuration flash page 2022-09-25 15:57:05 +02:00
libopencm3@c82c7406aa Update libopencm3 2022-09-14 21:35:36 +02:00
oocd Initial commit 2021-06-05 00:04:36 +02:00
src Add new temperature thresholds to flash config 2022-10-15 21:42:46 +02:00
utils Add new temperature thresholds to flash config 2022-10-15 21:42:46 +02:00
.gitignore Preparations for dedicated configuration flash page 2022-09-25 15:57:05 +02:00
.gitmodules Initial commit 2021-06-05 00:04:36 +02:00
compile_flags.txt Initial commit 2021-06-05 00:04:36 +02:00
LICENSE Added README and LICENSE documents 2021-06-12 18:40:36 +02:00
Makefile Preparations for dedicated configuration flash page 2022-09-25 15:57:05 +02:00
README.md Added README and LICENSE documents 2021-06-12 18:40:36 +02:00

Firmware for the LNSC-2420 Solar Charger

The LNSC-2420 is a PWM-based solar charge regulator for 24 V systems supporting up to 20 A charging current.

Noteworthy features:

  • High-side switching with N-Channel MOSFETs:
    • Gate voltage is provided by a charge pump which doubles the battery voltage.
    • The MOSFETs are controlled using GPIOs.
  • Current and voltage measurement:
    • The solar current, load current, solar voltage, battery voltage and charge pump output voltage are measured using the internal ADC of the STM32F030.
  • Low power usage:
    • The charge pump is disabled if both power FETs are off.
    • Additionally, the microcontroller is put into deep sleep (Stop Mode) if no solar power is available and the battery voltage is in undervoltage protection.
  • LED status display:
    • 6 LEDs show the internal charging and discharging state.
    • The LEDs are controlled using Charlieplexing (i.e. only 3 GPIOs are needed)
  • Protections:
    • Solar panel reverse current
    • Battery overvoltage
    • Battery undervoltage
    • Load current limit

Calibration

The sensing hardware should be quite accurate, but some minor error always remains. They can be compensated via the parameters in src/calibration.h.

To adjust those parameters, first set all CAL_FACTORs to 1000, recompile and flash the firmware. Then watch the RS485 output, which contains all measurements in a line starting with MEAS. Apply a known current/voltage for each measurement and calculate:

                          Actual value
CAL_FACTOR = 1000 * -----------------------
                    Value shown by firmware

Round to the nearest integer and replace the 1000 in src/calibration.h by the calculated value.

Customization

All customizable parameters can be adjusted in src/config.h.

License

The code in this repository (except submodules) is licensed under the MIT license.