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

Using CA and CC RGB LED by Current Sourcing and Sinking!
Easy
  • 439
  • 47

Protip

RGB LEDs are of two types, common cathode and common anode which behave differently with same Arduino code; how to resolve this.

Quadrature Encoder Demo
Easy
  • 52
  • 3

Full instructions

Use a 3D printed encoder wheel, LED, and 2 photocells to demonstrate how a quadrature encoder works.

Simple Dark Sensor
Easy
  • 69
  • 2

A simple dark sensor with or without Arduino.

Simple RGB LED Light with Fade
Easy
  • 17
  • 1

A Simple RGB LED light on Arduino UNO with Fade.

Arduino Amiga Floppy Disk Reader
Easy
  • 3,239
  • 5

Work in progress

An Arduino powered floppy disk controller and reader for making disk images from old AmigaDOS floppy disks.

Door Lock System with Arduino
Easy
  • 32
  • 1

This is a door lock security system made with Arduino.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login