I see a lot of tutorials and such for fine tune control of DC motors. I'm trying to 'simply' turn a vibrating motor on and off. Any thoughts on this? Is it difficult because of AC power on Arduino?
if its button 2 (pin 7 on the joystick connector) what you can do is hook the arduino up so its tuning on and off a fairly stout transistor (ie: 2n2222 would probally do ok for that small motor) and connect the transistor to the arduino +5 regulator
be sure your power feed can handle the current
the stock 7805 can handle up to an amp (really pushing it) with good heatsinking which the official board wont do, it will get too hot and burn out eventually at roughly a quarter of an amp full load 100% of the time
on my barebones arduino (from modern devices) i replaced the wimpy regulator with a 7805 regulator and even with (honestly piss poor, but better than the official) heatsinking it gets questionably warm at less than half (bout 400ma) its rated max load, in all fairness it was a scavenged from a device that was pushing an amp tru it for nearly 5 years via "professional" engineering (same setup as an offical board, heatsink = pcb) and may be damaged after all that time
Here's me naively thinking the arduino ran on 5V DC....
it will get too hot and burn out eventually at roughly a quarter of an amp
Depending on what voltage you're feeding into it, The heat is generated by watts (power) which is a product of the voltage drop and amps. It will get a lot less hot with half an amp with 7volts (1 watt) that it will get with quarter of an amp at 12 v (1.75 watts) or 100mA at 20 volts (1.5 watts).
The arduino does not run on AC! It runs on DC and regulates it to 5v for the atmega. Just plugging in a small vibration motor and write a pin high and bob's your uncle, it'll work!
If the motor takes too much current then you may need a transistor circuit to drive it.
I would never run a motor directly of a pin, shame on whoever said that! (Mowcius, tsk tsk!) At least a transistor, make sure you use a resistor from the output of the arduino pin to the base of the transistor. (I generally use 1k, but you'd probably be okay with a 470R)
Well I did state that the current may be too high. I have run a 'very' small vibration motor directly off a pin but I checked the draw to make sure it was not too much.
I suppose seeing the size of the motor in the picture (PS2 controller motor?), I should not have recommended direct power.
Bit of miss information going on here.
The diode across a motor is to short out the back EMF. That is the reverse voltage that is generated by the motor when it is turned off and is still spinning due to inertia. In this case it acts like a generator.
As to the question:-
Can I ask how you've obtained your knowledge?
Well you pick it up you know.
Started at school, worked in Industrial Electronics for 2 years, got a degree in it, did a PhD in it, lectured at a University for 21 years spending 15 years writing monthly construction articles for a UK magazine. Then worked in consumer for the last 10 years.
The diode across a motor is to short out the back EMF. That is the reverse voltage that is generated by the motor when it is turned off and is still spinning due to inertia. In this case it acts like a generator.
Oh yes, hadn't remembered that.
Started at school, worked in Industrial Electronics for 2 years, got a degree in it, did a PhD in it, lectured at a University for 21 years spending 15 years writing monthly construction articles for a UK magazine. Then worked in consumer for the last 10 years.
as for driving motors direct from a pin - i can say that the Duemilanove can stand some abuse ( i had driven a 12v 1 amp motor off it in ignorance! ) but then not sure for how long. Better to go the transistor way. You can even add some feedback from the transistor back to maintain a constant current.
It would probably only pulled a fraction of 1 amp when fed with 5 volts instead of 12 but still not to be recommended.
Yeah I hadn't really taken in that you had said 12v. It would, as you say, only have used a few hundred mA but still not a good idea (also as you said!)
Wow what a conversation! I'm back now after some non-related work.
Thank you for the AC/DC correction. Arduino is now running DC in my mind (but I haven't tried connecting it directly to my brain just yet).
The EMF blockage using a diode was one item I caught on to through Google searches. Thanks for the feedback on that.
Correct, the small motor was the smaller of the two in a PS2 controller! I bought the controller for $2.00 at a pawn shop, and felt I got my money's worth tearing it apart.
I'm reading up on transistors now. Thanks for that info.
Will do more reading, but the question now is, can I get the needed parts to fit into the controller? I plan to disable one of the two buttons so that I have a ground wire (plugging those 3rd pot connections in and motor), and a wire to power the motor on and off. Everything will likely be powered by 5v.
Transistors usually control a more powerful source correct? I guess I could have a transistor control from 5v, and plug the motor into the 5v shared with other button, and also plug to the the ground of course. Add a diode in there.
I'm horrid at writing. Let me know if you'd like to see an illustration. Thanks again for your feedback.
Ok, how about this (based on what I understood from Grumpy Mike's link):
I'm not quite sure what kind of transistor to look for. The concept makes sense anyway. Also, things may be connected backwards. Let me know what you think. I'll make another comp if it's all messed up.