diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8430052 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "avr_timer_driver"] + path = avr_timer_driver + url = https://OZ1CM@bitbucket.org/oz1cm/avr_timer_driver.git +[submodule "avr_gpio_driver"] + path = avr_gpio_driver + url = https://OZ1CM@bitbucket.org/oz1cm/avr_gpio_driver.git +[submodule "avr_adc_driver"] + path = avr_adc_driver + url = https://OZ1CM@bitbucket.org/oz1cm/avr_adc_driver.git +[submodule "cm_pid_regulator"] + path = cm_pid_regulator + url = https://OZ1CM@bitbucket.org/oz1cm/cm_pid_regulator.git +[submodule "cm_task_manager"] + path = cm_task_manager + url = https://OZ1CM@bitbucket.org/oz1cm/cm_task_manager.git diff --git a/.vs/solar_mppt_converter/v14/.atsuo b/.vs/solar_mppt_converter/v14/.atsuo new file mode 100644 index 0000000..5c64ea0 Binary files /dev/null and b/.vs/solar_mppt_converter/v14/.atsuo differ diff --git a/avr_adc_driver b/avr_adc_driver new file mode 160000 index 0000000..454fe39 --- /dev/null +++ b/avr_adc_driver @@ -0,0 +1 @@ +Subproject commit 454fe395d1ada6520206e713aa23faa79a71e095 diff --git a/avr_global_config.h b/avr_global_config.h new file mode 100644 index 0000000..99ba42b --- /dev/null +++ b/avr_global_config.h @@ -0,0 +1,37 @@ +/* + * avr_global_config.h + * + * Created: 11-05-2025 19:16:05 + * Author: Christian L. V. Madsen (OZ1CM) + */ + + +#ifndef AVR_GLOBAL_CONFIG_H_ +#define AVR_GLOBAL_CONFIG_H_ +#include +#include "avr_gpio_driver/avr_gpio.h" + +#define AVR_ATTINY_414 +#define F_CPU 16000000 + +// Input Current sense +#define PORT_IIN_SENSE GPIO_PORTA +#define PIN_IIN_SENSE 1 + +// Input Voltage Sense +#define PORT_VIN_SENSE GPIO_PORTA +#define PIN_VIN_SENSE 2 + +// Output Current sense +#define PORT_IOUT_SENSE GPIO_PORTA +#define PIN_IOUT_SENSE 3 + +// Output Voltage Sense +#define PORT_VOUT_SENSE GPIO_PORTA +#define PIN_VOUT_SENSE 4 + +// PWM Output +#define PORT_BUCK_PWM GPIO_PORTB +#define PIN_BUCK_PWM 0 + +#endif /* AVR_GLOBAL_CONFIG_H_ */ \ No newline at end of file diff --git a/avr_gpio_driver b/avr_gpio_driver new file mode 160000 index 0000000..f59eff5 --- /dev/null +++ b/avr_gpio_driver @@ -0,0 +1 @@ +Subproject commit f59eff5cb163dd3f02eeb0a5d909e1bb20d731d5 diff --git a/avr_timer_driver b/avr_timer_driver new file mode 160000 index 0000000..59fe4e6 --- /dev/null +++ b/avr_timer_driver @@ -0,0 +1 @@ +Subproject commit 59fe4e65c75ad595f09ffff7551fb7ef726c3f60 diff --git a/cm_pid_regulator b/cm_pid_regulator new file mode 160000 index 0000000..c3b9479 --- /dev/null +++ b/cm_pid_regulator @@ -0,0 +1 @@ +Subproject commit c3b9479903f3399910b0036da721ba70ee8df8b9 diff --git a/cm_task_manager b/cm_task_manager new file mode 160000 index 0000000..c6b3c93 --- /dev/null +++ b/cm_task_manager @@ -0,0 +1 @@ +Subproject commit c6b3c93074fa24dace48e16a935f260dc3989c4c diff --git a/main.c b/main.c new file mode 100644 index 0000000..68b47cb --- /dev/null +++ b/main.c @@ -0,0 +1,18 @@ +/* + * solar_mppt_converter.c + * + * Created: 11-05-2025 19:01:26 + * Author : Christian L. V. Madsen (OZ1CM) + */ + +#include + + +int main(void) +{ + /* Replace with your application code */ + while (1) + { + } +} + diff --git a/mppt_app.c b/mppt_app.c new file mode 100644 index 0000000..e9be61a --- /dev/null +++ b/mppt_app.c @@ -0,0 +1,25 @@ +/* + * mppt_app.c + * + * Created: 11-05-2025 21:49:02 + * Author: Christian L. V. Madsen (OZ1CM) + */ +#include "mppt_app.h" + + +// We are using resistor dividers that has a divide down factor of 8. +uint16_t voltLowToHigh(uint16_t low_voltage){ + + if(low_voltage > 2500) return 20000; + + return low_voltage << 3; +} + +// We are using differential amplifier with gain of 16. +uint16_t voltToCurrent(uint16_t low_voltage){ + + if(low_voltage > 2500) return 1000; + + return low_voltage << 4; + +} \ No newline at end of file diff --git a/mppt_app.h b/mppt_app.h new file mode 100644 index 0000000..b266aa9 --- /dev/null +++ b/mppt_app.h @@ -0,0 +1,16 @@ +/* + * mppt_app.h + * + * Created: 11-05-2025 21:48:42 + * Author: Christian L. V. Madsen (OZ1CM) + */ + + +#ifndef MPPT_APP_H_ +#define MPPT_APP_H_ + + + + + +#endif /* MPPT_APP_H_ */ \ No newline at end of file diff --git a/solar_mppt_converter.atsln b/solar_mppt_converter.atsln new file mode 100644 index 0000000..5bb037d --- /dev/null +++ b/solar_mppt_converter.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "solar_mppt_converter", "solar_mppt_converter.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/solar_mppt_converter.componentinfo.xml b/solar_mppt_converter.componentinfo.xml new file mode 100644 index 0000000..af880e9 --- /dev/null +++ b/solar_mppt_converter.componentinfo.xml @@ -0,0 +1,86 @@ + + + + + + + Device + Startup + + + Atmel + 1.10.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.10.348\include\ + + include + C + + + include/ + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.10.348\include\avr\iotn414.h + + header + C + R5QjRc+IBjtCXYuU6PYTbg== + + include/avr/iotn414.h + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.10.348\templates\main.c + template + source + C Exe + v/wDU2ZjZ/2x3ilPyP0C0w== + + templates/main.c + Main file (.c) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.10.348\templates\main.cpp + template + source + C Exe + mkKaE95TOoATsuBGv6jmxg== + + templates/main.cpp + Main file (.cpp) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.10.348\gcc\dev\attiny414 + + libraryPrefix + GCC + + + gcc/dev/attiny414 + + + + + ATtiny_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.10.348/Atmel.ATtiny_DFP.pdsc + 1.10.348 + true + ATtiny414 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/solar_mppt_converter.cproj b/solar_mppt_converter.cproj new file mode 100644 index 0000000..3cf6b5a --- /dev/null +++ b/solar_mppt_converter.cproj @@ -0,0 +1,165 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + dce6c7e3-ee26-4d79-826b-08594b9ad897 + ATtiny414 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + solar_mppt_converter + solar_mppt_converter + solar_mppt_converter + Native + true + false + true + true + + + true + + 2 + 0 + 0 + + + + + + -mmcu=attiny414 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\gcc\dev\attiny414" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\include\ + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\include\ + + + + + + + + + -mmcu=attiny414 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\gcc\dev\attiny414" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\include\ + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.10.348\include\ + + + Default (-Wa,-g) + + + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + + + + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + \ No newline at end of file