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

Contact

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

Arduino - Have Fun with Color Sensor
Easy
  • 517
  • 11

Full instructions

This project shows how to change color of Minion using Arduino, PHPoC WiFi Shield and color sensor.

Arduino - Web-Based Thermometer
Easy
  • 647
  • 11

Full instructions

This project allows you to check temperature at home from anywhere using web browser.

Electronic Voting Machine Using Arduino
Easy
  • 157
  • 5

It is an EVM using Arduino. There are five switches in all, assigned for various activities.

Using Python and Arduino MKR1000 for Secure IoT
Easy
  • 1,744
  • 9

Full instructions

Getting started with Python and Arduino MKR1000 for secure IoT projects.

React and Johnny-Five Traffic Lights
Easy
  • 17
  • 1

Protip

A small JavaScript project for controlling and animating a set of LEDs that act like Traffic Lights via a Microcontroller.

Retro Nokia Snake Game with Arduino
Easy
  • 3,236
  • 23

Full instructions

Ever wish you could go back to the happy 90's and play snake on your old Nokia phone? Grab on to your joystick for this blast-from-the-past.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login