필터 지우기
필터 지우기

DC Motor Position Control using Potentiometer as a Feedback

조회 수: 146 (최근 30일)
Christos Tsallis
Christos Tsallis 2022년 1월 5일
답변: Noor Amira Ilyanie 2022년 8월 4일
Hello,
I am trying to control the position of a dc motor using a potentiometer as a feedback (on simulink). The idea is to input an angle from 0 to 180 degrees and then motor will spin clockwise or anti-clockwise (depending on it's physical position) until it gets to the desired angle. My goal is to implement a P controller on this process (getting to the desired angle). The problem is that I am confused on how to express the problem on it. At first I have a similar setup as the one in Picture 1. After that, in Picture 2, I have expressed the dc motor's speed with a constant and I have used Digital Pin 9 for PWM. So 0 means that dc motor will not spin and 255 means that dc motor will spin at its highest speed. Potentiometer is connected at pin 5 and its value is shown on the simulink's display. Both dc motor's speed and potentiometer's value are working and I would like some suggestions at Picture 2. My idea is to set a desired angle as a constant, do you think that it will work with a constant block? Also, I am confused on how am I going to connect dc motor's speed and potentiometers value with my P controller, can you suggest me a way? One last thing is, how can I get the current angle and then fix the error in order to get to the desired angle, any ideas?
Thank you so much for your time, appreciate your help !
Excuse me for any mistakes !
Picture 2: Thoughts of the model in Simulink
  댓글 수: 33
Christos Tsallis
Christos Tsallis 2022년 1월 11일
편집: Christos Tsallis 2022년 1월 11일
So my PID's input is going to be random again? Did I understand correctly?
Mathieu NOE
Mathieu NOE 2022년 1월 12일
yes , basically replace the step block by the random generator and record the PID output along with the position sensor signal

댓글을 달려면 로그인하십시오.

답변 (2개)

Christos Tsallis
Christos Tsallis 2022년 1월 12일
Hello, I am facing some issues. At first, my PID’s output is the PWM signal which controls the speed of the dc motor. If this speed is less than 65, motor can’t spin at all. I tried to tune again the P value by myself (I=0, D=0) with the Random Number Generator Block as an input. I set its main value equal to 90 and its variance 30 (for RNG block). The problem is that when it oscillates for one random number it goes close to this random value and after that cause of the PWM’s output is less than 65 it doesn’t move at all (when a new RNG value occurs). So at the scope there are less than 5 seconds which they show the system’s response… The DC motor which I use is called TT DC Gear Motor and it operates at 3 - 6 Volts. It’s “datasheet” can be seen here: https://media.digikey.com/pdf/Data%20Sheets/Adafruit%20PDFs/3777_Web.pdf Do you think that I need a better dc motor in order to fix my problem ? Thank you for your time, appreciate your help !
  댓글 수: 5
Christos Tsallis
Christos Tsallis 2022년 1월 27일
Hello Sir,
a lot of days have past since my last message, excuse me about that.
I haven't yet connected my PID controller to the SG90 Servo, but I bought the following motor : https://gr.mouser.com/ProductDetail/Digilent/290-008?qs=s%2FdyVPQMB4zvWqNo5wm3QA%3D%3D
I bought it cause on its datasheet there are all the required variables that are needed in order to simulate a DC Motor in simulink and then get the best PID values using Auto-Tune. So, I will replace my current TT DC Gear motor with this and I will see the results...
I will inform you again, when it will be on my hands !
Thank you for everything !
Mathieu NOE
Mathieu NOE 2022년 1월 28일
hello
ok - sounds good
I see the gear ratio is only 1/52
all the best for the future

댓글을 달려면 로그인하십시오.


Noor Amira Ilyanie
Noor Amira Ilyanie 2022년 8월 4일
what is 0 to 255 unit? is it voltage or rpm? or bit?

카테고리

Help CenterFile Exchange에서 Control Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by