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
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.
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 ❤
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?
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??
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.
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.
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.
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?
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 !!!
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.
THANKS A LOT CAN YOU PLEASE POST VIDEO FOR THE (CONTROLLING OF DC MOTOR 'ACTUATOR ' PROGRAMABLE POSITION WITH MEMORY BUTTONS USING ARDUINO. BEST WISHES
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
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!
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!!
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??.
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
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.
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
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.
@@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
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.
@@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 ❤️
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
Same system, Could you pls change dc motor by stepper? Thanks
Thank you for explaining the PID feed back loop and the conversation into code. 👍🙂
this the king of tutor whom we should support for the outstanding explanation and sharing knowledge. thank you
Thank you, that's very kind of you to say that. Im glad my videos are helping.
Thank you very much ❤ I used this method for control Doosan 225 excavator throttle 🤘🤘
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.
Your project is very perfect.
Thnaks🙏
thank you, good video, would be good if you go into the details of the math behind the Transfer function.
Thank you very much for the tutorial that you have made, it really helped me to solve the steering ruder control problem.😇😇
Very exellent , can this be replicate with dc motor with reduced gear box of about 7 rpm ???
Good job! How did you get 360-degree rotation? Because the rotation of potentiometer is less than 360-degree.
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 ❤
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?
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??
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.
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.
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.
Best video
Thankful sir.
Instead of using reference potentiometer , can i directly use values from a oled display to turn the motor to a specific position?
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?
Yes!
Nice you are life saver. How can is use a mobile phone instead of potentiometer?
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 !!!
You got it right. There's a typo when defining the encoder pot. Glad video was helpful. Thanks for watching 👍
@@GeeKeeCeeBee when you read analog potentiometer you get angle ??
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.
Loved video ❤👏👏👏
THANKS A LOT
CAN YOU PLEASE POST VIDEO FOR THE (CONTROLLING OF DC MOTOR 'ACTUATOR ' PROGRAMABLE POSITION WITH MEMORY BUTTONS USING ARDUINO.
BEST WISHES
How robot line tracking using PID controll?
felicitaciones maestro
How can is limit the rotation to 90 degrees only?
wow great !
good job thank you
is it 100% possible for precision work
Hello, if i'm going to use BTS7960, where should I tap the 6,7,8 pins fron arduino to bts7960 pins? Thank you
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
Отлично!
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!
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.
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!!
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??.
Thank you, Jeff. Much appreciated 🙏 I have responded to your questions via email. Hope that's helpful. Thanks again
excelent! It´s possible to do this same with the ESP-32?
Yes, absolutely. Technically, you can use any microcontroller to do this.
Can i use Rotary encoders instead of potentiometers for this project ?
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
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.
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
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?
Please check out "PID tuning" video on my channel. I have shown my approach about empirically determining PID gain values. Hope that's helpful.
What is the value of potentiometer
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.
@@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
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.
@@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 ❤️
Like full 607
this circuit is not working
how for mega 2560 diagram
Sir add 0to100 position show lcd this project plz send me code n etc
Great video's 👏👏👏 subscribed 🇧🇷😉👍 very useful, awesome, @arduinomaquinas thank you man !