View Single Post
  #10   Spotlight this post!  
Unread 29-04-2008, 18:58
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,995
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Victor logistics.

Note that you don't *need* a microcontroller for this - a servo amp, a 555 circult, and other ways exist that are entirely in hardware.

But, let's say you wanted to do it in a uC just for the learning experience.

First, you need a comparator to clean up the incoming PWM signal and slice it at a good decision level, say 2.5 volts (for a 5v PWM signal). Feed the output (TTL level) into an input pin on the uC. Set a timer to start when the pin changes state (low to high, for example) and read the timer when it changes state again. Store that value, it'll translate to a value between 0.9 mS and 2.1 mS (or so).

Meanwhile, reset the timer and set it to trigger at the next pulse.

Then, using one of several methods (I suggest a look-up table), set the on-off ratio of an output pin to a value between maybe 0/5% and 95/100%. Pick a pulse rate between about 500 Hz and 4 kHz, but that can realistically be between 60 Hz and 20 kHz or more.

This output pulse controls an H-Bridge - homebrew with discrete FETs or bought as an H-Bridge module.

When the on-off ratio (duty cycle) is 50%, the motor won't move, since forward voltage and reverse voltage cancel - the motor won't move forward or backwards, the pulses are too short and evenly balanced. At 5% duty, it'll move backwards, and at 95% it'll move forwards.

If that's not enough to get you started, write back.

Don
__________________

I am N2IRZ - What's your callsign?

Last edited by DonRotolo : 29-04-2008 at 20:16.