The Straight and Narrow
Can you make a buggy drive in a straight line?
Aim: Make a straight line test track and drive your buggy along it.
It's not as easy as it sounds! Two separate motors rarely work exactly the same so your buggy might veer off in one direction or the other when you try to drive straight.
Imagine if a car or bike didn't go straight. Even tiny differences in how well aligned the wheels are and how well they perform has a big impact on how much fuel it takes to drive.
It gets even harder when, just like these buggies, the wheels are powered by different motors. Tuning the output of each motor will make the difference between a useful vehicle and something that can only go in circles!
Hints and Tips
We've used a couple of different buggy kits for this.
The Robo:Bit has a custom library built for it. Remember to click Advanced > Extensions and then search for 'robobit' and open that library to find the pre-built code blocks.
If not, you can change the speed of each motor until they balance each other.
If it turns to the left, the left motor is working better than the right - so you can either slow down the left motor or speed the right motor up.
The :MOVE Mini has a custom library built for it. Remember to click Advanced > Extensions and then search for 'kitronik-servo-lite' and open that library to find the pre-built code blocks.
Calibrating the MOVE Mini is harder. There isn't a pre-built block for setting the motor speeds separately.
If this code doesn't make your buggy drive in a straight line, we will need to set the motor speeds manually.
|You can do this by telling the servo motors what speed to spin at. It's tricky!|
Get in touch
Did you manage to get your robot to drive straight?
Are there other kits you'd like help with?
Have you got a better way to get these kits to drive straight?
Tell us all about it at firstname.lastname@example.org