Arduino Projects

Arduino micro vibration motor | Arduino vibration motor code, interfacing

Micro Vibration Motor Description:

 

In this tutorial, you will learn how to use a micro vibration motor with Arduino. For the best understanding, a variable resistor will be used to control the vibration motor. by rotating the knob of the variable resistor the vibration can be increased and decreased. Without any further delay, let’s get started!!!!!


Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Coin Vibration Motor:

Potentiometer:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Micro Vibration Motor:

micro vibration motor

This is the micro vibration motor, as you can see it has two wires red and black. Red is the positive wire while black is the ground wire. The working voltage of the vibration motor is 2 to 5 volts.. The rated voltage is 3.7 volts and the current is .07 amps which is equal to 70milli amps. As you can see the vibration motor has small thin wires due to which it’s really hard to interface this with the Arduino, so I decided to fix the vibration motor on a small PCB board.


micro vibration motor

as you can see the two wires are soldered and now it can be easily interfaced with the Arduino. the red wire is the positive and the blue wire is the ground.

Interfacing of the Vibration Motor and Variable Resistor with Arduino:

Connect the middle leg of the variable resistor with analog pin A1 of the Arduino…

micro vibration motor

now connect the grey wire with the ground…

micro vibration motor

connect the red wire with the 5v…

micro vibration motor

connect the red wire of the vibration motor with pin number 5 which is the PWM pin of the Arduino…


micro vibration motor

connect the blue wire with the Arduino’s ground….

micro vibration motor

Now we will use this variable resistor to control the vibration of the micro vibration motor.

Micro Vibration Motor Arduino Programming:

The micro-vibration motor programming is really simple

int mvm = 5; // micro vibration motor is connected with pin number 5 which is the pwm pin. 
int vresistor = A1; 

the variable resistor is connected with the analog pin A1 of the Arduino.

int data = 0;

As you know my friends every Arduino and Mega program has at least two functions, which are the void setup and void loop functions. Void means that these functions are not returning any values while the empty parenthesis means that these functions are not taking any arguments as the input.

void setup() {

  // put your setup code here, to run once:

pinMode is a builtin function and it takes two arguments as the input, the pin number or pin name and the status which can be input or output. as micro vibration motor is the output device so that’s why we set it to output. while the variable resistor is set to input

  pinMode(mvm, OUTPUT);
  pinMode(vresistor, INPUT);  


}

void loop() {
  // put your main code here, to run repeatedly:
data = analogRead(vresistor); 

reads the variable resistor and store the value in variable data. Then using the map function we limit the maximum value to 255, and store the mapped value in data. Then using the analogwrite function we send the value stored in variable data to the pwm which is pin number 5 and its name is mvm.


data = map(data, 0, 1023, 0,255);   
analogWrite(mvm, data); 
 
}

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button