Go Down

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

ebarker2

Im going to tr'y this tomorrow.  I couldn't find this particular mosfet, so bought another, 100v 30 amp one.  Where do I find the sketch for the arduino, or does the one from the original thread work? thanks

CrossRoads

Quote
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...


The original sketch can be made to work.
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.

MarkT

Quote
The Arduino 5v line probably can't supply enough current for the motor


Make that "The Arduino 5v line defnitely can't supply enough current for the motor and trying to do so may damage the Arduino board".
[ I won't respond to messages, use the forum please ]

Saad Khalil

check this, if it helps so good, if not then sorry  :)
if u want to increase and decrease speed of your 12V DC motor in one direction, u should have 12V DC supply and any of the 5 Volt NPN transistor..
so u can do it in 2 ways, according to your needs.. if u want to control it by yourself at anytime so u can use potentiometer connected to analog pin 0 i-e (A0), otherwise if u want to control it according to time or some sensor so instead of potentiometer u may give input according to that, so after this connect PWM pin 10 to NPN transistor base and connect motor and 12V battery in series in between collector and emitter of transistor..
if u r new, so in program i have also explained everything..
Code: [Select]

/*
  Motor Speed Controller
  First Declare an integer variable "potentiometer" for
saving the input value of potentiometer.
  The speed of the Motor will depends on the value obtained by analogRead(). */
intsensorPin   = A0;        // select the input pin for the potentiometer
intmotorPin    = 10;     // select the pin for the Motor
intsensorValue =  0; // variable to store the value coming from the sensor
void setup()
{
pinMode(motorPin, OUTPUT);  // declare the motorPin as an OUTPUT
}
void loop()
{
     // Range of Analog Value(Potentiometer) is in b/w
  // "0" & "1023" as we have 10 bit ADC in Arduino.
sensorValue = analogRead(sensorPin);
     // PWM is 8-bit so we can write from 0 to 255 not from 0 to 1023.
  // So using map function we will write sensorValue on output.
int mapped = map(sensorValue, 0 , 1023 , 0 , 255);
analogWrite(motorPin, mapped);  }

Saad Khalil

dc42


Im going to tr'y this tomorrow.  I couldn't find this particular mosfet, so bought another, 100v 30 amp one.


Just make sure it's a logic level mosfet, not an ordinary one - especially if your motor may take more than 1A.
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