0
$\begingroup$

My Raspberry Pi car bot will not drive straight at all.

After examining and listening to the two motors, I noticed that the right wheel is a lot faster. I have matching wheels and the same code structure for commanding my wheels to turn. I have my motors hooked to an H-bridge also. I am not using PWM or anything fancy that I am aware of. I have watched many YouTube videos of programming robots to drive and my code is not that much different.

Why are my wheels turning at different speeds when programmed the same way? How should I fix this?

$\endgroup$
6
  • $\begingroup$ I have read forms about how real cars drift off when you drive straight. I get that but my pi robot is not driving straight at all. The right wheel is just too much faster compared to left wheel even thought its wired the same. $\endgroup$
    – sirshakir
    Nov 27, 2018 at 23:20
  • 1
    $\begingroup$ isolate the problem ..... first, switch the motor connections at the H-bridge .... does the problem move? $\endgroup$
    – jsotola
    Nov 28, 2018 at 2:12
  • $\begingroup$ You need to understand if your problem comes from the motor, the power circuitry or the code. then if you don't use any controller loop you will never drive straight as the motor/wheel will never have exactly the same behavior. $\endgroup$
    – N. Staub
    Nov 28, 2018 at 12:27
  • $\begingroup$ Welcome to Robotics, z Eyeland. I'm marking this question as a duplicate of another "my car doesn't drive straight" question. You can read more detail in my answer there, but essentially there are very small things, typically manufacturing differences, that you can never account for. You will never get both sides exactly the same. You need some form of feedback to keep the robot going straight. $\endgroup$
    – Chuck
    Nov 29, 2018 at 15:33
  • 1
    $\begingroup$ Thanks all. I solved the problem using PWM. I am amazed how identical motors can be different. Figured my motors should ride somewhat straight without PWM such as Chuck stated above. $\endgroup$
    – sirshakir
    Nov 29, 2018 at 17:11

1 Answer 1

0
$\begingroup$

Did you implement a controler? It is common that the same model motors are not exactly the same and if you just give an input each one is going to behave differently. If you have feedback from the motors you can implement an PID controler and see the results. It's pretty easy to implement a couple of code lines.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.