Subject:
|
Motor Speed Control
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Tue, 30 Nov 2004 01:40:03 GMT
|
Viewed:
|
5434 times
|
| |
| |
Hi,
I'm trying to do a basic test setup to code a compact speed control module
for the 9V gearmotor. I've mounted an encoder (rotation sensor) directly to
the gearmotor shaft.
In my code, I'd like to set a variable (speedDesired) and have the motor
accelerate to match that desired speed. If I change that variable in any
other task, I want to have the motor decelerate/reverse/etc. to match the
desired speed smoothly.
I've got a task monitoring the actual speed of the motor, derived by
constantly 1. putting the current encoder position in a variable, 2. waiting
a short time (~1/100 sec)., 3. putting the current encoder position in a
second variable, 4. subtracting the two variables. That gives me the shift
of the motor shaft within that time interval.
So then I can say, in another monitoring task, is the current speed greater
or lesser than the desired speed? And accordingly change the speed of the
motor in steps. This is terribly cumbersome, but I've got a whole bunch of
IF statements set up changing the motor power (0-7) and stuff, and it's a
mess and is all jumpy.
Has anyone done something at all similar to this? I'm aiming at geting
smooth, slow motor speed.
Iain
|
|
Message has 3 Replies: | | Re: Motor Speed Control
|
| Hello Iain, (...) You should definitely try Dick Swan's 10x firmware ((URL) Among other goodies (interpretation speed for example ;o), it features more power levels (128 instead of 8), and a flag to modify behavior of PWM motor control. Standard (...) (20 years ago, 30-Nov-04, to lugnet.robotics.rcx.nqc)
| | | Re: Motor Speed Control
|
| (...) I'm doing somthing similair at the moment. My robot runs along a track and needs to be controlled so it doesn't go too fast. I've successfully written some code which limits the top speed, you may be able to modify it or just incorparate ideas (...) (20 years ago, 30-Nov-04, to lugnet.robotics.rcx.nqc)
|
10 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|