diff --git a/OWNVERTER/BLDC_hall_sensor/README.md b/OWNVERTER/BLDC_hall_sensor/README.md index 32b84759..11bce418 100644 --- a/OWNVERTER/BLDC_hall_sensor/README.md +++ b/OWNVERTER/BLDC_hall_sensor/README.md @@ -10,22 +10,22 @@ Here is a detailed explanation of the six sectors and the switching sequence for The six sectors are determined based on the Hall effect sensor outputs, which change as the rotor rotates. The Hall sensors provide three signals (H1, H2, H3), which can be interpreted as a 3-bit binary code. Each unique combination of these signals corresponds to one of the six sectors. -In code this is done with : +In code, this is done with: ``` hall_state = hall1_value + 2 * hall2_value + 4 * hall3_value; ``` Note that this should be adapted depending on the way phases and hall effect sensors are connected to the inverter. It might be necessary to permute the hall values to run the motor correctly. -### Controling the motor +### Controlling the motor -In each sequence we supply only two windings using two legs of the ownverter. -Then if for example we supply phase A and B, the associate phase to phase voltage will +In each sequence we supply only two windings using two legs of the OWNVERTER. +Then, for example, if we supply phase A and B, the associated phase-to-phase voltage will be: $U_{AB} = (2.\textsf{duty\\\_cycle} - 1). U_{dc}$ -In this example duty_cycle can be increased or lowered by pressing `u` and `d` in the serial monitor. +In this example, duty_cycle can be increased or lowered by pressing `u` and `d` in the serial monitor. It should directly affect motor speed. ### Commutation Sequence diff --git a/OWNVERTER/FOC_hall_sensor/README.md b/OWNVERTER/FOC_hall_sensor/README.md index a5fe8937..e0c0b2cb 100644 --- a/OWNVERTER/FOC_hall_sensor/README.md +++ b/OWNVERTER/FOC_hall_sensor/README.md @@ -1,28 +1,28 @@ -# Field Oriented Control with hall Sensors. +# Field Oriented Control with Hall sensors ## Introduction. -This example show how to regulate the torque in a Permanent Magnet Synchonous Machine +This example shows how to regulate the torque in a Permanent Magnet Synchronous Machine (PMSM) using a Field Oriented Control (FOC) algorithm. -The FOC is well adapted to PMSM with sinusoïdal back-emf (electro -motive forces). The FOC algorithm generate smooth torque value. +The FOC is well adapted to PMSM with sinusoidal back-EMF (electromotive +forces). The FOC algorithm generates smooth torque values. The current regulators (Proportional-Integral) are in the _"dq"_ frame where values should be constant during steady state operation. To apply this technique we should have an acquisition of a continuous angle value [0, 2π[. -But for _"cost"_ reasons or integrations with other algorithms (BLDC), some motor have +But for _"cost"_ reasons or integrations with other algorithms (BLDC), some motors have only 3 discrete hall sensors value to indicate the rotor position. -In this case we use a PLL (Phased-Lock-Loop) filter to _"build"_ a contiuous equivalent +In this case we use a PLL (phase-locked loop) filter to _"build"_ a continuous equivalent angle from the 3 discrete signals.  ## Import libraries to use it. -This example use some software components which are in the owntech `control_library`. -then you must import it by inserting the following line in the `platformio.ini` file. +This example uses some software components which are in the OwnTech `control_library`. +Then you must import it by inserting the following line in the `platformio.ini` file. ```ini lib_deps= @@ -32,7 +32,7 @@ lib_deps= ## How the _"sector"_ table is built. -According _"dq"_ transformation, the formula of the back emf should be : +According to the _"dq"_ transformation, the formula of the back EMF should be: $E_{u} = - K_{fem}.\omega .sin(\theta)$ @@ -44,7 +44,7 @@ Where $\theta$ is the _"electric"_ angle and $\omega$ is the _"electric"_ pulsat For simplicity reasons we assume that the value $K_{fem}.\omega = 1$. -Then the hall sensors must be synchronised with the hall sensors as the following: +Then the Hall sensors must be synchronized with the back-EMF as follows:  @@ -52,7 +52,7 @@ According these assumptions, we define a variable `hall_index` which is computed $hall_{index} = Hall_u . 2^0+ Hall_v . 2^1 + Hall_w . 2^2$ -We also define a `sector` variable which evolve like a quantification of a continuous +We also define a `sector` variable which evolves like a quantification of a continuous angle value, then we can make a lookup table between these two variables.  @@ -66,19 +66,19 @@ angle value, then we can make a lookup table between these two variables. | 4 | 5 | | 5 | 1 | -## Use this example +## Use this example -- Wire the motor hall effect sensors and power phase. The colors of the hall effect sensors should match the color of the power phase. -- Flash the example to the OwnVerter board. +- Wire the motor Hall effect sensors and power phases. The colors of the Hall effect sensors should match the color of the power phases. +- Flash the example to the OWNVERTER board. - In the serial terminal press `p` to start the motor. -- At that point, there is no torque reference as `Iq_ref` is equal to `0` -- Increase the torque reference by pressing `u`. The torque reference is incremented by `0.1A` +- At that point, there is no torque reference as `Iq_ref` is equal to `0`. +- Increase the torque reference by pressing `u`. The torque reference is incremented by `0.1 A`. - Increase the torque reference until the motor starts spinning. -- Stop the motor by pressing `i` -- You can retrieve live record by pressing `r`. It will download a data_record containing all declared scope values. +- Stop the motor by pressing `i`. +- You can retrieve a live record by pressing `r`. It will download a data record containing all declared scope values. - By default the recording is triggered by entering `power mode` (by pressing `p`). - Alternatively you can press `q` to trigger manually the recording at a different instant, or to reset the trigger -- Plot the values by clicking `Plot recording` in `OwnTech` platformio actions. +- Plot the values by clicking `Plot recording` in `OwnTech` PlatformIO actions. - Live data records can also be plotted using OwnPlot by pressing `m`. This way, the recording will be sent as an infinite loop to OwnPlot. | Control state | Comment | @@ -86,4 +86,4 @@ angle value, then we can make a lookup table between these two variables. | 0 | In this state, the controller is calculating the current offset | | 1 | In this state, the controller is idle | | 2 | In this state, the controller is in power mode | -| 3 | In this state, the controller is in error mode. The error mode is entered by repetedely (repedely being defined by `error_counter`) fulfilling the following condition : `I1_Low` going beyond the bounds `[-AC_CURRENT_LIMIT;+AC_CURRENT_LIMIT]`, `I2_Low` going beyond the bounds `[-AC_CURRENT_LIMIT;+AC_CURRENT_LIMIT]` or `I_High` exceding `DC_CURRENT_LIMIT` | +| 3 | In this state, the controller is in error mode. The error mode is entered by repeatedly (as defined by `error_counter`) fulfilling the following condition: `I1_Low` going beyond the bounds `[-AC_CURRENT_LIMIT;+AC_CURRENT_LIMIT]`, `I2_Low` going beyond the bounds `[-AC_CURRENT_LIMIT;+AC_CURRENT_LIMIT]` or `I_High` exceeding `DC_CURRENT_LIMIT` | diff --git a/README.md b/README.md index 5caf6b72..f276a70f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,20 @@ Welcome to the OwnTech examples repository. -Here you can find ready to be used example for [SPIN](https://github.com/owntech-foundation/SPIN) and [TWIST](https://github.com/owntech-foundation/TWIST). +Here you can find ready-to-use examples for [SPIN](https://github.com/owntech-foundation/SPIN), [TWIST](https://github.com/owntech-foundation/TWIST), and OWNVERTER. # Examples for TWIST -- DC DC topology examples +- Basic examples + - [Open Loop PWM](TWIST/Basic/Open-Loop_PWM/README.md) + +- DC-DC topology examples - [Buck voltage mode](TWIST/DC_DC/buck_voltage_mode/README.md) - [Buck current mode](TWIST/DC_DC/buck_current_mode/README.md) - [Boost voltage mode](TWIST/DC_DC/boost_voltage_mode/README.md) - [Interleaved Buck](TWIST/DC_DC/interleaved/README.md) - - [Current ripple measure in buck voltage mode](TWIST/DC_DC/current_ripple_measurement/README.md) + - [Independent](TWIST/DC_DC/independent/README.md) + - [Simple scope example](TWIST/DC_DC/scope_simple_example/README.md) + - [Current ripple measurement in buck voltage mode](TWIST/DC_DC/current_ripple_measurement/README.md) - Microgrid examples - [AC client server](TWIST/Microgrid/AC_client_server/README.md) @@ -17,15 +22,25 @@ Here you can find ready to be used example for [SPIN](https://github.com/owntech - [DC client server](TWIST/Microgrid/DC_client_server/README.md) - [DC droop](TWIST/Microgrid/DC_droop/README.md) - - DC AC topology examples +- DC-AC topology examples - [Grid forming](TWIST/DC_AC/grid_forming/README.md) - [Grid following](TWIST/DC_AC/grid_following/README.md) +- Communication examples + - [CAN Communication](TWIST/Communication/CAN/README.md) + - [Python Communication Protocol](TWIST/Communication/python_comm_library/README.md) + +# Examples for OWNVERTER + +- Motor control examples + - [BLDC motor with hall sensor](OWNVERTER/BLDC_hall_sensor/README.md) + - [Motor control using FOC and hall sensors](OWNVERTER/FOC_hall_sensor/README.md) + # Examples for SPIN - ADC use examples - - [Software trigerred ADC](SPIN/ADC/adc_software_trigger/README.md) - - [HRTIM trigerred ADC](SPIN/ADC/adc_hrtim_trigger/README.md) + - [Software triggered ADC](SPIN/ADC/adc_software_trigger/README.md) + - [HRTIM triggered ADC](SPIN/ADC/adc_hrtim_trigger/README.md) - DAC use examples - [Signal generation](SPIN/DAC/signal_generation/README.md) @@ -34,6 +49,7 @@ Here you can find ready to be used example for [SPIN](https://github.com/owntech - [Blinky](SPIN/LED/blinky/README.md) - PWM use examples + - [PWM burst mode control](SPIN/PWM/burst_mode/README.md) - [PWM duty cycle control](SPIN/PWM/duty_cycle_setting/README.md) - [PWM phase shift control](SPIN/PWM/phase_shift/README.md) - [Multiple PWM operation](SPIN/PWM/multiple_pwm/README.md) diff --git a/SPIN/ADC/adc_hrtim_trigger/README.md b/SPIN/ADC/adc_hrtim_trigger/README.md index 51bfd3e1..dafad69a 100644 --- a/SPIN/ADC/adc_hrtim_trigger/README.md +++ b/SPIN/ADC/adc_hrtim_trigger/README.md @@ -1,19 +1,19 @@ # Triggering measure from ADC via HRTIM trigger -An ADC, or Analog-to-Digital Converter, is a crucial component in modern electronics that converts continuous analog signals into discrete digital data. In simpler terms, it takes real-world phenomena, like sound or temperature, and turns them into numbers that a computer can understand and process. This conversion is essential for various applications, in power electronics it allows us to get real-time measures from the circuit like voltage and current. +An ADC, or Analog-to-Digital Converter, is a crucial component in modern electronics that converts continuous analog signals into discrete digital data. In simpler terms, it takes real-world phenomena, like sound or temperature, and turns them into numbers that a computer can understand and process. This conversion is essential for various applications, in power electronics it allows us to get real-time measurements from the circuit like voltage and current. -The spin uses the stm32G4 MCU, which has a high resolution timer (HRTIM) which can produce high resolution PWM. This example will show you how to use the HRTIM in order to trigger the measures. +The SPIN uses the STM32G4 MCU, which has a high-resolution timer (HRTIM) which can produce high-resolution PWM. This example will show you how to use the HRTIM in order to trigger the measurements. ## Hardware setup and requirements  *figure 1* -You will need : +You will need: - 1 SPIN -- A usb-c cable to supply power to the spin, and also upload the code from computer -- A signal generator to create a waveform to measure it from ADC, it can be sinewave, triangle wave...etc. This signal must between **0V and 2.048V** +- A USB-C cable to supply power to the SPIN, and also upload the code from a computer +- A signal generator to create a waveform to measure it from the ADC, it can be a sine wave, triangle wave...etc. This signal must be between **0 V and 2.048 V** There is a total of 8 possible pins from where you can get synchronous analog measurements : @@ -33,14 +33,14 @@ In this example we connect the signal generator to pin `35`, and a `GND` pin. ## Software setup -The HRTIM has 6 different timer (A,B,C,D,E,F) but you can choose up to two of them to trigger the measures. In this example we'll show you how you can use one of them **the timer A**. +The HRTIM has 6 different timers (A, B, C, D, E, F) but you can choose up to two of them to trigger the measurements. In this example we'll show you how you can use one of them: **timer A**. -On the picture below, you can see the waveform of the timer A pwm, the carrier, the duty cycle and the colored zone represents the timing where the measures is triggered. +In the picture below, you can see the waveform of the timer A PWM, the carrier, the duty cycle and the colored zone represents the timing where the measurement is triggered.  *figure 2* -The measure is triggered with the same frequency as the switching frequency, the measure is done around the trough of the carrier on the positive slope. We will explain here which functions to call to setup the ADC trigger. +The measurement is triggered with the same frequency as the switching frequency; the measurement is done around the trough of the carrier on the positive slope. We will explain here which functions to call to set up the ADC trigger. First of all, we start by initializing the PWMA : @@ -52,7 +52,7 @@ First of all, we start by initializing the PWMA : spin.pwm.initUnit(PWMA); // timer initialization ``` -The function `setAdcEdgeTrigger` allows us to choose where we want to trigger the measures : on the positive slope `EdgeTrigger_up` of the carrier like in fig.2, or the negative slope `EdgeTrigger_down` of the carrier. +The function `setAdcEdgeTrigger` allows us to choose where we want to trigger the measurements: on the positive slope `EdgeTrigger_up` of the carrier like in fig.2, or the negative slope `EdgeTrigger_down` of the carrier. After the initialization of the PWM, we can link it to a trigger : @@ -62,21 +62,21 @@ After the initialization of the PWM, we can link it to a trigger : spin.pwm.enableAdcTrigger(PWMA); // enable the trigger ``` We are linking PWMA to a trigger, here `ADC_2`. -There is two ADCs that support synchronous data acquisition : `ADC_1` and `ADC_2`. +There are two ADCs that support synchronous data acquisition: `ADC_1` and `ADC_2`. -`setAdcTriggerInstant` will set the moment when we trigger a measure with a parameter between 0 (corresponding to the trough of the carrier)and 1 (corresponding to the crest of the carrier). Here we took 0.06, so we'll get the data around the trough of the carrier (as we have seen on fig.2) +`setAdcTriggerInstant` will set the moment when we trigger a measurement with a parameter between 0 (corresponding to the trough of the carrier) and 1 (corresponding to the crest of the carrier). Here we took 0.06, so we'll get the data around the trough of the carrier (as we have seen on fig.2) And finally, we set the `ADC2` to be triggered by the PWM `TRIG_PWM`. ```cpp spin.adc.configureTriggerSource(ADC_2, TRIG_PWM); // ADC 2 configured to be triggered by the PWM ``` -We use the 5th channel of the adc, which is the gpio `35` on the spin (also numbered as C4). To enable the acquisition from this pin, we use the function `enableAcquisition`: +We use the 5th channel of the ADC, which is the GPIO `35` on the SPIN (also numbered as C4). To enable the acquisition from this pin, we use the function `enableAcquisition`: ```cpp spin.data.enableAcquisition(35, ADC_2); // Enable acquisition for ADC2, for channel 5 (localized in GPIO C4 / pin number 35) ``` -When are now set, we must be sure that there is a critical task defined and active, and make sure that `PWMA` is active because it is now the ADC trigger source. +When everything is now set, we must be sure that there is a critical task defined and active, and make sure that `PWMA` is active because it is now the ADC trigger source. ```cpp spin.pwm.startDualOutput(PWMA); @@ -88,7 +88,7 @@ You can also use `ADC_1` to get a second independent trigger event, for instance we can bind `PWMC`to `ADC_1`. Below, we reproduce the same step but by using the `ADC1` channel 2 localized on pin `30` (PA1). -start PWMC : +Start PWMC: ```cpp spin.pwm.setFrequency(200000); // Set frequency of pwm @@ -98,14 +98,14 @@ start PWMC : spin.pwm.initUnit(PWMC); // timer initialization ``` -link `ADC_1` to `PWMC` : +Link `ADC_1` to `PWMC`: ```cpp spin.pwm.setAdcTrigger(PWMC, ADC_1); // PWMA is linked to ADCTRIG_1 spin.pwm.setAdcTriggerInstant(PWMC, 0.06); // set the trigger instant spin.pwm.enableAdcTrigger(PWMC); // enable the trigger ``` -then set `ADC1` channel 2 to be triggered by the PWM : +Then set `ADC1` channel 2 to be triggered by the PWM: ```cpp spin.adc.configureTriggerSource(ADC_1, TRIG_PWM); // ADC 1 configured to be triggered by the PWM @@ -114,6 +114,6 @@ then set `ADC1` channel 2 to be triggered by the PWM : ## Expected results -The analog value measured from the adc is stored inside the variable `adc_value`, which is printed in the serial monitor every 100ms you can then watch the measured on [ownplot](https://github.com/owntech-foundation/OwnPlot). +The analog value measured from the ADC is stored inside the variable `adc_value`, which is printed in the serial monitor every 100 ms. You can then watch the measurements on [OwnPlot](https://github.com/owntech-foundation/OwnPlot). -If everything went correctly, you should observe the same waveform on ownplot that you generate via the signal generator. \ No newline at end of file +If everything went correctly, you should observe the same waveform on OwnPlot that you generate via the signal generator. diff --git a/SPIN/ADC/adc_software_trigger/README.md b/SPIN/ADC/adc_software_trigger/README.md index ce727c5d..c7240300 100644 --- a/SPIN/ADC/adc_software_trigger/README.md +++ b/SPIN/ADC/adc_software_trigger/README.md @@ -1,20 +1,20 @@ # Triggering measure from ADC via software trigger -An ADC, or Analog-to-Digital Converter, is a crucial component in modern electronics that converts continuous analog signals into discrete digital data. In simpler terms, it takes real-world phenomena, like sound or temperature, and turns them into numbers that a computer can understand and process. This conversion is essential for various applications, in power electronics it allows us to get real-time measures from the circuit like voltage and current. +An ADC, or Analog-to-Digital Converter, is a crucial component in modern electronics that converts continuous analog signals into discrete digital data. In simpler terms, it takes real-world phenomena, like sound or temperature, and turns them into numbers that a computer can understand and process. This conversion is essential for various applications, in power electronics it allows us to get real-time measurements from the circuit like voltage and current. -This example will show you how to get measures from the ADC by calling a function that will trigger the measures : this is what we call **a software trigger**. +This example will show you how to get measurements from the ADC by calling a function that will trigger the measurements: this is what we call **a software trigger**. ## Hardware setup and requirements  -You will need : +You will need: -- 1 spin -- A usb-c cable to supply power to the spin, and also upload the code from computer -- A signal generator to create a waveform to measure it from ADC, it can be sinewave, triangle wave...etc. This signal must between **0V and 2.048V** +- 1 SPIN +- A USB-C cable to supply power to the SPIN, and also upload the code from a computer +- A signal generator to create a waveform to measure it from the ADC, it can be a sine wave, triangle wave...etc. This signal must be between **0 V and 2.048 V** -Connect the signal generator to pin C4, and gnd. +Connect the signal generator to pin C4, and GND. ## Software setup @@ -23,19 +23,19 @@ The ADC 2 is used here, it is initialized like this : ```cpp spin.adc.configureTriggerSource(2, software); // ADC 2 configured in software mode ``` -We use the 5th channel of the adc, which is the gpio C4 on the spin (also numbered as pin 35). To enable the acquisition from this pin, we use the function `enableAcquisition`: +We use the 5th channel of the ADC, which is the GPIO C4 on the SPIN (also numbered as pin 35). To enable the acquisition from this pin, we use the function `enableAcquisition`: ```cpp data.enableAcquisition(2, 35) // Enable acquisition for ADC2, for channel 5 (localized in GPIO C4 / pin number 35) ``` -When we want to retrieve measures from ADC2 all we need to do is trigger ADC2 and retrieve measured value in GPIO C4 / pin number 35 : +When we want to retrieve measurements from ADC2 all we need to do is trigger ADC2 and retrieve the measured value in GPIO C4 / pin number 35: ```cpp spin.data.triggerAcquisition(2); adc_value =spin.data.getLatestValue(2, 35); ``` -There is a total of 8 possible pin from where you can get analog measures : +There is a total of 8 possible pins from where you can get analog measurements: | GPIO | PIN number | ADC and channels | |------|------------|---------------------------------| @@ -48,10 +48,10 @@ There is a total of 8 possible pin from where you can get analog measures : | PC0 | 24 | ADC1 channel 6 / ADC2 channel 6 | | PB15 | 6 | ADC4 channel 5 | -You can configure any of the above ADC with same steps. +You can configure any of the above ADCs with the same steps. -## Expetected results +## Expected results -The analog value measured from the adc is stored inside the variable `adc_value`, which is printed in the serial monitor every 100ms you can then watch the measured on [ownplot](https://github.com/owntech-foundation/OwnPlot). +The analog value measured from the ADC is stored inside the variable `adc_value`, which is printed in the serial monitor every 100 ms. You can then watch the measurements on [OwnPlot](https://github.com/owntech-foundation/OwnPlot). -If everything went correctly, you should observe the same waveform on ownplot that you generate via the signal generator. \ No newline at end of file +If everything went correctly, you should observe the same waveform on OwnPlot that you generate via the signal generator. diff --git a/SPIN/DAC/signal_generation/README.md b/SPIN/DAC/signal_generation/README.md index c3c9cb7c..e010db01 100644 --- a/SPIN/DAC/signal_generation/README.md +++ b/SPIN/DAC/signal_generation/README.md @@ -7,13 +7,13 @@ A DAC, or Digital-to-Analog Converter, converts digital signals into correspondi  *figure 1* -You will need : +You will need: -- 1 spin -- A usb-c cable to supply power to the spin, and also upload the code from computer +- 1 SPIN +- A USB-C cable to supply power to the SPIN, and also upload the code from a computer - An oscilloscope to watch the DAC output -Connect the oscilloscope to gpio PA6 (the DAC output). +Connect the oscilloscope to GPIO PA6 (the DAC output). ## Software setup @@ -26,18 +26,18 @@ We start by initializing the DAC : spin.dac.setConstValue(2, 1, 0); // Setting DAC 2 channel 1 to 0 ``` -The function `setConstValue` will convert numerical value (from 0 to 4096) to a voltage (between 0 and 2.048) with the DAC. +The function `setConstValue` will convert a numerical value (from 0 to 4096) to a voltage (between 0 and 2.048) with the DAC. -In the background task (called every 100ms), is increasing the value send to the DAC : +In the background task (called every 100 ms), the code increases the value sent to the DAC: ```cpp dac_value = (dac_value + 100)%4096; spin.dac.setConstValue(2, 1, dac_value); ``` -You can also reproduce the same step to use DAC1 channel 1 localized in gpio PA4. +You can also reproduce the same step to use DAC1 channel 1 localized in GPIO PA4. ## Expected result -You should see a sawtooth on the DAC output. \ No newline at end of file +You should see a sawtooth on the DAC output. diff --git a/SPIN/LED/blinky/README.md b/SPIN/LED/blinky/README.md index f3d4b411..9ecd3994 100644 --- a/SPIN/LED/blinky/README.md +++ b/SPIN/LED/blinky/README.md @@ -1,20 +1,20 @@ -# Blinking a led +# Blinking an LED -Here is a simple example to start with SPIN : making a led blink. +Here is a simple example to start with SPIN: making an LED blink. ## Hardware setup and requirements  *figure 1* -You will need : +You will need: -- 1 spin -- A usb-c cable to supply power to the spin, and also upload the code from computer +- 1 SPIN +- A USB-C cable to supply power to the SPIN, and also upload the code from a computer ## Software setup -The led is toggled in the background task called each 1s, which means the leed will blink at the rate of 1s : +The LED is toggled in the background task called every 1 s, which means the LED will blink at the rate of 1 s. ```cpp spin.led.toggle(); @@ -22,4 +22,4 @@ The led is toggled in the background task called each 1s, which means the leed w ## Expected result -Visual result : the led should turn on and off. \ No newline at end of file +Visual result: the LED should turn on and off. diff --git a/SPIN/PWM/burst_mode/README.md b/SPIN/PWM/burst_mode/README.md index 63eb7556..330dd24d 100644 --- a/SPIN/PWM/burst_mode/README.md +++ b/SPIN/PWM/burst_mode/README.md @@ -1,17 +1,17 @@ # Burst mode PWM -Burst mode is an Advanced PWM capability. In few words, instead of generating a continuous stream of pulses, burst mode sends groups of PWM (Pulse Width Modulation) signals at regular intervals. This method reduces energy consumption, minimizes heat generation, and is especially useful in applications like motor control, LED dimming, and power supplies. +Burst mode is an advanced PWM capability. In a few words, instead of generating a continuous stream of pulses, burst mode sends groups of PWM (Pulse Width Modulation) signals at regular intervals. This method reduces energy consumption, minimizes heat generation, and is especially useful in applications like motor control, LED dimming, and power supplies. -In power electronics, Burst mode PWM is used two reduce losses under light load conditions -In this example we'll show you how to setup burst mode for two phase shifted H-bridges. -It could be used to control a Dual Active Bridge (DAB) in Single Phase Shift modulation modulation under light load conditions. +In power electronics, burst mode PWM is used to reduce losses under light load conditions. +In this example we'll show you how to set up burst mode for two phase-shifted H-bridges. +It could be used to control a Dual Active Bridge (DAB) in Single Phase Shift modulation under light load conditions. ## Hardware setup and requirements -You will need : +You will need: -- A spin -- A usb-c cable to supply the spin +- A SPIN +- A USB-C cable to supply the SPIN - An oscilloscope to observe PWM waveform PWMs can be observed on: @@ -24,7 +24,7 @@ PWMs can be observed on: During initialization: -- The frequency for the pwm is set to 200kHz, you are free to choose another value. +- The frequency for the PWM is set to 200 kHz, you are free to choose another value. - PWMA and PWMC for the first H-bridge. - PWME and PWMF for the second H-bridge. @@ -41,7 +41,7 @@ During initialization: spin.pwm.initUnit(PWMF); ``` -- All PWM are initialized in phase. +- All PWMs are initialized in phase. ```cpp /* Set initial phase shifts*/ @@ -52,8 +52,8 @@ During initialization: Burst mode initialization: -- Burst mode duty is set to 8. It means that PWM output will be void during 8 PWM events -- Burst mode Period is set to 10. It means that PWM output will be off for 8 PWM event every 10 PWM events. +- Burst mode duty is set to 8. It means that PWM output will be off during 8 PWM events. +- Burst mode period is set to 10. It means that PWM output will be off for 8 PWM events every 10 PWM events. ```cpp uint8_t burst_duty = 8; @@ -80,11 +80,11 @@ You can control the burst mode period from the serial monitor : - press `t` to increase the burst mode period - press `y` to decrease the burst mode period -On the oscilloscope you should observe +On the oscilloscope you should observe: - That PWMs are ON only **two periods out of ten** - That you can control the burst duty and period to change the number of active PWM periods -- That you can control the second H-bridge (PWME and PWMF) phase shift from the first H-bridge (PWMA PWMC) +- That you can control the second H-bridge (PWME and PWMF) phase shift from the first H-bridge (PWMA, PWMC) **NB:** @@ -95,4 +95,4 @@ PWMs can be observed on: - Pin 7 and PIN 9 for PWMF -See [OwnPlot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. \ No newline at end of file +See [OwnPlot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. diff --git a/SPIN/PWM/duty_cycle_setting/README.md b/SPIN/PWM/duty_cycle_setting/README.md index 914646d8..815fa357 100644 --- a/SPIN/PWM/duty_cycle_setting/README.md +++ b/SPIN/PWM/duty_cycle_setting/README.md @@ -4,24 +4,24 @@ In the context of Pulse Width Modulation (PWM), the duty cycle refers to the pro In power electronics, such as motor control, power supplies, and voltage regulation, PWM is a widely used technique for controlling the amount of power delivered to a load. The duty cycle of the PWM signal determines the average power delivered to the load. By adjusting the duty cycle, engineers can control the speed of motors, regulate voltage levels, and efficiently manage power consumption. -In this example we'll see how to generate a PWM, an control the duty cycle. +In this example we'll see how to generate a PWM, and control the duty cycle. ## Hardware setup and requirements -The spin can use up to 5 different PWM : PWMA, PWMC, PWMD, PWME and PWMF. This example will detail how to work with one of them : PWMA. +The SPIN can use up to 5 different PWMs: PWMA, PWMC, PWMD, PWME and PWMF. This example will detail how to work with one of them: PWMA.  *Figure 1* PWMA has two complementary channels : -- PWMA1 on gpio A8 -- PWMA2 on gpio A9 +- PWMA1 on GPIO A8 +- PWMA2 on GPIO A9 -You will need : +You will need: -- A spin -- A usb-c cable to supply the spin +- A SPIN +- A USB-C cable to supply the SPIN - An oscilloscope to watch PWM waveform ## Software setup @@ -33,7 +33,7 @@ First we start by initializing the PWMA : spin.pwm.initUnit(PWMA); // timer initialization ``` -The frequency for the pwm is initalized to 200kHz but you are free to choose another value. +The frequency for the PWM is initialized to 200 kHz but you are free to choose another value. The duty cycle is updated in the high-speed control task : @@ -45,10 +45,10 @@ You can control the duty cycle from the serial monitor : - press `u` to increase the duty cycle - press `d` to decrease the duty cycle -See [ownplot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. +See [OwnPlot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. ## Expected result  -On the oscilloscope you should observe two complementary PWM and their evolution when you increase/decrease the duty cycle. \ No newline at end of file +On the oscilloscope you should observe two complementary PWMs and their evolution when you increase/decrease the duty cycle. diff --git a/SPIN/PWM/multiple_pwm/README.md b/SPIN/PWM/multiple_pwm/README.md index e64928db..d03d6f84 100644 --- a/SPIN/PWM/multiple_pwm/README.md +++ b/SPIN/PWM/multiple_pwm/README.md @@ -1,29 +1,29 @@ # Working with multiple PWM -The spin has a total of 5 PWM channels with 2 complementary output each. In this example, we'll detail how to use each of them. +The SPIN has a total of 5 PWM channels with 2 complementary outputs each. In this example, we'll detail how to use each of them. ## Hardware setup and requirements  *figure 1* -You will need : +You will need: -- A spin -- A usb-c cable to supply the spin +- A SPIN +- A USB-C cable to supply the SPIN - An oscilloscope to watch PWM waveform -We can watch : +We can watch: --PWMA1 on gpio A8 --PWMC1 on gpio B12 --PWMD1 on gpio B14 --PWME1 on gpio C8 --PWMF1 on gpio C6 +- PWMA1 on GPIO A8 +- PWMC1 on GPIO B12 +- PWMD1 on GPIO B14 +- PWME1 on GPIO C8 +- PWMF1 on GPIO C6 ## Software setup -This example is initializing every PWM, and making a phase shift 77° (= 360/5°) as if we working in interleaved mode. See the [ phase shift ](../phase_shift/README.md) example for more details. +This example is initializing every PWM, and making a phase shift of 72° (= 360/5) as if we were working in interleaved mode. See the [phase shift](../phase_shift/README.md) example for more details. The duty cycle is the same for both PWMA and PWMC. @@ -31,10 +31,10 @@ You can control the duty cycle from the serial monitor : - press `u` to increase the duty cycle - press `d` to decrease the duty cycle -See [ownplot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. +See [OwnPlot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. ## Expected result  -You should observe 5 PWM with a phaseshift of 77° between them. \ No newline at end of file +You should observe 5 PWMs with a phase shift of 72° between them. diff --git a/SPIN/PWM/phase_shift/README.md b/SPIN/PWM/phase_shift/README.md index 91f6748b..831f4a55 100644 --- a/SPIN/PWM/phase_shift/README.md +++ b/SPIN/PWM/phase_shift/README.md @@ -2,22 +2,22 @@ Phase shift in Pulse Width Modulation (PWM) refers to the intentional offset of the timing between multiple PWM signals. This offset alters the switching instants of the signals, affecting the distribution of power delivery and minimizing ripple in power electronic systems. -Phase shifting PWM is used in interleaved topology for power electronics. In this example we'll show you how setup a phase shift for a 2 leg interleaved configuration for example. +Phase shifting PWM is used in interleaved topology for power electronics. In this example we'll show you how to set up a phase shift for a 2-leg interleaved configuration. ## Hardware setup and requirements -The spin can use up to 5 different PWM : PWMA, PWMC, PWMD, PWME and PWMF. This example will detail how to work with two of them in phase shifted mode : PWMA and PWMB. +The SPIN can use up to 5 different PWMs: PWMA, PWMC, PWMD, PWME and PWMF. This example will detail how to work with two of them in phase-shifted mode: PWMA and PWMC.  *Figure 1* -You will need : +You will need: -- A spin -- A usb-c cable to supply the spin +- A SPIN +- A USB-C cable to supply the SPIN - An oscilloscope to watch PWM waveform -We can watch PWMA1 on gpio A8 and PWMC1 on gpio B12. +We can watch PWMA1 on GPIO A8 and PWMC1 on GPIO B12. ## Software setup @@ -36,9 +36,9 @@ We start by initializing PWMA and PWMC : spin.pwm.startDualOutput(PWMC); // Start PWM ``` -The frequency for the pwm is initalized to 200kHz but you are free to choose another value. +The frequency for the PWM is initialized to 200 kHz but you are free to choose another value. -PWMC is shifted of 180° from PWMA. +PWMC is shifted by 180° from PWMA. The duty cycle is updated in the high-speed control task : @@ -53,10 +53,10 @@ You can control the duty cycle from the serial monitor : - press `u` to increase the duty cycle - press `d` to decrease the duty cycle -See [ownplot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. +See [OwnPlot](https://github.com/owntech-foundation/OwnPlot) if you would like a better graphical interface for the serial monitor. ## Expected result  -On the oscilloscope you should observe that PWMC1 is phase shifted of 180° from PWMA1 (which means they are complementary). \ No newline at end of file +On the oscilloscope you should observe that PWMC1 is phase shifted by 180° from PWMA1 (which means they are complementary). diff --git a/SPIN/TIMER/incremental_encoder/README.md b/SPIN/TIMER/incremental_encoder/README.md index e8ae989d..6fce32f8 100644 --- a/SPIN/TIMER/incremental_encoder/README.md +++ b/SPIN/TIMER/incremental_encoder/README.md @@ -2,17 +2,17 @@ An incremental encoder is a device that converts mechanical motion into digital signals. It typically consists of a rotating disk with evenly spaced slots and a sensor that detects these slots as the disk turns. The sensor generates electrical pulses corresponding to the motion, which can be used to track position, speed, or direction. -in this example we'll see how to use an incremental encoder with spin. +In this example we'll see how to use an incremental encoder with SPIN. -## Hardware setup and requirement +## Hardware setup and requirements  -You will need : +You will need: -- A spin -- A usb-c cable to supply the spin +- A SPIN +- A USB-C cable to supply the SPIN - A rotary incremental encoder - A 5V supply for your incremental encoder @@ -42,6 +42,6 @@ This value is displayed in the serial monitor. ## Expected result -You should see the value in the serial monitor either increasing or decresing depending on how you turning the rotary incremental encoder (clokc-wise or not). +You should see the value in the serial monitor either increasing or decreasing depending on how you are turning the rotary incremental encoder (clockwise or not). -Every turn your values should be reset to a reference value that will depend on your encoder. \ No newline at end of file +Every turn, your values should be reset to a reference value that will depend on your encoder. diff --git a/TWIST/Basic/Open-Loop PWM/README.md b/TWIST/Basic/Open-Loop PWM/README.md index c7a3e0aa..fb076340 100644 --- a/TWIST/Basic/Open-Loop PWM/README.md +++ b/TWIST/Basic/Open-Loop PWM/README.md @@ -1,13 +1,13 @@ # Open Loop PWM -The goal of this basic example is to understand what is a duty cycle and how it is related to power flow. We will use our TWIST as a buck converter in an open-loop to divide our voltage by 2. +The goal of this basic example is to understand what a duty cycle is and how it is related to power flow. We will use our TWIST as a buck converter in open loop to divide our voltage by 2. -!!! warning "Are you ready to start ?" +!!! warning "Are you ready to start?" - Before you can run this example, you must have : + Before you can run this example, you must have: - successfully gone through our [getting started](https://docs.owntech.org/latest/core/docs/environment_setup/) tutorial to set up your work environment - - successfully gone through our [first example](https://docs.owntech.org/latest/core/docs/first_example/) tutorial and download the "Open Loop PWM" example + - successfully gone through our [first example](https://docs.owntech.org/latest/core/docs/first_example/) tutorial and downloaded the "Open Loop PWM" example ## Background @@ -15,9 +15,9 @@ The goal of this basic example is to understand what is a duty cycle and how it ### What is a PWM ? -PWM or Pulse-Width-Modulation is based on the idea that a periodic (repetitive) logic signal (ON/OFF or 0/1) can have its width changed over time. This is shown on the three images below, where you can see the width of the $T_{ON}$ changing from `25%` to `75%` of the total period. +PWM, or Pulse-Width Modulation, is based on the idea that a periodic (repetitive) logic signal (ON/OFF or 0/1) can have its width changed over time. This is shown on the three images below, where you can see the width of the $T_{ON}$ changing from `25%` to `75%` of the total period. -As shown in [](#fig-duty-25), the duty cycle is `25%` of the total time (`T`), is called `period`. +As shown in [](#fig-duty-25), the duty cycle is `25%` of the total time (`T`), which is called the period. { #fig-duty-25 width=500} { #fig-duty-25 width=500 } @@ -65,7 +65,7 @@ In power electronics, switching between transistors is NOT instantaneous. To avo The deadtime can be of three formats: zero, positive or negative. -In zero deadtime, both PWM signal switches **simultaneouly** as shown in [] +In zero deadtime, both PWM signal switches **simultaneously** as shown in [] { #fig-no-deadtime width=500} { #fig-no-deadtime width=500} @@ -79,7 +79,7 @@ In zero deadtime, both PWM signal switches **simultaneouly** as shown in [] The length of the deadtime in either the rising or falling edges depends on the application. -## Hardware setup and requirement +## Hardware setup and requirements ----------- ### Circuit diagram @@ -106,13 +106,13 @@ The wiring diagram is shown in [](#fig-wiring). { #fig-wiring width=full .on-glb} { #fig-wiring width=full .on-glb} -Once you have wired the cables are connected your TWIST board to your computer, you can upload the example code. +Once you have wired the cables and connected your TWIST board to your computer, you can upload the example code. -!!! warning "Is you software ready?" - Before you can run this example, you must have : +!!! warning "Is your software ready?" + Before you can run this example, you must have: - successfully gone through our [getting started](https://docs.owntech.org/latest/core/docs/environment_setup/) tutorial to set up your work environment - - successfully gone through our [first example](https://docs.owntech.org/latest/core/docs/first_example/) tutorial and download the "Open Loop PWM" example + - successfully gone through our [first example](https://docs.owntech.org/latest/core/docs/first_example/) tutorial and downloaded the "Open Loop PWM" example ## Main code structure @@ -120,12 +120,12 @@ Once you have wired the cables are connected your TWIST board to your computer, ### Code structure -Let's briefly explain the conde structure of the `main.cpp` file of this example. +Let's briefly explain the code structure of the `main.cpp` file of this example. [](#fig-code-struct) shows a general representation of how the code is structured. -{ #fig-code-struct width=500 .on-glb} -{ #fig-code-struct width=500 .on-glb} +{ #fig-code-struct width=500 .on-glb} +{ #fig-code-struct width=500 .on-glb} The code structure is as follows: @@ -139,8 +139,8 @@ The code structure is as follows: The firmware of the TWIST board is executed according to the diagram in [](#fig-timing-diagram). -- **Communication Task** - Is awaken regularly to verify any keyboard activity -- **Application Task** - This task is woken once its suspend is finished. By default its period if of **100 miliseconds**. +- **Communication Task** - Is awakened regularly to verify any keyboard activity +- **Application Task** - This task is woken once its suspension is finished. By default its period is **100 milliseconds**. - **Critical Task** - This task is driven by the HRTIM count interrupt, where it counts a number of HRTIM switching frequency periods. In this case 100us, or 20 periods of the TWIST board 200kHz switching frequency set by default. { #fig-timing-diagram width=full .on-glb} @@ -161,7 +161,7 @@ There is no control scheme in this example. By default it is in `Open-loop`. - In the bottom toolbar, click on the Serial Monitor icon . Then click on the serial monitor screen. -This code will control `duty_cycle` so that the voltage output will vary. You can control the duty cycle through platformio serial monitor. +This code will control `duty_cycle` so that the voltage output will vary. You can control the duty cycle through the PlatformIO serial monitor. When opening it for the first time, the serial monitor will give you an initialization message regarding the parameters of the ADCs as shown below. @@ -176,9 +176,9 @@ When opening it for the first time, the serial monitor will give you an initiali - press `d` to decrease the duty cycle by 0.05 - press `h` to show the help menu -Here's sequence when the help menu is activated with `h`, the power mode is then activated with `p`, duty cycle is raised up to `0.5` and finally the Twist converter is put in idle with the `i`. +Here's the sequence when the help menu is activated with `h`, the power mode is then activated with `p`, the duty cycle is raised up to `0.5` and finally the Twist converter is put in idle with the `i`. - + You can measure the DC output voltage thanks to an oscilloscope or a multimeter. diff --git a/TWIST/Communication/CAN/README.md b/TWIST/Communication/CAN/README.md index aa69ccdf..695bf9c2 100644 --- a/TWIST/Communication/CAN/README.md +++ b/TWIST/Communication/CAN/README.md @@ -3,24 +3,24 @@ This example shows how to use the CAN interface present on both TWIST and OWNVERTER power shields. # CAN protocol -Data is using Thingset protocol. Full specification can be accessed here : -[thingset](thingset.io) +Data uses the Thingset protocol. The full specification can be accessed here: +[thingset](https://thingset.io) # Using CAN on OwnTech boards -CAN related functions can be used by typing +CAN-related functions can be used by typing `communication.can.` in your main.cpp file. -Autocompletion will give you insights of available API functions. +Autocompletion will give you insights into available API functions. Currently the API supports two modes : - Sending reports containing data over CAN, in this example live measurements - Sending control commands over CAN -For now two simple commands are supported: +For now, two simple commands are supported: - Sending a floating point reference. -- Sending a start - stop boolean. +- Sending a start-stop boolean. # App.conf -`app.conf` file permits to simply add complex modules. In this example, CAN +The `app.conf` file allows you to simply add complex modules. In this example, CAN communication is enabled by setting ```CONFIG_OWNTECH_COMMUNICATION_ENABLE_CAN=y``` @@ -34,7 +34,7 @@ Relevant configs are found in `Modules->thingset-sdk->Thingset SDK->CAN interfac # user_data_objects.h This new file is a manifest that permits the user to define custom values that -should be broadcasted over CAN. +should be broadcast over CAN. Follow the syntax provided with the default measurements to add yours. We also strongly suggest reading the [Thingset protocol specification](https://thingset.io/spec/v0.6/introduction/abstract.html). @@ -46,11 +46,11 @@ Make sure you have a suitable hardware adapter to link `RJ45` terminals of the OwnTech board to the `D Sub - 15` terminal of the adapter. `GND` `CAN-RX` and `CAN-TX` are required to be able to receive and send messages. -PEAK CAN to USB adapter is supported. It works natively on linux. +PEAK CAN-to-USB adapter is supported. It works natively on Linux. The following configuration should also work for other CAN dongle adapters, granted that you've installed any required driver. -To visualize CAN data stream +To visualize the CAN data stream 1. Open a terminal 2. Set dongle parameters ``` sudo ip link set can0 type can bitrate 500000 restart-ms 500 ``` @@ -59,7 +59,7 @@ To visualize CAN data stream # Using Download Firmware Upgrade over CAN -Now that the CAN interface is running, you can take benefits of it to download +Now that the CAN interface is running, you can take advantage of it to download new firmware through CAN as well. For that : @@ -68,6 +68,5 @@ For that : ``` sudo ip link set can0 type can bitrate 500000 restart-ms 500 ``` 2. Enable the CAN interface ``` sudo ip link set can0 up ``` 3. Build your firmware as you would do normally. -4. Once build execute the following script from a terminal +4. Once built execute the following script from a terminal ``` ~/.platformio/packages/framework-zephyr/_pio/thingset-zephyr-sdk/scripts/thingset-dfu-can.py -t 1 .pio/build/USB/firmware.mcuboot.bin ``` - diff --git a/TWIST/Communication/python_comm_library/README.md b/TWIST/Communication/python_comm_library/README.md index c304eb0d..b7a589b7 100644 --- a/TWIST/Communication/python_comm_library/README.md +++ b/TWIST/Communication/python_comm_library/README.md @@ -1,14 +1,14 @@ # Python Communication Protocol -This example uses the python communication protocol library to drive a Twist 1.4.1 board in Buck mode. +This example uses the Python communication protocol library to drive a Twist 1.4.1 board in buck mode. -The script will send data to the board, retrive the measurements and show them on a graph. +The script will send data to the board, retrieve the measurements and show them on a graph. !!! danger Advanced example This is an advanced example. Make sure you are comfortable with using the [voltage mode](https://docs.owntech.org/examples/TWIST/DC_DC/buck_voltage_mode/) **before** doing this emulator. -## Hardware wiring and requirement +## Hardware wiring and requirements The wiring of the system is given by the image below: - The power converter is connected in `buck` mode with a source and a load. @@ -17,17 +17,17 @@ The wiring of the system is given by the image below:  -You will need : +You will need: - 1 TWIST (it works with the OWNVERTER too!) -- 1 dc power supply (20-60V) +- 1 DC power supply (20-60 V) - 1 power load - 1 PC -!!! warning Make sure you read this readme all the way to the end +!!! warning Make sure you read this README all the way to the end ## Embedded Firmware setup -We import the `communication_library` in `platformio.ini` via the line. Be careful to include the `#power_tuesday` at the end, since it will get the right version of the protocol : +We import the `communication_library` in `platformio.ini` via the line. Be careful to include the `#power_tuesday` at the end, since it will get the right version of the protocol: ```ini lib_deps= @@ -36,7 +36,7 @@ lib_deps= ## Embedded Firmware explanation -The emebedded firmware will configure the `TWIST` or `OWNVERTER` board to be able to communicate with your computer via python. +The embedded firmware will configure the `TWIST` or `OWNVERTER` board to be able to communicate with your computer via Python. The software deploys a communication system with three modes: @@ -53,9 +53,9 @@ The software deploys a communication system with three modes: - :zap: in the critical_task: starts the power flow, controls the power flow with a PID !!! Tip How the system works - Characters are sent via the Serial port to the `SPIN` board. - It parses these characters and decides which value to put in which variables that describes the power converter. - For more details, please checkout the [communication protocol library readme](https://github.com/owntech-foundation/python_twist_comm_protocol) + Characters are sent via the serial port to the `SPIN` board. + It parses these characters and decides which value to put in which variables that describe the power converter. + For more details, please check out the [communication protocol library README](https://github.com/owntech-foundation/python_twist_comm_protocol) ## Python script @@ -87,7 +87,7 @@ It will send a triangular waveform to the board and plot it in real-time. } ``` - The handler will decide what the message is about and then update the appropriate structure of the communicaiton protocol that handles the information. + The handler will decide what the message is about and then update the appropriate structure of the communication protocol that handles the information. Which activates the power leg `LEG1`. @@ -99,7 +99,7 @@ This code was tested using the following hardware setup:  On the photo: - - A computer running the `comm_script.py` python script. + - A computer running the `comm_script.py` Python script. - A Twist board connected in Buck mode. - A voltage source. - A resistor connected to `LEG1` and `LEG2` @@ -110,8 +110,8 @@ On the photo: Before running the code !!! warning Make sure you have: - - `python` installed in your computer. + - `python` installed on your computer. - that you follow the [firmware setup instructions](#embedded-firmware-setup) and have the appropriate libraries listed in `platformio.ini`. - flash the `main.cpp` in your Twist board -Once all of the above are ok, you can then run the `comm_script.py` script with your python3. +Once all of the above are OK, you can then run the `comm_script.py` script with your Python 3. diff --git a/TWIST/DC_AC/grid_following/README.md b/TWIST/DC_AC/grid_following/README.md index 0cd71f57..57e6194f 100644 --- a/TWIST/DC_AC/grid_following/README.md +++ b/TWIST/DC_AC/grid_following/README.md @@ -1,6 +1,6 @@ -# Ac current source follower +# AC current source follower -In this example you need to have a first Twist with the [Grid Forming](../grid_forming/README.md) example. +In this example you need to have a first TWIST with the [Grid Forming](../grid_forming/README.md) example.


