View previous topic :: View next topic |
Author |
Message |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
PID CONTROL motor with encoder |
Posted: Thu May 02, 2019 11:53 am |
|
|
Hello there ;
I want to drive dc motor with encoder with PID control. What should I do.? _________________ Es |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Thu May 02, 2019 12:08 pm |
|
|
Start with some reading and studying.
I recommend googling "PID without a PhD" and reading that. |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Thu May 02, 2019 12:10 pm |
|
|
No sample code? how about how can I do. _________________ Es |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Thu May 02, 2019 12:22 pm |
|
|
If you google what gaugeguy says, there is example code given in there... |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Thu May 02, 2019 12:25 pm |
|
|
ı wrote to google. but, no sample code. _________________ Es |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri May 03, 2019 5:05 am |
|
|
To start...
Get the specs for the 'DC motor', which 'encoder' (512 CPR, 2048CPR ?), what kind of RPM range and control ? What type of motor 'interface' ? These days I assume most use an H-bridge though 25 years ago I used +-12 volt power supplies controlled by the then 'new' 16F877.
You'll need to define your hardware BEFORE looking at any code ! Code itself is maybe 100-150 lines with PC link.
Jay |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri May 03, 2019 5:15 am |
|
|
Type: 4230-sc (With Reducer)
power: 60W
Current: 4.5A
Assignment: 3000 (200) r / min
Voltage: 24V DC
Encoder TIpi 2 channel 100 slots
I want to a few ask questions .
Firstly, PID feature in the hardware of the processor should it be? Or is it added to the processor as a software?
how do I do the calculations in the formula.?
The software for PID control is very complex? I need to pay attention to what. _________________ Es |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Fri May 03, 2019 9:43 am |
|
|
The MCU provides the hardware to read QEI and control h-bridges and whatnot.
But you will need to implement the controller with software.
The equations given in introductory controls texts are given as continuous time functions (like real life). However, when you implement them in your MCU you are going to have to convert them into discrete time functions.
This means you will need to have accurate timing, especially when you are updating the I and D parts of the controller because they are integrations and derivatives of the error between your current position and your set point with respect to time. |
|
|
|