How to control multiple DC motors with encoders

preview_player
Показать описание
In this video, you'll learn how to connect and write code to control several DC motors with encoders using the PID algorithm.

Code (in MultipleEncoders/):

If your platform does not have access to "atomic.h" (and so you get an error message), you can use the alternative version of the code that has been uploaded to the repository. It is labeled "_NoAtomic".

Parts:

Sponsored by Pololu: Pololu sent a few promotional parts to help make this video!
Рекомендации по теме
Комментарии
Автор

This is nice. Even the quality of the sound is on another level. Not what I was expecting from a smaller chanel. Great work!

claudiunedelea
Автор

Just stumbled upon your channel, and I hope you keep it going. Great videos, I really appreciate everything you do. Thank you for sharing!

mohamedelsheraiy
Автор

This channel should have millions of subscribers it's great!

samuelheritier
Автор

Great to see a new video Curio!! That is perfect as others.
Thanks :)

muuco.
Автор

I've used motors very similar to those in the video (great video). Like many inexpensive motors, the same power settings to not result in the same motor speed. The PID speed controller will run the motors at the same speed after an initial speed up time. During that time, the motors will not be turning at the same speed and the robot will not run straight. It's easier with four wheels because the friction keeps the robot from moving cross track. For a differential drive robot to run straight, the motors need different initial pwm values.

johnZarkov
Автор

CR: What a code loaded video! The ATOMIC_BLOCK and template aspect were unknown to me; shows how DYI I am. You have elevated my understanding substantially for a lawn cart project which will takes its drive input from a joystick controller communicating with HC-12 transceivers. The joystick forward/reverse axis will be straight at +/- speed and the left/right will be radius of curvature of a turn. You use SimplePID which may require a library but I don't see yet where you set the PID compute rate; it may just be the loop() itself.

thorntontarr
Автор

I absolutely love your videos. The way you explain things is perfect. I am using your code in a robotic project and believe I understand the feedback loop. My robot is running mecanum wheels. What I am scratching my head on is how to change directions. With mecanum wheels, I can rotate in place, move left/right, and so on. But apparently my intellect is having a hard time incorporating this into your code.

erikrodriguez
Автор

de lo mejor que he visto en la red, felicidades

MiguelAngelVargasFlores
Автор

Thanks for the video!! I have a question . Can we control stepper motor in the same if hallow encoder fixed at end of shaft of motor?

AS
Автор

That's really cool. Learnt a lot.
Thanks for sharing!

kashv
Автор

Can you tell me what power supply are you using, I am making the same robot as you thanks.

Solidstimy
Автор

Can we do speed control for 4 DC MOTORS like this.

mubi
Автор

Thank you very much. your tutorial is very helpful for me. your tutorial is what I am looking for.

johnnam
Автор

hello. can I ask you 2 small question: 1.pls explain this small part og your code float deltaT = ((float) (currT - prevT))/( 1.0e6 ) why are you divide by 1.0e6. 2.t = fmod(t, 12) maybe if you are explain 1 question, no need to explain last question.

andrewpet
Автор

Great video, will be very useful for my project

CryingNeutrons
Автор

Hi, I'm building an obstacle-avoiding robot with an ultrasonic sensor. How can I integrate the PID control into the robot I am doing? (I don't know much about coding and Arduino. I'm trying to do this project to get through class.)

mustafacan
Автор

Cool video 👍 I think, that speed control with encoders is more difficult. I thought of measuring the time between interrupts and dividing the rotation angle by it, but there may be acceleration between the hall ticks, which introduces an error.

pohjoinenklaani
Автор

Oooh, I like how you used a template function (readEncoder) to essentially pass an argument, since attachInterrupt doesn't give you a way to have it pass arguments to the interrupt service routine. Hopefully, I'll remember that trick for later.

(I've used closures which bind that kind of parameter at runtime, but this looks like compile time -- two different copies of readEncoder are generated.)

markday
Автор

Hello Curio Res, I found your example on YouTube that interests me a lot because I have two reduced motors with encoder and I would like to know if it is possible to synchronize the two motors to have the same speed so the same count on the two encoders.
I have two ballasts is they have two pistons to fill them or empty them with water, my problem is that I have a faster ballast than the other, I saw your code and I modified it but I hold a little, can you help me to recover the value of the encoder from the right engine and that of the syncronized left engine in order to display them on an LCD?
I use an L298N ....

Thanks for your help..

Alfred

bbjodel
Автор

I love your channel! Please keep going :)

coerol