Cruise control via Stamp or another circuit.
I am attempting to make a simple speed control for an RC truck chassis robot.· I am bench testing some simple code that sends a Pulseout command to a RC motor controller and follows up with a Count command to a QTI sensor.· Below is a condensed version of the code:
DO
····GOSUB ApplyPulseSpecial
··· GOSUB MotorControl
LOOP
'
[noparse][[/noparse] Sub Routines ]
ApplyPulseSpecial:
······· PULSOUT Motor,MotorPulse ' Apply the pulse.
······· COUNT QTI,18,QTIPulse '14 good with debug is the high limit with debug
····························· '20 is good w/o debug output
······· 'DEBUG DEC QTIPulse,"+++",DEC MotorPulse, CR
······· RETURN
MotorControl:
····· IF QTIPulse < 4 THEN
········· MotorPulse = MotorPulse+1 MAX 950
······· ELSEIF QTIPulse >·8 THEN
······· MotorPulse = MotorPulse-1
····· ENDIF
······ RETURN
The Count duration (18 in this case) requires CONSTANT tweaking as the code expands.·· I understand the limits of the Stamp processor so my question is this:
·Is there a simple circuit I can build (or buy)·that will do the PID speed managment for me and not take up code and processor time?·
The circuit input from the·STAMP would be either HIGH for Go or LOW for Stop.· The circuit would then send·a pulse to the motor speed controller (1.5ms +/-).· The·circuit would also monitor the pulses from an·input like a QTI sensor to provide speed feedback.··The circuit would then adjust the motor controller·output pulses if the feedback pulse rate did not match some predetermined rate.·
Seems to me there is some digital comparitor that would do this much more effectively than using code.
·Thanks for your help.
Steve Woodrough
·
DO
····GOSUB ApplyPulseSpecial
··· GOSUB MotorControl
LOOP
'
[noparse][[/noparse] Sub Routines ]
ApplyPulseSpecial:
······· PULSOUT Motor,MotorPulse ' Apply the pulse.
······· COUNT QTI,18,QTIPulse '14 good with debug is the high limit with debug
····························· '20 is good w/o debug output
······· 'DEBUG DEC QTIPulse,"+++",DEC MotorPulse, CR
······· RETURN
MotorControl:
····· IF QTIPulse < 4 THEN
········· MotorPulse = MotorPulse+1 MAX 950
······· ELSEIF QTIPulse >·8 THEN
······· MotorPulse = MotorPulse-1
····· ENDIF
······ RETURN
The Count duration (18 in this case) requires CONSTANT tweaking as the code expands.·· I understand the limits of the Stamp processor so my question is this:
·Is there a simple circuit I can build (or buy)·that will do the PID speed managment for me and not take up code and processor time?·
The circuit input from the·STAMP would be either HIGH for Go or LOW for Stop.· The circuit would then send·a pulse to the motor speed controller (1.5ms +/-).· The·circuit would also monitor the pulses from an·input like a QTI sensor to provide speed feedback.··The circuit would then adjust the motor controller·output pulses if the feedback pulse rate did not match some predetermined rate.·
Seems to me there is some digital comparitor that would do this much more effectively than using code.
·Thanks for your help.
Steve Woodrough
·
Comments
I may have answered my own question. Can I "turn over" all active servo commands from the BS2 to a Parallax Servo Controller (USB)? I ***_u_me that I can monitor my speed and object sensing, etc. with the BS2 and send updated commands to the Servo Controller on an as needed basis. Is there a functional difference between the USB and Serial versions aside from the connections and support software?
Thank You...Steve