Go Down

Topic: Correct schematic for DC motor contoller (Read 2 times) previous topic - next topic

ebarker2

Hi, I want to make this dc motor controller
http://arduino.cc/playground/Main/DCMotorControl

but it says to contact the forum as the schematic is incorrect.  Any idea where i can find the correct one thanks

terryking228

Hi, It's just really oversimplified and assumes that you can get a Double-pole double-throw relay that can be driven directly from Arduino.

Anyone have a pointer to something more realistic??

You could use a relay board like this with two Single-Pole Double-throw contacts, plus the transistor speed control... :
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=171

DISCLAIMER: Mentioned stuff from my own shop...!
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

CrossRoads

No, a schematic with a double pole double throw relay to change direction on a single motor was posted in the last couple of days.
Something like this.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

ebarker2

Thanks. I don't need a controller to turn a motor in both directions. Im really looking for one that will turn a motor in one direction but with variable speed.  Looked round on the Arduino playground and tutorials, but not sure there's anything simple enough for me, as this is first project.  Also reading a schematic is going to be uphill...

dc42

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

retrolefty

I like also to wire a 10k ohm resistor between mosfet gate and source terminals. This forces the motor off if for any reason the Arduino is powered off or reset but the motor's voltage source is still on.


Lefty

dc42


I like also to wire a 10k ohm resistor between mosfet gate and source terminals. This forces the motor off if for any reason the Arduino is powered off or reset but the motor's voltage source is still on.


Yes, that's a good thing to do, I usually do it myself too.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

ebarker2

thanks that.  Strugglling to read the schematic.  Is it the 'Arduino PWM pm'? and what is that?  Also am i correct in reading 'Logic level power mosfet'?

Once ive got this circuit built (with the additional resistor), do i then use the code from the original motor controller thread?
thnaks in advance.

dc42

Sorry for my poor writing, it's 'Arduino PWM pin' meaning an Arduino output pin that supports PWM. You set the power you want by making an analogWrite call to that pin.

'Logic level power mosfet' means a N-channel power mosfet with logic level gate drive (i.e designed for 5v gate drive instead of the usual 10v). I usually use type STP40NF10L but that's rated at 100v 40A (both much more than you need) and there are cheaper ones that will work in this design.

The diode connected in parallel with the motor needs to be rated at the full stall current of the motor.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dc42

#9
Oct 05, 2011, 10:33 pm Last Edit: Oct 05, 2011, 10:35 pm by dc42 Reason: 1
If you want to control the motor speed using a potentiometer (as in the playground example but in one direction only), there are a couple of things wrong with the schematic. The pot should be wired with one end connected to +5v, the other end connected to ground, and the slider to pin A0. The other thing wrong with it is the position of the diode, but if you're using my schematic then that's already dealt with.

Here is a sketch for controlling the motor from the pot:

Code: [Select]

const int PotPin = 0;
const int MotorPin = 11;

void setup()
{
 pinMode(MotorPin, OUTPUT);  
}

void loop()
{
 int value = analogRead(PotPin);
 analogWrite(MotorPin, value/4);
}
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

ebarker2

Thanks, very helpful.  Re the diode in parallel, i've no idea what the full current of the motor. I've made a homopolar motor using a number of small neo magnets and a copper coil round an iron bar.  The motor works, but it goes far too fast.  trying to slow it down with this controller.  is the diode something i can just guess at, or do i have to figure out the current of the motor?

dc42

If you have a multimeter that can read a couple of amps or so, you can put it in series with the motor to find the current it takes. The worst case is the stall current, i.e. the current when the motor is prevented from rotating.

Alternatively, measure the resistance of the motor with multimeter. Divide that resistance into the voltage you want to run the motor from to get the stall current.

If the current is not more than 1A, you can use a 1N400x diode where x is any digit from 1 to 7. Actually, these diodes are probably good for 2A of motor current, because they are rated at 3A pulsed and they only have to take short pulses in this application.

If the motor current is higher, then go for a higher-rated diode as appropriate.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

ebarker2

Thanks, this is proving far tougher than i'd imagined.  I think its the different suggestions and alterations that are throwing me off, not to mention novice status and general incompetence.  Anyway a few questions re the schematic:

Where does the 'motor supply +ve' get connected to?  Is it the 5V on the arduino?

Where does the 'motor supply - ve connect?   It's not the ground, so where?

Im having a hard time picturing how the diode that bypasses the motor actually is wired on the breadboard.

Also true for the Mosfet.  If the mosfet is theis the arrow facing left, then what is the gap and next white line? a switch?  (or is that all the mosfet).  The resistor comes after than, and then that gets connectd to the PWM pin.

The diode that you show bypassing the motor, how exactly does one wire that?

I will try to put an effort together and post it.

thanks again






CrossRoads

Motor+ connect to power supply, the one that feeds the power jack, generally not a good idea to supply from 5V regulated power.
Makes regulator run hot, can  starve the ATmega of current & cause resets also.

Motor- in this case is Arduino ground, as you are running 1 direction only.

Diode needs to be wired across the motor, as close to the motor as you can.


The Mosfet is all the lines.

How you connect the diode is up to you & your evolving assembly skills :)
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

dc42


Where does the 'motor supply +ve' get connected to?  Is it the 5V on the arduino?

Where does the 'motor supply - ve connect?   It's not the ground, so where?


The Arduino 5v line probably can't supply enough current for the motor, so I assumed you would be using an external supply for the motor, such as a battery or wall wart (possibly the same supply that you use to power the Arduino through the barrel jack or Vin pin). That's where the motor supply + and - come from.


If the mosfet is theis the arrow facing left, then what is the gap and next white line? a switch?  (or is that all the mosfet).


It's all the mosfet.


The diode that you show bypassing the motor, how exactly does one wire that?


In parallel with the motor, with the stripe on the diode on the end that is connected to the +ve supply.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up