Project tutorial
Arduino UNO and Vibration Sensor with Relay

Arduino UNO and Vibration Sensor with Relay © GPL3+

When the vibration module detects vibration, the lamp will go on for 2 seconds and this for 3 times.

  • 1,132 views
  • 2 comments
  • 8 respects

Components and supplies

About this project

The idea: A big light must flash 3 times when at long distance shooting the target is hit. (Target is a metal round piece attached on a metal frame) How it works: When the target is hit, the sensitive vibration sensor, fixed on the back of the target frame, will detect vibration. To indicate the target was hit, the light will flash 3 times. (2sec ON, 1 sec OFF, 3 times)

The sensor module is powered by the Arduino. With the help of the Optocoupler PC817 we keep the circuit for the relay seperated from the Arduino UNO.

The relay is powered by the external source, in this case 3x AA battery.

In the video, you can see that the LED, connected to the relay is replaced by a light, vissible from easely 200meters.

Code

Vibration_sensor.inoArduino
//Vibration Sensor Module (Code)Arduino with relay and external 5V power source.
  
int vib_pin=2;
int led_pin=13;


// put your setup code here, to run once:
void setup() { 
  pinMode(vib_pin,INPUT);
  pinMode(led_pin,OUTPUT);
}


  // put your main code here, to run repeatedly:
void loop() {
  int val;
  val=digitalRead(vib_pin);
  if(val==1)
  {
    digitalWrite(led_pin,LOW);
    delay(2000);
    digitalWrite(led_pin,HIGH);
    delay(1000);
    digitalWrite(led_pin,LOW);
    delay(2000);
    digitalWrite(led_pin,HIGH);
    delay(1000);
    digitalWrite(led_pin,LOW);
    delay(2000);
    digitalWrite(led_pin,HIGH);
    delay(1000);
    
   }
   else
   digitalWrite(led_pin,HIGH);
}

Schematics

Arduino UNO with Vibration sensor module and relay
vibration_sensor_with_relay_and_external_5v_power_source_nikDyG3P0b.fzz

Comments

Similar projects you might like

Multicolor Knight Rider with RGB PL9823 LED + Arduino UNO

Project tutorial by Giovanni Gentile

  • 3,926 views
  • 0 comments
  • 10 respects

3-Bit Binary Calculator Using Arduino Uno

Project showcase by 22warehamD

  • 3,242 views
  • 8 comments
  • 12 respects

Vibration Sensor Module

Project tutorial by Alberto Zanon

  • 21,190 views
  • 2 comments
  • 9 respects

Beautifully Finished Humidity and Temperature Sensor

Project tutorial by Wicked Makers

  • 16,864 views
  • 21 comments
  • 135 respects

ARDUINO UNO or TRINKET PRO 5V 6 Chasing LEDS with POT and PB

Project tutorial by MichDragstar

  • 1,754 views
  • 2 comments
  • 3 respects
Add projectSign up / Login