Introduction
Have you ever wonder how to implement a vibration of the mobile phone? Why sometimes felt stronger, sometimes felt weak? The newest vibration module of gravity series, take you in-depth understanding of the vibration module principles, to satisfy your curiosity. Module uses a high quality of small vibration motor, only coin size, the edge did fillet processing, smaller. Gravity 3 - Pin interface, plug and play, more convenient. Let the children at the time of discovery, more focus on knowledge itself, get rid of complicated wiring.
Specification
- Working voltage: 5 v
- Control mode: High and low level/PWM signal
- Size: 30*22 mm
Board Overview
| |
Num | Label | Description |
1 | Signal | Control signal input |
2 | VCC | Power supply |
3 | GND | GND |
Tutorial
- Introduce the operating priciples of the vibration module.
- Introduce control mode of the micro vibration module by simple examples and pictures.(high level work, low level stop).
- Control the module vibration intensity by the PWM signal.
Requirements
- Hardware
- DFRduino UNO x1
- The Micro Vibration Module x1
- Dupont
- Digital Push Button DFR0029-Y X1
- Software
- Arduino IDE Click to download Arduino IDE
Operating Priciples
The vibration module uses the vibration motor as exciting vibration source, a set of adjustable eccentric block is installed in the end of rotor shaft, then we can ger the centrifugal force generated by high speed rotation of the shaft and eccentric block.
Contorl the Module by the Switch
/***************************************************
* Vibration
* ****************************************************
* This example shows that the module will shake /vibrate 5S when we press the button
* @author Dongzi(1185787528@qq.com)
* @version V1.0
* @date 2016-5-26
* All above must be included in any redistribution
* ****************************************************/
const int buttonPin = 8; // the number of the pushbutton pin
const int VibPin = 13; // the number of the Vibration Module pin
int key=0;
void setup()
{
pinMode(VibPin,OUTPUT); // Set the digital pin(11) as output
pinMode(buttonPin, INPUT); // Set the digital pin(8) as input
}
void loop()
{
key=digitalRead(buttonPin);
if(key==LOW)
{
digitalWrite(VibPin,HIGH); //Turn on the Vibration Module
delay(5000); //Waits for 5 seconds
digitalWrite(VibPin,LOW); //Turn off the Vibration Module
}
else
digitalWrite(VibPin,LOW); //Turn off the Vibration Module
// put your main code here, to run repeatedly:
}
Results: when the button of 8 pin is pressed, the vibration module can work for 5 seconds, then stop and wait for pushing the button again
Control the Module Amplitude
//Arduino Sample Code for Vibration Module
//www.DFRobot.com
//Version 1.0
#define Vibration 3 //define driver pins
void setup()
{
pinMode(Vibration,OUTPUT);
Serial.begin(9600); //Baudrate: 9600
}
void loop()
{
analogWrite(Vibration, 160); //PWM
delay(1000);
analogWrite(Vibration, 200); //PWM
delay(1000);
analogWrite(Vibration, 255); //PWM
delay(1000);
}
Results: as the PWM value increased, amplitude increased
FAQ
More questions or interesting projects, you can Visit the forum To check or post! |