In this video, I demonstrate how to use PID Control to synch the positions of two motors with encoders by only using two interrupt pins on the Arduino.
Check out this Reference Desk Mat for Arduino:
[ Ссылка ]
Video Timestamps:
0:00 - Introduction
0:33 - PID Control for a single motor
0:40 - Parts needed
0:46 - Pin out for the motor and encoder
0:58 - Wiring the circuit
1:16 - Arduino code for one motor
4:40 - Selecting the gains
5:27 - Beginning of two motor example
5:32 - Updating the wiring for two motors
5:58 - Arduino code for two motors
7:29 - Selecting the gains for the two motor example
7:58 - Conclusion
The code for the section with PID control for a single motor was adapted from what was presented in this video below. I have no incentive to reference this video, but it's a great resource for other projects:
[ Ссылка ]
👉Subscribe for more robotics and engineering tips:
[ Ссылка ]
Share this video with a friend:
[ Ссылка ]
Website:
[ Ссылка ]
Parts needed for this example:
Arduino Uno - [ Ссылка ]
Gear Motors with Encoder - [ Ссылка ]
Power Supply - [ Ссылка ]
Motor Shield - [ Ссылка ]
(Note: This shield is a different one from the example. Make sure the pin assignments line up with the the documentation for the shield.)
Connect:
Instagram - /theboredrobot
Twitter - @theboredrobot
Facebook - [ Ссылка ]
Pinterest - /TheBoredRobot
Disclaimer: This video contains affiliate links, meaning that if you make a purchase from one of the product links, I'll receive a small commission.
![](https://i.ytimg.com/vi/bsB5shP3vls/maxresdefault.jpg)