X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Message-ID: <4EF29256.8090001@verizon.net> Date: Wed, 21 Dec 2011 21:13:42 -0500 From: Ethan Swint User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.16 MIME-Version: 1.0 To: geda-user AT delorie DOT com Subject: Re: [geda-user] Design suggestions... References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mirapoint-Received-SPF: 198.82.161.152 auth3.smtp.vt.edu eswint DOT ramu AT verizon DOT net 1 neutral X-Junkmail-Status: score=10/50, host=vivi.cc.vt.edu X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020203.4EF29257.009A,ss=1,re=0.000,fgs=0, ip=96.240.170.242, so=2011-07-25 19:15:43, dmn=2011-05-27 18:58:46, mode=single engine X-Junkmail-IWF: false Reply-To: geda-user AT delorie DOT com On 12/21/2011 12:11 PM, Rob Butts wrote: > My application has two 12 v dc motors that I want to operate in both > directions with speed control. I have two potentiometers to determine > speed control for each motor. I have one push button and three to five > switches for state control. > > I initially didn't plan on speed control for each motor and I had a > PICKit 2 so I opted for the Low Pin Count development board with the > setup for the pic16F690 microprocessor. The documentation for that > microprocessor says the pmw can be set up for one, two or four > channels but it has just one pwm module. > > The processor that microchip suggests has more pins and I'd have to > purchase more development hardware. I have the code completed and > working for the five input state controller and the two adcs > monitoring the motor speed potentiometers. Does anyone have > suggestions for speed and direction control of the two motors where I > don't have to purchase new development hardware? I thought about two > micros in a master slave configuration but that would make development > and prototyping on my desk difficult. > > Thanks, > Rob The four pins will be sufficient - you'll need a gate driver. Put each motor in an H-bridge configuration, i.e. totem-pole two mosfets on each side. The low-side transistors will be your direction selectors - turn on the left for CW, turn on right for CCW, low-frequency, run a GPIO pin from the MCU. The hi-side transistors will take the PWM signals (2 for each motor, 4 total) - the gate drivers will have a boot-strap power supply to drive the hi-side gate. I'd suggest a toggle switch for direction & running and the pot just to set the speed - otherwise finding 'zero' speed on the pot will be hard. You can just take the max raw ADC value and scale that to your max PWM counter value, a simple multiply-by-constant. PWM frequency of 15kHz won't annoy most people over 30yrs, but 20kHz would be better. On your layout, keep the loop tight from +12V across the 2-FET totem to ground, bypass with a few hundred nF of ceramic caps so that the parasitic inductance on the PCB won't over-voltage the FETs and toast them - typically 10x capacitance of a FET's capacitance, given on the spec sheet. Several caps in parallel will get their ESR lower so that they handle the transient more effectively, too. The flyback current from the motor will go through the body diode of the FETs, but make sure you have sufficient time of zero PWM on the top when reversing, e.g. >50uSec. If you accidentally turn on the top FET while the bottom is turned on (or the body diode reverse recovery), you can over-current the FETs and toast them in one PWM cycle. No capacitors across the motor - you effectively have two mismatched voltage sources in parallel and the current spike will kill the FETs. No resistor in series with the motor is needed, either - that just wastes energy. -Ethan