Motor Control I

(Basic motor control)

What you're controlling:
Vibrators used in sex toys are, with very few exceptions, simply small DC motors with an offset weight mounted on the shaft. As the motor turns, the eccentric weight causes the motor to move (or try to move) around in a circle. The faster the motor moves, the greater the motion and the greater the vibration. These motors are typically driven from a dc power source; often batteries. The usual drive voltages are between 1.5 volts and 6 volts. In general, the higher the voltage seen by the motor, the faster it will spin (all other things being equal).

This means:
 * volts = vibe
 * more volts = more vibe
 * less volts = less vibe

What you're controlling it with:
For the purposes of this discussion, I'm assuming that you want to control your vibe motor using some kind of computer. Maybe you're running Windows, maybe you're running Linux maybe it's a Mac. It might even be a microcontroller (embedded computer). Whatever it is, though, I'm assuming that you already know how to program it, and that you can turn digital control signals on and off. As soon as I get the chance, I'll put up a tutorial on basic parallel port interfacing for motor control, but right now that's not anywhere near ready for prime-time.

Control signals from off the shelf general purpose computers usually use TTL signal levels - that is signals between 0 and 5 volts DC. Sounds good so far, right? 5 volts is about what you want to drive your vibe motor at a really good clip, and that gives you on and off control right out of the box.

BZZT - wrong. Thanks for playing. The problem is that these little motors can easily draw over 150 milliamps, and a PC port would be pretty hard pressed to provide more than 50 milliamps of power. When you draw too much power from a port, you cause the port electronics to overheat, possibly damaging the port, and losing your vibe. This, to be clear, is Not Good.

Solution: Basic on/off control circuit
The solution: you need a power source other than the port and a computer controlled switch to turn things on and off. Power sources are easy - For beginners I recommend the ever popular, cheap and robust wall wart power supply. These are available at Radio Shack, Walmart, and wherever electronics are sold, and come in a variety of voltage and power levels. For our purposes, I suggest 4.5 or 6 volts @ 500 milliamps. There is a nice power supply in that range available from RS (such as PN: 273-1766), and I'm morally certain that Walmart carries one as well.

As far as the switch is concerned, what you need is a power transistor. Power transistors are basically just transistors designed to control large currents, such as those used to drive motors, lights, and heaters. When they're "on", they have a very low resistance to minimize the amount of heat they generate. They are also made of materials which transmit the heat away from the transistor itself into its packaging efficiently. These things are good because they keep the transistor from overheating when it's driving your vibe.

The following schematic shows a basic motor on/off control circuit. After the image is an explanation of each part of the circuit and how it works to make the design stable and reliable.



What the parts do (going from Left to right):

D1 and D2 -- These are Schottky diodes used to protect the gate of the power MOSFET from static electricity. Under normal circuit conditions, these will never conduct, so they are optional (though strongly recommended.)

C1 is a power supply bypass capacitor. While optional, it helps to clean up spikes and sags on the power supply line. It also helps to prevent the power glitches from the sharp on/off cycles of the power MOSFET from reaching any other electronic devices hooked to the same power supply. (Optional. Recommended if there is anything else on the same power supply) Q1 is a power MOSFET. I'm using an IRL-520npbf made by International Rectifier (IRF) because they are high current 5v drive devices, but any N-Channel power mosfet will work in this circuit. (Required)

D3 is a snub diode - used to protect the MOSFET from back-emf from the motor. I use a schottky diode, but silicon diodes also work - provided they have sufficient power dissipation.

How the Circuit Works:

When IN1 goes positive with respect to Data GND, it turns on Q1 - allowing current to flow from the positive (+6-6vdc) rail, through the vibe motor, through Q1 to ground. When IN1 drops to ground potential, it turns off Q1. The reverse EMF from the motor (which is usually -5v or greater with respect to ground) is shunted through D3 protecting the power transistor as the magnetic field in the motor collapses.

After you have digested this, you can go on to Motor Control II