Skip to content

OPALIB PID Current mode


OwnTech Power API Library PID Current mode provides a PID control in current mode.

This library automatically configures the driver modules required for the OwnTech Power Converter to work.

How to use

Enable the library

To enable the library, just uncomment the pid_current library in src/owntech.ini.

Then, include the library header in main.cpp:

Memo: the standalone PID Current library configuration is as follows:


Using OPALIB PID Current

  • Add the following line to your main: #include "opalib_pid_current_mode.h".
  • Configure the core modules, e.g. using OPALIB Quick Start's init voltage function at the beginning of your main().
  • Initialize the pid with opalib_pid_current_init()
  • Run the PID calculation periodically with opalib_pid_current_periodic_task() in order to update the duty cycle in the PWM.

Example of library use in combination with Library Quick start

Library structure

  • $(PROJECTDIR)/src/
    • opalib_pid_current_mode.c Main source file
    • opalib_pid_current_mode.h List of public functions implemented in library