From 7bdb5338a45aac7f2ad7c963e46cfbde4ed30ee2 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sat, 12 Jun 2021 18:40:36 +0200 Subject: [PATCH] Added README and LICENSE documents --- LICENSE | 21 +++++++++++++++++++++ README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..256e37f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Thomas Kolb (cfr34k) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..96b9086 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# 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_FACTOR`s 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](LICENSE).