From CCRMA Wiki
Motors can also be controlled on the AVR. There are some extra parts involved.
Acoustic System Actuators
Often we would like to induce vibrations spanning the entire range of human hearing. Here we explain how to induce these vibrations in air and in structures.
Vibrations in Air
Loudspeaker drivers convert an electrical signal into pressure waves in air. These are quite common, so we refer the reader to Hyperphysics and Wikipedia. Since loudspeaker drivers are usually linear actuators, their maximum displacement is usually limited.
For instance, loudspeaker drivers can be used to actuate percussive instruments. The figure below shows a small plastic container glued to a loudspeaker cone. Shakers can be placed inside the plastic container, or the loudspeaker can be inverted and placed on top of a drumhead, allowing the plastic container to strike the drum membrane when a current is applied to the loudspeaker.
Vibrations in Structures
Lorentz Force Actuator
The Lorentz force is the force on an electrical current carrier in the presence of a magnetic field. Any element can be actuated according to the Lorentz force if an electrical current can be passed along it.
We present the example of actuating a vibrating string. An electrically conductive vibrating string is placed between two permanent magnets. Notice that the ﬁeld ﬂowing from the north pole of the upper magnet to the south pole of the lower magnet is much less focused.
For simplicity of analysis, we assume that the magnetic ﬁeld B is completely uniform in between the magnets. Since the field flowing back is so much less focused, we also assume that it never ﬂows back to complete the magnetic circuit:
Then the force on the string is F= LAI × B
A piece of wire of only about 1m in length has a relatively low resistance. In order to connect it to the output of a typical audio power ampliﬁer, it must be placed in series with power resistors to avoid overloading the audio ampliﬁer’s output. The next two figures show a realization in the laboratory.
The other electrodynamic actuators described here such as woofers, shakers, servomotors, solenoids, etc. operate according to this principle.
Reluctance Force Actuator
Replacing one of the permanent magnets with an electromagnet. The direction of the current through the coil determines whether the two magnets attract or repell one another:
What if you want to actuate something that isn't a magnet? Most efficient solution: glue a small neodymium magnet to the object that is to be actuated. Alternate solution: if the object is ferrous (magnetically "sticky" aka magnetizable such as iron or steel), then the object to be actuated can be magnetized by placing it in the neighborhood of a magnet. The E-Bow and the Sustainiac use this principle to actuate guitar strings.
Haptic System Actuators
Controlling With AVR
Foremost of course is a DC motor. It also needs a motor controller, which supplies the needed voltage and current to the motor, including the direction of current. The direction of current through the motor determines the rotational direction of the motor: clockwise or counter clockwise.
Pulse Width Modulation (PWM) is a technique that we use to control the speed of the motor. A DC motor's speed is determined by now much current is flowing through it. Intuitively, if we supply a low DC current, the motor will spin slowly. It will spin more quickly with a higher current. As it turns out, it is difficult to create a circuit that supplies a varying current like this. So, we use PWM. Pulse Width Modulation used two discrete values of current (none and full) in pulses that average to the desired current value you need to make the motor act as you want. The longer the pulse, more average current flows through the motor, and the faster it goes. We speak of the length of the pulse in terms of something called the Duty Cycle.
PWM can be used to control the apparent output intensity of LED's, too!
explain opposites attract for magnets and electromagnets
See the MAXLAB wiki page for ideas on where to get parts for actuation.