Timeline for Need advice with PID loop on hardware
Current License: CC BY-SA 4.0
23 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 27, 2021 at 17:29 | vote | accept | David777 | ||
Apr 24, 2021 at 14:37 | comment | added | Spehro 'speff' Pefhany | Yes. You might also want look at how it is done in MCU peripherals- center aligned vs edge aligned. | |
Apr 24, 2021 at 12:32 | comment | added | David777 | @SpehroPefhany By buffer and reload the PWM value, do you mean only update the PWM value into the counter for comparison when the free running counter is at zero? | |
Apr 23, 2021 at 23:38 | comment | added | Spehro 'speff' Pefhany | Might be better to buffer the PWM value and reload at the beginning of the PWM cycle. | |
Apr 23, 2021 at 22:56 | answer | added | Real Magnetics | timeline score: 0 | |
Apr 23, 2021 at 12:26 | answer | added | Rokta | timeline score: 0 | |
Apr 23, 2021 at 11:55 | comment | added | David777 | @Rokta No I wanted to divide the whole PID result by 100. Have I made a mistake? | |
Apr 23, 2021 at 11:53 | comment | added | Rokta | Is it intentional that you only divide the D part of PID regulator by 100 when you are calculating PID_Output ? | |
Apr 23, 2021 at 11:09 | history | edited | David777 | CC BY-SA 4.0 |
added link
|
Apr 23, 2021 at 10:02 | comment | added | David777 | The L298N inputs I am using has, forward (IN3), reverse (IN4), and a PWM (ENB). This PWM is common for both directions. But I set the forward input high and the PWM duty cycle to 100%, the output voltage was 25V (max). With the PWM duty cycle down to 50%, the output voltage was still 25V. This sounds like my problem, the motor driver isn't varying the voltage as expected? (Note, this was with motor terminals open with no motor connected). | |
Apr 23, 2021 at 9:51 | comment | added | Marko Buršič | I don't know about your H-bridge. Either you have PWM(0-100%)+DIR or two channels PWM 0-100%, where 50% means zero voltage and left 100%, right 0% means full left,,... | |
Apr 23, 2021 at 9:40 | answer | added | Marko Buršič | timeline score: 2 | |
Apr 23, 2021 at 9:32 | comment | added | David777 | @MarkoBuršič Ah ok, so what you are saying it that the duty cycle should never go to 0%? So what my code does is when the motor speed is greater than the setpoint speed, the duty cycle is 0%. So the motor is pretty much being connected to full duty cycle then 0% duty cycle? | |
Apr 23, 2021 at 9:26 | comment | added | Marko Buršič | Ok, still not clear 100%, but enough to say that either it's wrong. If the output voltage is zero at 50% DT, then it has to output 50% when controller output is 0. | |
Apr 23, 2021 at 9:25 | comment | added | David777 | @MarkoBuršič See my edit to the question | |
Apr 23, 2021 at 9:25 | history | edited | David777 | CC BY-SA 4.0 |
Added edit
|
Apr 23, 2021 at 9:18 | comment | added | David777 | @MarkoBuršič Sorry, what do you mean switch something like chopping? The toggles the PWM output pin. If the PID_Comparison_Value is 2500, and the count is less than that, that will produce 50% duty cycle? | |
Apr 23, 2021 at 9:14 | comment | added | Marko Buršič | if((Count_Value < PID_Comparison_Value) combined with "PWM_Output <= '1' or '0' makes no sense. you do switch something like chopping. | |
Apr 23, 2021 at 9:08 | history | edited | David777 | CC BY-SA 4.0 |
added another question
|
Apr 23, 2021 at 9:04 | history | edited | MarkU |
edited tags
|
|
Apr 23, 2021 at 8:55 | history | edited | David777 | CC BY-SA 4.0 |
Added information
|
Apr 23, 2021 at 8:50 | history | edited | David777 | CC BY-SA 4.0 |
Added information
|
Apr 23, 2021 at 8:42 | history | asked | David777 | CC BY-SA 4.0 |