Things used in this project

Hardware components:
Ardgen 101
Arduino 101 & Genuino 101
×1
SeeedStudio grove starter kit Arduino 101
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

Vibration sensor setup
connect the vibration sensor to A0
Dscn4049 wr3cqpyksk

Code

Code for piezo vibration sensorArduino
Touch the piezo sensor to make it vibrate, of course, any way to make it vibrate would be OK too. The LED would be on when vibration detected. You can also Open the serial monitor to see the sensor outputs.
const int ledPin=12;
void setup() {
  Serial.begin(9600);
pinMode(ledPin,OUTPUT);
} 
 
void loop() {
int sensorValue = analogRead(A0);//read the vibration
 Serial.println(sensorValue);//print it
 delay(1000);
 if(sensorValue==1023)//if you have an led it will turn on or off based on the vibration
  {
    digitalWrite(ledPin,HIGH);
  }
 else
 {
  digitalWrite(ledPin,LOW);
  }
}
Code 2 for piezo vibration sensorArduino
You can directly use a digital pin, take D5 of base shield as an example, and connect LED to Pin 12.
const int ledPin=12;
void setup() {
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
} 
 
void loop() {
int sensorState = digitalRead(5);
 Serial.println(sensorState);
 delay(1000);
 if(sensorState == HIGH)
  {
    digitalWrite(ledPin,HIGH);
  }
 else
 {
  digitalWrite(ledPin,LOW);
  }
}

Credits

Download  2
Grant

DIY technology hobbyist

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Bluetooth Controlled Car
Easy
  • 171
  • 7

Full instructions

It's a basic 4 wheel drive car which can be controlled by android phones.

Galileo 2 driving MCP23017 and 74HC4511 Digit Displays
Easy
  • 27
  • 2

Protip

Using the MCP23017 IO Expander as an output device driving four Seven Segment Display blocks.

Ambient 2 click board on Arduino101
Easy
  • 53
  • 2

Protip

Short article about testing Mikroelektronika Ambient 2 click board on the Arduino 101 microcontroler

Easiest Way to Add A Full Color LCD Display
Easy
  • 4,651
  • 6

Protip

An Arduino library that, abstracts away all the complexity of a CRC based serial communication protocol into a single variable assignment.

Happy birthday melody on Arduino Nano with 3-way polyphony
Easy
  • 1,514
  • 22

Full instructions

Playing polyphony Happy birthday theme on Arduino Nano with three buzzers on a single mini breadboard.

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project