View Single Post
  #10   Spotlight this post!  
Unread 16-12-2003, 00:21
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: Speed Control for Balancing Vehicle

Quote:
Originally Posted by Adam Y.
It is a matter of producing the right wave. I don't believe the PWM command produces a nice on and off signal like the pulseout command does. R/C controllers use that on and off signal to determine the speed of the esc. The only time you would use the PWM command is to produce an analog voltage by attaching a resistor to the pin. I believe Parallax would have more information on it. Also, if you search a little you can find a debate I had with someone on this same topic.
The differences bettween pulseout and pwm are as follows: (don't have an actuall manual at hand, but this should be correct anyhow)

PWM: outputs a square wave of a given frequency and periond. If you keep the frequency fixed and simply vary (Modulate)the duty cycle (Pulse Width) you can use the signal for various things: driving a motor through a H-Bridge, creating an analog output with a resistor and capacitor between the pin and ground (in parallel).
Note however, this isn't quite the same as the PWM signal used in RC cars (which is what the IFI speed controllers use). The rcPWM signal has a frequency of 50-60Hz and the duty cycle varies from approx. 1-2ms. Now you could try and use the this to control a speed controller but you would only have about 25 steps of resolution for the rcPWM signal.

PulseOut: Outputs a single pulse of a specified duration. Not quite sure of the resolution (due to the lack of manual), but it will be considerably better for rcPWM than the PWM command.
To use it to control a speed controller (or a servo) you simply need to output a pulse of 1-2ms in width about every 20ms (that doesn't need to be too accurate). Now while that will still force to keep track of when you have to emit the pulse, it will considerably improve your control of the motor.


Sorry for my long post...(I seem to have a tendency to do that)