I am currently using 4 separate hoverboard motors for a 4 wheeled robot. I am having an issue keeping all of the wheels in synch with each other. I'm using a separate motor controller for each motor so I can control each separately.
I tried using an offset for each wheel but I feel like there has to be a better way.
I plan on trying a PID controller to match the speed but I was wondering if I am missing something a lot simpler. I'm not looking for code, just a few ideas.
4 BLDC motor controller, arduino mega, a 24v voltage regulator, 4 hoverboard wheel/motors
BLDC Motor Controller.
What does the software interface look like?
What do you mean by software interface?
I attached the drawing that I am using. I'm not using a potentiometer but I'm controlling with the motor driver with three wires. I am using one pin for wheel direction, ground, and for PWM input.
I also moved the wires so I am only using timer 1 and 2. Timer 1 is on the right side and timer 2 is on the left. The two wheels on each side should be moving at the exact speed.
Fine! You use PWM. Do You use an Arduino as controller? I guess so.
The Arduinos I'm used to runs PWM from 0 to 255. That is not very precise, I mean PWM 200 or 201 quickly makes a significant difference. Your idea about using PID is likely very good.
I am using an Arduino Mega for PWM to each motor. I was also thinking each motor may spin at slightly different speeds because of the differences between the motors, or friction. I'm pretty sure the only way I can do it is with a PID and monitor the sensor in the wheel. Do you know where I might be able to find an example of a PID or a good starting point? I've never used the PID library before.
You do have good knowledge. Some more knowing helper likely have a link to a good tutorial.
Waiting for that, I suggest starting with the P component, the proportional. newVal = newVal - kP * error.
Using a concervative kP giving a remaining error kI for the integral part can be tuned up. newal = newVal + kI * integration (the sum of errors).
For fast and accurate responce the derivating component is needed, kD.
PID sounds like it is the best method to synch the wheels.
I have one more question about the timers. If I use two separate internal timers in the Mega, will the frequency between the timers drift over time? I also thought the internal timers could be an issue.
To be sure, use one timer. If they use the same setup they ought to run the sama fast.
But, the motors are likely not matched.