|
|
@@ -51,4 +51,3 @@ This code example demonstrates an experiment involving three power converters co
## Conclusion
By following the provided guidelines and uploading the code to the power cards, you can emulate and study the dynamics of parallel power conversion in buck mode. This experiment allows you to investigate the impact of varied droop factors on voltage regulation and observe how the power cards work together in parallel to provide power to the DC bus. The combination of voltage control, buck mode operation, and unique droop factors contributes to an efficient and synchronized power conversion system.
-
diff --git a/library.json b/library.json
index 6b2b74bd..20b229d0 100644
--- a/library.json
+++ b/library.json
@@ -1,6 +1,6 @@
{
"name": "OwnTech_Examples",
- "version": "0.0.2",
+ "version": "0.5.0",
"description": "A library that contains OwnTech Power API examples",
"keywords": "Power, Control, OwnTech",
"repository":
@@ -46,283 +46,305 @@
}
],
"examples": [
- {
- "name": "boost_voltage_mode",
- "title": "Voltage Mode Boost",
- "description": "Voltage mode boost converter using PID controller for TWIST",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/boost_voltage_mode",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "buck_voltage_mode",
- "title": "Voltage Mode Buck",
- "description": "Voltage mode buck converter using PID controller for TWIST",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/buck_voltage_mode",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "buck_current_mode",
- "title": "Current Mode Buck",
- "description": "Peak current mode buck converter using PID controller for TWIST",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/buck_current_mode",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "interleaved",
- "title": "Interleaved",
- "description": "Interleaved mode buck converter with PID controlled output voltage",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/interleaved",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "scope_simple_example",
- "title": "Simple scope example",
- "description": "Simple example of triggering the scope to acquire a step response.",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/scope_simple_example",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "ripple_measurement",
- "title": "Current Ripple Measurement",
- "description": "Current ripple measurement in buck voltage mode, by sweeping adc trigger",
- "group": "Examples TWIST",
- "base": "TWIST/DC_DC/current_ripple_measurement",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "AC_cient_server",
- "title": "AC client server",
- "description": "implementation of AC client server in microgrid",
- "group": "Examples TWIST",
- "base": "TWIST/Microgrid/AC_client_server",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "AC_peer_to_peer",
- "title": "AC peer to peer",
- "description": "implementation of AC peer to peer in microgrid",
- "group": "Examples TWIST",
- "base": "TWIST/Microgrid/AC_peer_to_peer",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "DC_cient_server",
- "title": "DC client server",
- "description": "implementation of DC client server in microgrid",
- "group": "Examples TWIST",
- "base": "TWIST/Microgrid/DC_client_server",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "DC_droop",
- "title": "DC droop",
- "description": "implementation of DC droop in microgrid",
- "group": "Examples TWIST",
- "base": "TWIST/Microgrid/DC_droop",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "grid_forming",
- "title": "Grid Forming Inverter",
- "description": "It generates an AC voltage source. Commonly, a grid-forming inverter is a device that autonomously establishes and maintains stable grid voltage and frequency.",
- "group": "Examples TWIST",
- "base": "TWIST/DC_AC/grid_forming",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "grid_following",
- "title": "Grid Following Inverter",
- "description": "It is an AC current source which follow a grid voltage. Commonly, a grid-following inverter adjusts its output to match the voltage and frequency of the existing electrical grid",
- "group": "Examples TWIST",
- "base": "TWIST/DC_AC/grid_following",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "python_communication_protocol",
- "title": "Python Communication Protocol",
- "description": "This example allows a user to control a Twist in DC-DC buck mode using a Python script.",
- "group": "Examples TWIST",
- "base": "TWIST/Communication/python_comm_library",
- "files": [
- "main.cpp",
- "comm_script.py",
- "README.md"
- ]
- },
- {
- "name": "can_communication",
- "title": "CAN Communication",
- "description": "This example deploys CAN communication of the Twist board",
- "group": "Examples TWIST",
- "base": "TWIST/Communication/CAN",
- "files": [
- "main.cpp",
- "app.conf",
- "README.md",
- "user_data_objects.h"
- ]
- },
- {
- "name": "blinky",
- "title": "Blinky LED",
- "description": "Toggling LED",
- "group": "Examples SPIN",
- "base": "SPIN/LED/blinky",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "duty_cycle_setting",
- "title": "Setting PWM duty cycle",
- "description": "Using PWM with duty cycle",
- "group": "Examples SPIN",
- "base": "SPIN/PWM/duty_cycle_setting",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "multiple_pwm",
- "title": "Setting multiple PWM",
- "description": "Using multiple PWM with duty cycle",
- "group": "Examples SPIN",
- "base": "SPIN/PWM/multiple_pwm",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "phase_shift",
- "title": "Setting PWM phase shift",
- "description": "Setting a phase shift between two PWM",
- "group": "Examples SPIN",
- "base": "SPIN/PWM/phase_shift",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "burst_mode",
- "title": "Setting Burst Mode PWM",
- "description": "Setting pulsed mode PWM",
- "group": "Examples SPIN",
- "base": "SPIN/PWM/burst_mode",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "signal_generation",
- "title": "DAC signal generation",
- "description": "Sawtooth generation with DAC",
- "group": "Examples SPIN",
- "base": "SPIN/DAC/signal_generation",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "adc_software_trigger",
- "title": "Software triggered ADC",
- "description": "setting the adc to be trigerred by software",
- "group": "Examples SPIN",
- "base": "SPIN/ADC/adc_hrtim_trigger",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "adc_hrtim_trigger",
- "title": "HRTIM triggered ADC",
- "description": "setting the adc to be trigerred by the hrtim",
- "group": "Examples SPIN",
- "base": "SPIN/ADC/adc_hrtim_trigger",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "incremental_encoder",
- "title": "Incremental encoder",
- "description": "Using a timer with a rotary incrmental encoder",
- "group": "Examples SPIN",
- "base": "SPIN/TIMER/incremental_encoder",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "BLDC_hall_sensor",
- "title": "BLDC motor with hall sensor",
- "description": "Control a BLDC motor using hall effect sensor",
- "group": "Examples OWNVERTER",
- "base": "OWNVERTER/BLDC_hall_sensor",
- "files": [
- "main.cpp",
- "README.md"
- ]
- },
- {
- "name": "foc_hall_sensor",
- "title": "Motor control using FOC and hall sensors",
- "description": "an example which show the use of a Field Oriented Control algorithm with discrete hall sensors",
- "group": "Examples OWNVERTER",
- "base": "OWNVERTER/FOC_hall_sensor",
- "files": [
- "main.cpp",
- "README.md"
- ]
- }
+ {
+ "name": "Open Loop PWM",
+ "title": "Open Loop PWM",
+ "description": "Simple open loop PWM example",
+ "group": "Examples TWIST - Basic",
+ "base": "TWIST/Basic/Open-Loop_PWM",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Voltage Mode Buck",
+ "title": "Voltage Mode Buck",
+ "description": "Voltage mode buck converter using PID controller for TWIST",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/buck_voltage_mode",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Voltage Mode Boost",
+ "title": "Voltage Mode Boost",
+ "description": "Voltage mode boost converter using PID controller for TWIST",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/boost_voltage_mode",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Current Mode Buck",
+ "title": "Current Mode Buck",
+ "description": "Peak current mode buck converter using PID controller for TWIST",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/buck_current_mode",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Interleaved",
+ "title": "Interleaved",
+ "description": "Interleaved mode buck converter with PID controlled output voltage",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/interleaved",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Independent",
+ "title": "Independent",
+ "description": "Independent mode buck converter with each leg controlled by a dedicated PID",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/independent",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Simple scope example",
+ "title": "Simple scope example",
+ "description": "Simple example of triggering the scope to acquire a step response.",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/scope_simple_example",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Current Ripple Measurement",
+ "title": "Current Ripple Measurement",
+ "description": "Current ripple measurement in buck voltage mode, by sweeping adc trigger",
+ "group": "Examples TWIST - DC-DC",
+ "base": "TWIST/DC_DC/current_ripple_measurement",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Grid Following Inverter",
+ "title": "Grid Following Inverter",
+ "description": "It is an AC current source which follow a grid voltage. Commonly, a grid-following inverter adjusts its output to match the voltage and frequency of the existing electrical grid",
+ "group": "Examples TWIST - DC-AC",
+ "base": "TWIST/DC_AC/grid_following",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Grid Forming Inverter",
+ "title": "Grid Forming Inverter",
+ "description": "It generates an AC voltage source. Commonly, a grid-forming inverter is a device that autonomously establishes and maintains stable grid voltage and frequency.",
+ "group": "Examples TWIST - DC-AC",
+ "base": "TWIST/DC_AC/grid_forming",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "CAN Communication",
+ "title": "CAN Communication",
+ "description": "This example deploys CAN communication of the Twist board",
+ "group": "Examples TWIST - COMM",
+ "base": "TWIST/Communication/CAN",
+ "files": [
+ "main.cpp",
+ "app.conf",
+ "README.md",
+ "user_data_objects.h"
+ ]
+ },
+ {
+ "name": "Python Communication Protocol",
+ "title": "Python Communication Protocol",
+ "description": "This example allows a user to control a Twist in DC-DC buck mode using a Python script.",
+ "group": "Examples TWIST - COMM",
+ "base": "TWIST/Communication/python_comm_library",
+ "files": [
+ "main.cpp",
+ "comm_script.py",
+ "README.md"
+ ]
+ },
+ {
+ "name": "AC client server",
+ "title": "AC client server",
+ "description": "implementation of AC client server in microgrid",
+ "group": "Examples TWIST - Microgrid",
+ "base": "TWIST/Microgrid/AC_client_server",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "AC peer to peer",
+ "title": "AC peer to peer",
+ "description": "implementation of AC peer to peer in microgrid",
+ "group": "Examples TWIST - Microgrid",
+ "base": "TWIST/Microgrid/AC_peer_to_peer",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "DC client server",
+ "title": "DC client server",
+ "description": "implementation of DC client server in microgrid",
+ "group": "Examples TWIST - Microgrid",
+ "base": "TWIST/Microgrid/DC_client_server",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "DC droop",
+ "title": "DC droop",
+ "description": "implementation of DC droop in microgrid",
+ "group": "Examples TWIST - Microgrid",
+ "base": "TWIST/Microgrid/DC_droop",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "BLDC motor with hall sensor",
+ "title": "BLDC motor with hall sensor",
+ "description": "Control a BLDC motor using hall effect sensor",
+ "group": "Examples OWNVERTER",
+ "base": "OWNVERTER/BLDC_hall_sensor",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Motor control using FOC and hall sensors",
+ "title": "Motor control using FOC and hall sensors",
+ "description": "an example which show the use of a Field Oriented Control algorithm with discrete hall sensors",
+ "group": "Examples OWNVERTER",
+ "base": "OWNVERTER/FOC_hall_sensor",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "HRTIM triggered ADC",
+ "title": "HRTIM triggered ADC",
+ "description": "setting the adc to be trigerred by the hrtim",
+ "group": "Examples SPIN - ADC",
+ "base": "SPIN/ADC/adc_hrtim_trigger",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Software triggered ADC",
+ "title": "Software triggered ADC",
+ "description": "setting the adc to be trigerred by software",
+ "group": "Examples SPIN - ADC",
+ "base": "SPIN/ADC/adc_software_trigger",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "DAC signal generation",
+ "title": "DAC signal generation",
+ "description": "Sawtooth generation with DAC",
+ "group": "Examples SPIN - DAC",
+ "base": "SPIN/DAC/signal_generation",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Incremental encoder",
+ "title": "Incremental encoder",
+ "description": "Using a timer with a rotary incrmental encoder",
+ "group": "Examples SPIN - TIMER",
+ "base": "SPIN/TIMER/incremental_encoder",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Blinky LED",
+ "title": "Blinky LED",
+ "description": "Toggling LED",
+ "group": "Examples SPIN - LED",
+ "base": "SPIN/LED/blinky",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Setting Burst Mode PWM",
+ "title": "Setting Burst Mode PWM",
+ "description": "Setting pulsed mode PWM",
+ "group": "Examples SPIN - PWM",
+ "base": "SPIN/PWM/burst_mode",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Setting PWM duty cycle",
+ "title": "Setting PWM duty cycle",
+ "description": "Using PWM with duty cycle",
+ "group": "Examples SPIN - PWM",
+ "base": "SPIN/PWM/duty_cycle_setting",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Setting multiple PWM",
+ "title": "Setting multiple PWM",
+ "description": "Using multiple PWM with duty cycle",
+ "group": "Examples SPIN - PWM",
+ "base": "SPIN/PWM/multiple_pwm",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ },
+ {
+ "name": "Setting PWM phase shift",
+ "title": "Setting PWM phase shift",
+ "description": "Setting a phase shift between two PWM",
+ "group": "Examples SPIN - PWM",
+ "base": "SPIN/PWM/phase_shift",
+ "files": [
+ "main.cpp",
+ "README.md"
+ ]
+ }
]
}