So now you change your requirements, great. We love people like that. You need a logic level FET in place of that transistor.
Is Google broken where you are? Just google
Arduino motor speed control
And switch to images, there are lots.
The usual crap from completely clueless people, pretty much guaranteed to damage your equipment.
There is no base resistor, so you can burn out the Arduino output pin, and it lacks a flyback diode across the motor, so you can burn out the transistor. Hey, it worked once, so spread the love and whoopee!
The page header explains:
As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.
For code, you use 'analogRead()' to read the pot.
Then you map the 0-1023 value to 0-255, using 'map()' or divide by 4.
Next you write the resulting value to the motor pin using PWM, 'analogWrite()'.
A very basic circuit, using a MOSFET:-
The value of the MOSFET and the diode must be chosen to suit your motor.
The 10K resistor just stops the motor from jerking on powerup.
Edit: Connect the Arduino ground to the MOSFET and pot grounds, of course.
Also, as Mike says, the MOSFET must be a "logic-level" type to allow it to switch on fully with 5V.
How accurate do you need to have the speed constant
for a varying load?
A PWM does a reasonable job for light loads but if the load
on the motor changes a lot, you need some type of feedback.
Several possible methods are:
Have a encoder on the motor
A separate small motor as a generator
A current sense resistor, ( knowing the average voltage and motor resistance )
Sample the motors free running voltage during the off time of the PWM
looking for the appropriate component , heres the specs,
the motor will be a cordless drill motor, 12V and usually has the option of about 2amps from its battery, however this will be on a DC 9v 1.5amp power supply. apparently I'm need a logic level MOSFET. but theres a few out there with different specs, not sure which will be safe, i don't want it to over heat etc...
You cannot drive a p-MOSFET like that - it acts as a high side switch so the source will be at 12V
and you'll need to level shift to be able to drive its gate.
do you know if there is any other way to solve this, I only need to regulate the speed of this motor,
specifically this drill motor because it has good gearing and a chuck so, i get lots of torque and can easily camp it to an axle to drive anything i want, I've not found an easy way of doing this yet, even if there is just a product out there thats pre made, and i don't have to worry about the math. ?
Switch the low side with a logic level n channel mosfet beefy enough to take the stall current with some margin for error. 1.5a supply may be insufficient - does it work on that supply directly?
atm , I've took the trigger out of the drill, and put a jubilee clip around it,and hooked it up directly to the dc wall wart/power supply to regulate speed, its never had a problem running for hours and hours, but this is messy and not perfect,
im not too sure how and where these new parts would go and what model of component id need, ?
dwightthinker:
How accurate do you need to have the speed constant
for a varying load?
A PWM does a reasonable job for light loads but if the load
on the motor changes a lot, you need some type of feedback.
Several possible methods are:
Have a encoder on the motor
A separate small motor as a generator
A current sense resistor, ( knowing the average voltage and motor resistance )
Sample the motors free running voltage during the off time of the PWM
I suspect there are others.
Dwight
at the moment i just want to get the motor turning at a speed, not too accurate, the motor drives a fairly heavy mechanism, this is why I'm using the drill as they have lots of torque, and the chuck is ideal as a way to attach it to the driven axles, , but thanks for the advice,
OldSteve:
For code, you use 'analogRead()' to read the pot.
Then you map the 0-1023 value to 0-255, using 'map()' or divide by 4.
Next you write the resulting value to the motor pin using PWM, 'analogWrite()'.
A very basic circuit, using a MOSFET:-
The value of the MOSFET and the diode must be chosen to suit your motor.
The 10K resistor just stops the motor from jerking on powerup.
Edit: Connect the Arduino ground to the MOSFET and pot grounds, of course.
Also, as Mike says, the MOSFET must be a "logic-level" type to allow it to switch on fully with 5V.
will this product work in the same way as your schematic, but on its own, not with any arduino additions
You might want to check the current rating of the wall wort
you are using. You may find it doesn't have enough to run the drill
motor.
Those voltage switched ones usually have vary little current output
and are poorly regulated.
Dwight
Adamkdrums:
at the moment i just want to get the motor turning at a speed, not too accurate, the motor drives a fairly heavy mechanism, this is why I'm using the drill as they have lots of torque, and the chuck is ideal as a way to attach it to the driven axles, , but thanks for the advice,
I doubt if a motor rated at 12v 2A will be man enough for a 'fairly heavy mechanism' unless the motor gear ratio is very large, and if the load is not constant, the speed may vary more than you might like.
There are many PWM motor 'controllers' on sale on ebay, much cheaper than the product you referred to. I have a couple in use to vary motor speed, but they cannot actually control it to any degree.
will this product work in the same way as your schematic, but on its own, not with any arduino additions
No. That product takes a variable frequency input to control the motor. That circuit uses PWM ( pulse width modulation ) to control the duty cycle given to the motor.
dwightthinker:
A PWM does a reasonable job for light loads
I have found exactly the opposite. With light / no loads PWM has little effect, it is only when the motor is mechanically loaded that PWM has a significant effect. This is because with light loads the motor just coast along over the bits in the PWM cycle where power is not applied. With a heaver load it will tend to break the motor when no power is applied. However I do agree that when the load varies PWM by itself will not keep the motor going at a constant speed.