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.

  • 4,235 views
  • 4 comments
  • 11 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

3-Bit Binary Calculator Using Arduino Uno

Project showcase by 22warehamD

  • 5,820 views
  • 9 comments
  • 13 respects

Beautifully Finished Humidity and Temperature Sensor

Project tutorial by Wicked Makers

  • 20,938 views
  • 22 comments
  • 150 respects

How to Make an IR Sensor

Project tutorial by Manikant savadatti

  • 13,705 views
  • 0 comments
  • 17 respects

Multicolor Knight Rider with RGB PL9823 LED + Arduino UNO

Project tutorial by Giovanni Gentile

  • 6,839 views
  • 0 comments
  • 16 respects

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

Project tutorial by MichDragstar

  • 2,318 views
  • 2 comments
  • 5 respects
Add projectSign up / Login