Go Down

Topic: Control External Power (Read 980 times) previous topic - next topic

saltzmanjoelh

I have a power source that takes AA batteries that is meant for some dc motors. Right Now I can only power the motors as full power on or off. How do I regulate the external power with my arduino like I can with the PWM pins?

RuggedCircuits

I think you want to use something called a motor driver. That can be used with PWM to control the average amount of power delivered to motors. We sell one but there are lots of others available at hobby robot sites, Sparkfun, Adafruit, etc.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

saltzmanjoelh

I would prefer not to use something prebuilt. I guess the real question would be how do a I control power (like PWM) from an external source?

RuggedCircuits

You....build a motor driver.

A motor driver is nothing more than a current amplifier. It takes a small current (from the Arduino) and allows a larger current to flow in response. The simplest motor driver is just a transistor. A small current into the base of a (BJT) transistor allows a larger current to flow into the collector. If you just want your motor to go in one direction then this is an easy way to do it.

The motor's inertia smooths out the on/off behavior of the PWM signal to give a reasonably-constant average speed that is proportional to your PWM duty cycle.

If you want your motor to go in both directions (forwards/reverse) you will need to build an H-bridge (4 transistors).

Originally you stated "I have a power source that takes AA batteries that is meant for some dc motors." If you can tell use how many AA batteries (i.e., the voltage of the battery pack), how many motors, the voltage/current rating of the motors, etc. then we may be able to make some more concrete suggestions.

--
The Aussie Shield: breakout all 28 pins to quick-connect terminals

CrossRoads

An logic level N-Channel MOSFET  would be  good choice also, will run significantly cooler than NPN when the current load increases.
Drive the Gate with PWM, connect V+ to Motor+, Motor- to Drain, Source to Ground.
1st Resistor protects Uno pin,  2nd ensures MOSFFET turns off quick, diode takes care of motor-generated voltage spike that occurs when current is shut off (a by product of current flow thru an inductor - cars take advantage of that to drive spark plugs - older cars do anyway).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

saltzmanjoelh

Thanks for the replies. Transistors sound like what I was looking for. I will look into the logic level N-Channel MOSFET.

My power source came with a motor kit. It was 4 motors and wheels, a 5 AA battery pack.

http://www.robotshop.com/dfrobot-4wd-arduino-mobile-platform-3.html


CrossRoads

Ah - well, that schematic will only let the motor go in one direction.
I imagine you will want to go in both directions? In that case  you need an H-Bridge.
That has 4 transistors arranged so that current can be commanded to flow in either direction.
Here is an example with transistors turning on relays.
You would replace the 'upper' transistor-relays with P-channel MOSFETs and the 'lower' transistor-relays with N-channel MOSFETS.
Or get an H-Bridge chip which has all that internally.

I would discuss more, but I'm off to a fencing tournament ...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up