toakhilesh
Posts: 2
Joined: Wed Feb 06, 2019 10:20 am

How to slowdown one of the motors of gpiozero Robot

Wed Feb 06, 2019 10:30 am

While creating a basic robot using gpiozero import Robot, found out that both my motors are not exactly same specs and one of the wheels moves faster than the other.

How can I slow down one of the wheels in software, without requiring any external pots, so that both wheel speed becomes same?

Code: Select all

from gpiozero import Robot
robot = Robot(left = (7, 8), right = (9, 10))
robot.forward()
robot.backward()
robot.right()
robot.left()
robot.stop()
Thanks in advance.

PiMonkey04
Posts: 10
Joined: Fri Feb 23, 2018 4:50 pm

Re: How to slowdown one of the motors of gpiozero Robot

Wed Feb 06, 2019 6:55 pm

in order to slow a motor down you need to use PWM not sure how to do this with GPIO zero

User avatar
B.Goode
Posts: 13219
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: How to slowdown one of the motors of gpiozero Robot

Wed Feb 06, 2019 7:14 pm

Simply read the gpiozero documentation here: https://gpiozero.readthedocs.io/en/stab ... html#robot

The forward() and backward() methods can be given a speed argument which defaults to 1.00 (100%).

toakhilesh
Posts: 2
Joined: Wed Feb 06, 2019 10:20 am

Re: How to slowdown one of the motors of gpiozero Robot

Thu Feb 07, 2019 2:43 am

Thanks. I think curve left and right parameter should work fine for the task.

However I was hoping for a solution that would compensate the speed at source level, like:
Use two potentiometers to control the left and right motor speed of a robot:

Code: Select all

from gpiozero import Robot, MCP3008
from signal import pause

robot = Robot(left=(4, 14), right=(17, 18))

left = MCP3008(0)
right = MCP3008(1)

robot.source = zip(left.values, right.values)

pause()
If somehow just one of the motors can be scaled without actual potentiometer, then the rest of my code can do away with extra compensation. I am not able to figure out altering the source.

Return to “Automation, sensing and robotics”