[Full Breakdown] PID for DC Motor Position Control using Rotary Potentiometer

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 62

  • @GeeKeeCeeBee
    @GeeKeeCeeBee  2 роки тому +11

    IMPORTANT: If you find this video helpful then please leave a LIKE, SHARE and SUBSCRIBE to support me in making more videos like this. 👍
    CODE and SCHEMATICS ARE AVAILABLE HERE geekeeceebee.com/DCMotor%20Position%20Tracking.html
    More Videos:
    DC Motor Speed Control: ua-cam.com/video/QSIksPKndEs/v-deo.html

    • @hoangkhuong9
      @hoangkhuong9 2 роки тому +1

      Same system, Could you pls change dc motor by stepper? Thanks

  • @onlooker251
    @onlooker251 11 місяців тому +3

    Thank you for explaining the PID feed back loop and the conversation into code. 👍🙂

  • @naboulsikhalid7763
    @naboulsikhalid7763 2 роки тому +8

    this the king of tutor whom we should support for the outstanding explanation and sharing knowledge. thank you

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому

      Thank you, that's very kind of you to say that. Im glad my videos are helping.

  • @chameeraabhishek2969
    @chameeraabhishek2969 Рік тому +2

    Thank you very much ❤ I used this method for control Doosan 225 excavator throttle 🤘🤘

  • @prashantgautam8983
    @prashantgautam8983 Рік тому +1

    Thank you, this video has helped me understand the basics of PID and the arduino implementation was awsome. The same code worked for my feedback motor.

  • @amirhusseinqolami3593
    @amirhusseinqolami3593 11 місяців тому +1

    Your project is very perfect.
    Thnaks🙏

  • @qozia1370
    @qozia1370 Рік тому +1

    thank you, good video, would be good if you go into the details of the math behind the Transfer function.

  • @obotech1742
    @obotech1742 8 місяців тому

    Thank you very much for the tutorial that you have made, it really helped me to solve the steering ruder control problem.😇😇

  • @kishor_VU2MZT
    @kishor_VU2MZT Рік тому +1

    Very exellent , can this be replicate with dc motor with reduced gear box of about 7 rpm ???

  • @codelery414
    @codelery414 10 місяців тому +1

    Good job! How did you get 360-degree rotation? Because the rotation of potentiometer is less than 360-degree.

  • @Jim_One-wl4ke
    @Jim_One-wl4ke 6 місяців тому

    That’s a cool setup! Maybe I can try 10turns VR so with a 10:1 gearing can we get a more precise position? Possible to use as feedback for steppers too? Thanks for sharing ❤

  • @ekaggrat
    @ekaggrat Рік тому +2

    How do you keep the position of the motor same on startup? for example if it is in a robot arm then how do you know the absolute location of the arm on startup. Wont the position be different every time the robot boots up?

  • @marksoderberg628
    @marksoderberg628 3 роки тому +3

    This PID tracker with the 2 POTs is awesome! Small thing-you diagram shows using A2 and A3 and the code is A3 and A4. Also, I’m having a little trouble. Turning on the serial monitor makes the loop much slower than 10ms. It works but it is a little jerky with irrregular timing that seems to be due to the serial communication. When I turn serial off, the timing is then right but it no longer seems to be tuneable…. Strange…. Should I try to monitor some other way??

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  3 роки тому +4

      Thanks for pointing that out. I'll update the code to reflect correct pin assignments.
      Have you tried using "Serial Plotter" instead of serial monitor? I'm not exactly sure but couple of things to try - increase the delay time or use timer interrupts instead of delay() command. I have another video on my channel about PID DC motor speed tracking where I implement Timer interrupts.
      Advantage of timer interrupt is that Arduino is free to do other things while waiting for 10ms. Unlike in delay(10) command, arduino is stuck for 10ms.

  • @JoaoVitor-wj2ki
    @JoaoVitor-wj2ki 2 роки тому +2

    Outstanding job you did. I'm in a project, which consist in control a DC motor, most specifically the position of the DC motor. For this, I'll not use other potentiometer coupled in the motor, just the motor DC. I want to control the motor directly with one potentiometer (reference potentiometer). In this case, can you explain me how can I do that? what connections I have to do from your assembly?
    Thanks.

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому +1

      You need some sort of feedback sensor on the motor to control its position. If can't use a pot then other option is to use an optical encoder. Then map the angular range of ref pot to that optical encoder.

  • @rohitbhandari9879
    @rohitbhandari9879 2 роки тому +2

    Best video

  • @abdulmomenbhuian7530
    @abdulmomenbhuian7530 3 роки тому +2

    Thankful sir.

  • @easy_3d
    @easy_3d 3 місяці тому

    Instead of using reference potentiometer , can i directly use values from a oled display to turn the motor to a specific position?

  • @bobjames994
    @bobjames994 5 місяців тому

    Please help, I’ve uploaded code to the board and wired everything identical to the diagram, but when I power everything the motor just spins without control, any way to fix this?

  • @MrShaneSunshine
    @MrShaneSunshine Рік тому

    Yes!

  • @kritancreations6471
    @kritancreations6471 2 роки тому

    Nice you are life saver. How can is use a mobile phone instead of potentiometer?

  • @arthurknevitz3151
    @arthurknevitz3151 3 роки тому +3

    Amazing video, just what I was looking for!
    Just asking to know if I got it correctly:
    you used "encoder_pot" for the feedback when declaring the variables, but used the reading (in the main loop) of the potPin as the feedback. Was it a typo or did I get the whole idea backwards?
    Great project and one of the best takes on the PID workings btw
    best regards from Brasil !!!

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  3 роки тому +4

      You got it right. There's a typo when defining the encoder pot. Glad video was helpful. Thanks for watching 👍

    • @badisouahab6582
      @badisouahab6582 Рік тому +1

      @@GeeKeeCeeBee when you read analog potentiometer you get angle ??

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  Рік тому +4

      It is technically angular position mapped to potentiometers resistance value. However, I do not necessarily read it as angle. I simply use the resistance value as feedback signal and PI controller compensates the voltage by comparing feedback with reference potentiometer value. Hope that's helpful.

    • @arduinomaquinas
      @arduinomaquinas 9 місяців тому +1

      Loved video ❤👏👏👏

  • @kifahzaidan4505
    @kifahzaidan4505 2 роки тому

    THANKS A LOT
    CAN YOU PLEASE POST VIDEO FOR THE (CONTROLLING OF DC MOTOR 'ACTUATOR ' PROGRAMABLE POSITION WITH MEMORY BUTTONS USING ARDUINO.
    BEST WISHES

  • @niboonboonprakob2209
    @niboonboonprakob2209 2 роки тому

    How robot line tracking using PID controll?

  • @Leitoc957
    @Leitoc957 7 місяців тому

    felicitaciones maestro

  • @kritancreations6471
    @kritancreations6471 2 роки тому

    How can is limit the rotation to 90 degrees only?

  • @nuwanamarasingha1982
    @nuwanamarasingha1982 Рік тому

    wow great !

  • @nadirsert8235
    @nadirsert8235 2 роки тому

    good job thank you

  • @yldrmozer1598
    @yldrmozer1598 2 роки тому

    is it 100% possible for precision work

  • @nikobles8285
    @nikobles8285 Рік тому

    Hello, if i'm going to use BTS7960, where should I tap the 6,7,8 pins fron arduino to bts7960 pins? Thank you

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  Рік тому

      Looks like Bts7960 needs atleast 4 wires. It needs 2 separate pwm output from arduino for left and right rotation. My code won't transfer over without modifications

  • @ВиталяАльбатрос-к3т
    @ВиталяАльбатрос-к3т 10 місяців тому

    Отлично!

  • @ravmanoskid8192
    @ravmanoskid8192 Рік тому

    Im trying to replicate this but have a small problem. I can hear the motor buzz but it wont move. My motor has a built in potentiometer and its value is different than the input potentiometer. Also, starting resistance is from max to min. Does this matter? And can it be fixed with code. Thanks!

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  Рік тому +3

      Pot resistance value should not matter. You can try flipping Vcc and Gnd pin of your potentiometer. Resitance max-min should flip. Hope that helps.

    • @ravmanoskid8192
      @ravmanoskid8192 Рік тому

      Hey man thanks for the tip! I tried flipping the cables and saw improvement, but playing with kp and kd values solved my problem completely! Hoping to see more electronics videos from you soon.
      Cheers!!

  • @jeffclark8681
    @jeffclark8681 2 роки тому

    Paypal , done. Great write up and video. Where are you defining the khz rate of the driver (sorry im new). I have a project, im needing a PWM motor controller that runs @ 20khz and can handle max of 10amps (12 volts). I would like to use your code and set it up the same way. What do you recommend??.

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому

      Thank you, Jeff. Much appreciated 🙏 I have responded to your questions via email. Hope that's helpful. Thanks again

  • @jrmichel
    @jrmichel 2 роки тому +1

    excelent! It´s possible to do this same with the ESP-32?

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому

      Yes, absolutely. Technically, you can use any microcontroller to do this.

  • @zezoalbendary8528
    @zezoalbendary8528 3 роки тому

    Can i use Rotary encoders instead of potentiometers for this project ?

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  3 роки тому +1

      You absolutely can. You would need a somewhat high resolution rotary encoder. Most inexpensive encoders can be around 24pulses per revolution which is 360/24 = 15deg for each pulse. Not nearly acceptable for any kind position controlled application.
      If you are interested, there's another video on my channel with encoder and speed/position control. But I feed a pre-defined speed ans position profile and get feedback from rotary encoder. ua-cam.com/video/QSIksPKndEs/v-deo.html

    • @arthurilyuts7575
      @arthurilyuts7575 Рік тому

      Seems like there’s no second encoder in the link you shared. I really like that you did with two Potentiometers in this video and I also want to make same thing but with two Rotary Encoders instead of using Potentiometers. Will be very appreciative if you can direct me in that.

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  Рік тому

      There's another video on my channel where I use two encoders but not like in this video. You can probably use that as guide in terms of wiring and getting encoder values and combine that with this pot project by replacing pots with encoders. Hope that helps.
      "Anti Backlash Dual Encoder" video

  • @s.h.a.g.g.6072
    @s.h.a.g.g.6072 2 роки тому

    Good video, and very helpful, at school we are doing something kinda similar, what steps did you follow to calculate the P, I and D values?

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому +4

      Please check out "PID tuning" video on my channel. I have shown my approach about empirically determining PID gain values. Hope that's helpful.

  • @primescienceprojects
    @primescienceprojects 2 роки тому

    What is the value of potentiometer

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому +3

      Potentiometer is 10K Ohms. However, pot value does not really matter when it comes to Arduino reading analog voltage in 0-1023 range because of its voltage divider circuit.
      But, one should consider pot value if power dissipation is a concern. 10k pot at 5V only dissipates few milliWatts of power. It may or may not be significant if you're running your system on battery. Hope this is helpful.

    • @primescienceprojects
      @primescienceprojects 2 роки тому

      @@GeeKeeCeeBee thank you so much
      But I'm facing another problem that is my motor moves only in one direction and not the other direction even after rotating the potentiometer, why is it so

    • @GeeKeeCeeBee
      @GeeKeeCeeBee  2 роки тому +2

      I suspect your setup is not reversing the voltage to spin the motor in other direction. Check your direction pin wiring (pin7 and 8). Other than that I can't really say without looking at the setup and code.

    • @primescienceprojects
      @primescienceprojects 2 роки тому

      @@GeeKeeCeeBee I've cross checked the wiring and it was wiring problem. Thank you so much for this idea. You have done a great job. It's running successfully now. Thank you so much ❤️

  • @arduinomaquinas
    @arduinomaquinas 9 місяців тому

    Like full 607

  • @farihaarif2973
    @farihaarif2973 6 місяців тому

    this circuit is not working

  • @YILDIRIM-e6u
    @YILDIRIM-e6u 3 роки тому

    how for mega 2560 diagram

  • @isotechpapertech1330
    @isotechpapertech1330 3 роки тому

    Sir add 0to100 position show lcd this project plz send me code n etc

  • @arduinomaquinas
    @arduinomaquinas 9 місяців тому +1

    Great video's 👏👏👏 subscribed 🇧🇷😉👍 very useful, awesome, @arduinomaquinas thank you man !