How do I run multiple vibration motors from an Arduino Mini with PWM? I'm building a project for my Physical Computing class that involves 4 vibration motors for varied haptic feedback based on serial input via analogRead. I have each coming out of their own pin and assigned to conditionals.

I'm wondering:


how do i control the PWM of each individual motor?
assuming I need an external power source for the motors, do I need to have a diode and transistor in between each motor and the ground?


Thanks in advance - I'm still learning but definitely looking forward to taking Part II next semester!
You can control motor PWM by using AnalogWrite() feature. Arduino Mini is equipped with 6 PWM pin, so you can use 1 PWM pin for each of you motor. Check here about more information on AnalogWrite, and here about Arduino Mini    
This is the circuit if you want to use external power source. Normally, I use 1k ohm resistor, I'm sure there are someone out there that knows the exact formula.








simulate this circuit &ndash; Schematic created using CircuitLab