Commit Graph
96 Commits
Author SHA1 Message Date
Martin Jaeger 4b545fa882 Include git commit hash in ThingSet data objects 2019-08-08 11:19:29 +02:00
Martin Jaeger c968a6bb8a Structs renamed for new coding style (closes #42) 2019-08-08 10:16:16 +02:00
hogthrob 3261414fcf uext_wifi compiles again (#41) 2019-07-26 07:38:06 +02:00
Jordan Silverman 45e29e1c82 Merge pull request #40 from LibreSolar/lvd-improvements
Load voltage thresholds adjusted and inhibit added
2019-07-17 14:42:09 +01:00
Martin Jaeger 4bc3f8bd1e Load voltage thresholds adjusted and inhibit added
During tests, the deep discharge counter increased by several 100 counts per day under certain circumstances, most probably because of quite small battery making the voltage toggle between disconnect and reconnect voltage. This commit suggests several improvements.

- Load reconnect voltage increased
- Don't reconnect before waiting at least 1h (lvd_timestamp in load.cpp)
- SOC filter calculation slightly changed to make sure 100% is reached fast enough.
2019-07-12 18:55:13 +02:00
Martin Jaeger 17b044d941 Improve SOC and load LED behavior at low SOC
This commit prevents that the SOC bar shows 2 LEDs already even though the load is still switched of because of low voltage.
2019-07-11 17:50:40 +02:00
Martin Jaeger 3a2af7ccc7 Rewrite of LED module (closes #28) 2019-07-11 17:19:06 +02:00
Martin Jaeger cf5366c2ba Fix usable_capacity estimation to prevent wrong values before first full charge 2019-07-11 13:11:34 +02:00
Martin Jaeger 5e48d5e7c5 Update to PlatformIO 4.0 2019-07-10 21:15:22 +02:00
Martin Jaeger 7300406b94 DC/DC test function and dead time config added
- The DC/DC test function slowly ramps up the duty cycle to 50% to allow defined measurements of gate driver, switch node etc. with an oscilloscope (without disturbance by the MPPT algorithm)

- The dead-time between HS and LS gate on/off is now configurable for each PCB and not fixed to 300 ns for all PCBs anymore.
2019-07-05 11:01:35 +02:00
hogthrob 7ee248cf81 Reduced codesize: Switch to newlib-nano; Travis deploy on LibreSolar only (#37)
* Reduced codesize: Switch to newlib-nano

Figured out how to switch to newlib-nano in a simple way.
Reduced build size by about 29k. Applied this to all STM32 builds.
Please test with the STM32L072 hardware, I don't have one of those,
only STM32F072

Also "upgraded" the compiler accepted language standard to gnu c++11 (from gnu++98).

And finally defined that all floating point constants are to be treated
as "floats" and not as double (which is the default). Reduces the number
of implicit double promotions almost to the required minimum.

In some places the double functions are applied to floats which also
causes some unwanted time and code growth. But this is not fixed yet.

* Change travis to try to deploy only on "master" repo

* Fixed typo

gnu++11 was not really enabled, due to copy'n'paste typo.
2019-07-01 14:30:11 +02:00
Martin Jaeger 26ae254ec4 Fixing load overvoltage protection (closes #27) 2019-06-25 09:14:57 +02:00
hogthrob 14faa1f0e8 Working CAN (#35)
* Minor fix in documentation

* Make CAN compile again

* Now able to disable uart_serial

* Boots and runs CAN

Requires matching thingset-cpp library
The placement of the ts_can.process_asap/process_1s is a little hack,
but I did want to add even more ifdefs in the main method.
Renaming the functions could do the trick.
BTW, serial and CAN thingset can be run at the same time, no problems.

* Some cleanups in the CAN interface
2019-06-23 00:41:01 +02:00
hogthrob 7d02c92c7d Fix to move data_objects to flash only (#36)
Without this, the 1296 byte long data_objects is stored in RAM
(after being copied from flash)
2019-06-23 00:32:13 +02:00
hogthrob a4d5243286 Fixed Load_A not correctly reported issue (#34)
At compile time &(load.bus->current) will resolve to a different
(wrong) address than after assignment of "load_bus" to load.bus at runtime.
2019-06-22 12:52:37 +02:00
hoijui 6016c17b14 Minor code improvements from CppCheck & README updates (#32)
* log.h: fix signature of log_update_min_max_values

looks like it was changed in log.cpp, but not adjusted in log.h,
somewhen in the past

* adc_dma: only define variables if they are really required

* reduce scope of variables in interface_can.cpp

* `changed` was reassigned a value before the old one was used

* README: reformat flashing troubleshooting section

* README: punctuation fixes

* README: add troubleshooting tip for bad connection between nucleo and MPPT
2019-06-22 08:04:32 +02:00
hogthrob 32005a5642 Reduce stack usage: Make logo stored in flash, fix oled (#33)
This way the OLED display does not overwrite useful data since
the stack on the F072RB in mbed is just 1k and the logog is also 1k.
Also fixed minor issue in OLED display code (refactoring not done).
2019-06-22 07:29:40 +02:00
Martin Jäger b3aada7d4e Merge pull request #31 from hogthrob/master
Fixed NMC battery configuration calculation
2019-06-20 07:43:39 +02:00
Hogthrob f26fdce41f Fixed NMC battery configuration calculation
Now num_cell multiplier is used in all required places.
2019-06-20 07:26:39 +02:00
Martin Jaeger 690e204a16 Solar, bat and load power added to data objects 2019-06-18 17:04:33 +02:00
Martin Jaeger 375fcee514 New ThingSet features pub and auth included 2019-06-18 14:20:14 +02:00
Martin Jaeger ead6f2bffb Several small fixes for MPPT-2410-LC
- Battery temperature set to 25 degC if no external sensor connected
- EEPROM selection added to PCB config file
- UEXT power supply enable added to UEXT init functions

Firmware still gets stuck when OLED display is enabled... Error still to be found!
2019-06-16 15:50:01 +02:00
Martin Jaeger 96d26b5c34 Fixing stalled MCU if solar is connected before battery
(the change in dcdc.cpp fixes the failed unit-test in previous commit, which didn't find min/max functions)
2019-06-16 14:46:54 +02:00
Martin Jaeger 15d5f0ee71 DC/DC startup delay added to allow voltages to stabilize 2019-06-16 13:24:49 +02:00
Martin Jäger 4ee2353678 Merge pull request #29 from hoijui/patch-1
README: move setup before flashing & formatting
2019-06-13 15:06:45 +02:00
hoijui 4e70fc8917 README: move setup before flashing & formatting
Makes it a bit more newb-friendly, I think (being a newb).
2019-06-13 14:55:22 +02:00
Martin Jaeger 36cccfb63d DC/DC start duty cycle adjusted to reduce stress
Previously, the DC/DC started at 90% of the solar panel OCV to be closer to the MPP (at around 80% of OCV). This creates stress on the MOSFETs due to high inrush currents. In addtion to that, a high power panel might not be derated fast enough, which caused issues in the 12V/10A charge controller connected to a 280W panel. This commit improves the situation and starts the MPPT slightly below the measured solar voltage with low power.
2019-06-13 11:51:31 +02:00
Martin Jaeger 0e91c834ac Faster load short circuit protection via LPTIM
The PWM charge controllers don't have a fuse and need a reliable load short
circuit protection implemented in the microcontroller. The comparator
monitoring the load current now triggers LPTIM connected to the load
disable pin. This allows to switch off the load with a defined time delay
and glitch filter.

During tests, switching off the load in an ISR triggered by COMP2 did
not lead to reliable delays (especially in case of wake-up from sleep),
hence this alternative solution using LPTIM was implemented.

The load switch functions were moved from hardware.cpp to load.cpp.
2019-06-12 09:45:19 +02:00
Martin Jaeger f0301625d7 PCB names updated according to new type convention 2019-05-29 21:49:50 +02:00
Martin Jaeger d13d5263b0 10A MPPT v0.6 PCB definition updated 2019-05-29 21:23:32 +02:00
Martin Jaeger 5a264e9332 Load short circuit protection using analog COMP2
- Immediate load cut-off in case of current > 2x rated current (still to be fine-tuned)
- Using built-in comparator of STM32 MCU
- Currently only supported by PWM charge controller PCB, as it doesn't have an internal fuse
2019-05-27 16:41:30 +02:00
Martin Jaeger 977002b0e7 Sign for discharged Ah counter corrected 2019-05-27 11:21:35 +02:00
Martin Jaeger dec36143dd 12V/24V detection added and bat_charger restructured 2019-05-23 22:16:41 +02:00
Martin Jaeger b742fe6671 Energy calculation for PWM CC fixed
- Correct negative sign for incoming solar current
- Current multiplied with PWM duty cycle to get average current
- Min/max calculation moved to log.cpp
2019-05-15 11:06:49 +02:00
Martin Jaeger 05ccfb4c65 Missing log.cpp added 2019-05-08 08:58:37 +02:00
Martin Jaeger 7c75548193 DC bus type introduced and unit tests added 2019-05-07 18:56:04 +02:00
Martin Jaeger d9f7103e97 Starting test-driven development (TDD) with Unity
- Using PlatformIO's embedded unit testing with native environment
- mbed-dependent .cpp files escaped with #ifndef UNIT_TEST
- First tests for charger module added under test/ directory
2019-05-04 11:31:37 +02:00
Martin Jaeger 90666d697b Refactoring of files and function names
- Files for interfaces connected via UEXT are stored in separate uext/ directory
- UEXT init and process function names independent of connected module
- LED function names adjusted to start with leds_
- main.cpp structure simplified
2019-05-03 10:33:49 +02:00
Martin Jaeger ba9baf49c5 Fix error in EEPROM CRC calculation 2019-05-03 08:58:26 +02:00
Martin Jaeger 3fbb6df468 ThingSet version updated and data_objects.cpp adjusted 2019-05-02 10:33:02 +02:00
Martin Jaeger ff53f6ff99 New revisions of PWM and MPPT 10A boards included 2019-05-02 10:27:16 +02:00
Martin Jaeger 2ac2d1c3ad Basic processer-in-the-loop (PIL) test features added 2019-05-02 10:22:51 +02:00
Martin Jaeger 213ebf8c17 Improved load overcurrent and overvoltage diagnosis and protection 2019-04-28 17:29:57 +02:00
Martin Jaeger ca9997ec83 Temperature compensation for charging target voltage added 2019-04-19 15:43:47 +02:00
Martin Jaeger 879d86e59e Comments for correct battery settings in config.h template added 2019-04-18 12:28:18 +02:00
Martin Jaeger eaea5e1af2 Error in high-side (solar) current calculation corrected and logging of Bat and MCU max temperatures added 2019-04-18 12:26:00 +02:00
Martin Jaeger e05fd95e17 Current compensation for load switch thresholds added 2019-04-18 09:23:58 +02:00
Martin Jaeger 666ca02baf Min/max recordings added to serial pub message 2019-04-17 08:18:44 +02:00
Martin Jaeger 73a205f60f Battery and low-side current calculation corrected 2019-04-17 08:16:39 +02:00
Martin Jaeger f02688e6c0 EEPROM fix: Don't store data after start-up 2019-04-03 13:06:22 +02:00