Hello everybody,
I've used Arduino clones to control DC motors, which are what most vibrator are (except for the mighty Hitachi Magic Wand, which uses rectified AC into DC, for those of you geek out at the tech details.) I suspect that the current drive of the Arduino Uno are similar to earlier Arduinos, but that's worth checking from the (AVR) processor's specs.
To control a vibrator from an Arduino pin (digital output or PWM output), you'll need the following things, at least if you do it my way:
(1) A source of DC power, preferably one separate from the Arduino's power (so the motor currents don't cause the Arduino to glitch.) With care, and some big capacitors, one can use the Arduino's +5v rail, but watch for glitching the processor, and pay attention to the total current you can draw from the +5 rail.
A separate supply is nice, if you have the $ and space in your design.
(2) A transistor that has enough current gain (Hfe or Beta) so that the Arduino pin's rated output current times beta is comfortably above the max current the vibrator motor will draw, when running. Even better, to drive the transistor into saturation, so that it dissipates less power. The transistor also needs to be rated for (a comfortable margin above) the DC supply for the motor. NPN or N-channel MOSFETs are generally easier to work with, and often cheaper. If you don't drive the transistor fully into saturation, you may need to heat sink it.
(3) a resistor between the Arduino pin and the base (or gate if using a MOSFET), to limit the current to within the Arduino's rated current output. Caution, if using a MOSFET, the initial current inrush can be quite large, since the MOSFET's gate looks (to the pin), like a big capacitor, which can suck (or source) big currents, if only for a very short while. Even such short times can kill an Arduino pin, so be conservative, and look at the data sheets.
(4) A diode to prevent the inductive kick-back from the motor's inductance from destroying the transistor. Again, this is a short-duration phenomenon, but it has killed many a hobbiest's transistors.
A rough attempt at an ASCII schematic follows:
Code: Select all
PositiveRailOfSupply >------------------------- | |_ / \ | M | Motor \___/ | |------------- | | | -- | Collector |C | _|_ | | Diode Base / \ | |ArduinoOutputPin >---[ Resistor ]----------| T | NPN |A | \___/ -- Emitter | | | |Ground >--------------------------------------|-------------
In the above circuit, the transistor is used to sink (pull down) current from the motor. The resistor limits the current into the transistor's base to within the processors rated sourcing current. The diode protects the transistor from the inductive kick-back voltage, when the motor is turned off. You leave this diode out at your transistor's peril. (And diodes are cheaper than transistors!)
Note that low-voltage (turn on) power MOSFETs are not that widely available or inexpensive, so I've used NPN transistors, to run modest motors. The key is to saturate the transistor's base drive, so little power is dissipated in the transistor. If you're running the Arduino pin in PWM mode, then you have to pay attention to the power dissipated during both the switch-on and switch-off transients, since these will be a much greater fraction of the time. If you want more current, consider using a Darlington Transistor, or the analogous NPN-Nchannel MOSFET combination.
I hope this is helpful. Feel free to comment here or send me a PM. However note that I haven't been checking this forum that all often.