Introduction: Arduino Alarm With Digital Vibration Sensor

About: Student at Faculty of Electrical Engineering and Computer Science. …

This instructable is about how to make an easy and cheap alarm device by youself.All you need is basic knowledge in electronics and arduino programming.


If you have any questions or problems you can contact me on my mail:iwx.production@gmail.com

So let's begin

Components provided by DFRobot

Step 1: Materials

All needed materials for this project can be bought on online store: DFRobot

For this project we will need:

-Arduino Uno (you can also take MEGA 2560)

-Digital capacitive touch sensor V2 4x

-Digital vibration sensor V2 1x

-Digital buzzer module 1x

-LCD display 20x4

-Some LEDs

-4 Channel Relay Shield for Arduino

-Jumper wires (a lot of them)

-Breadboard

-9V battery

-Battery housing

If you want to control lights or something like that, you can use Relay Shield for Arduino.

I also made housing for this alarm, so for that you will need SolidWorks or some other similar program. Of course you will also need 3D printer. If you dont have 3D printer you can also use surface mounted plastic sealed electric junction box case or something similar to that.

Step 2: Modules

For this project I used three different modules. It is very easy to connect those modules to Arduino because of its very good connection design. You get connection wire in the package with module(It can be seen on the picture).

Digital vibration sensor module

This sensor module is very easy to use and its fun to play with. His sensitivity is very high, so you don't need to shake it very hard. A little flick will be enough.

Specification:

  • IO Type: Digital
  • Switch life: up to 10 million seconds
  • Open circuit resistance: 10Mohm
  • Supply Voltage: 3.3V to 5V
  • Interface: Digital
  • Size:22x30mm (0.87 x 1.18 in)

Digital capacitive touch sensor module

If you dont like the ordinary push buttons you can use this capacitive touch sensor modules. They have very fast response time, large touch area on the both sides.

Specification:

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital
  • Size:22x30mm (0.87 x 1.18 in)


Digital buzzer module

Very simple and in most cases very annoying buzzer module.

Specification:

  • Type: Digital
  • Power supply: 5VDC

If you want to know more about this modules you can visit: DFRobot Product Wiki

Step 3: Alarm Housing

I made 3D printed housing for this alarm.

First I measured every component, than I made the prototype of the front plane on millimeter paper, so that I checked if very distance is correct. You can see this prototype on the picture.

When I finished the prototype I stared to draw it in program for 3D drawing. If you dont know how to draw in this programs you can also write on my mail for STL file of this housing, so that you can print it.

It took about four hours to print this housing. This printer is in middle range so you have to do a little corrections on you product(you need to file housing or maybe widen some holes with a drill...)

Size:

150x60x120mm

Housing is made from PLA plastic. It has 3mm wide walls, which is more than enough for souch a housing. The biggest opening is for LCD display, smaller holes next to LCD display are for LEDs. On the bottom there are openings for touch modules and buzzer module. On the right side there is also one more opening for touch module. You can mount this housing on the wall or door.

Step 4: Wiring

There are a lot of different components in this project so you must be careful to connect them right.

I will show you how is every component wired in this project.

Touch sensor modules:

I used four of this modules. One for decrement and one for increment alarm time, third is used for choosing programs (I will tell more about this in next step) and fourth is used for activation.

This module has three pins.(5V+, GND, OUTPUT).

You connect the red wire to 5V+ and black wire to GND. The green wire goes to digital pin on Arduino. (You can also use different colors, but it is easier for you and more manageable if you use this colors.)

For this project:

  • Module for decrement is connected to digital pin 8.
  • Module for increment is connected to digital pin 9.
  • Module for choosing program is connected to digital pin 10.
  • Module for alarm activation is connected to digital pin 11.

Digital vibration sensor:

This module has three pins.(5V+, GND, OUTPUT).

  • Module is connected to digital pin 3

Buzzer module:

This module has three pins.(5V+, GND, OUTPUT).

  • Module is connected to digital pin 13.

LCD display:

Display has four pins.(Vcc, GND, SCL, SDA):

  • Connect Vcc to 5V+, GND to GND on Arduino, SCL and SDA pin on display to SLC and SDA pin on Arduino.

LED:

I used some LEDs for indication. The shorter leg or cathode of LED goes to GND, longer leg or anode goes to digital pin. If you dont belive me you can also check that with multimeter.(Diode conducts from anode to cathode if in good condition)

  • Green LED is connected to digital pin 4. (On when alarm is activated)
  • Yellow LED is connected to digital pin 5 (On when alarm is deactivated)
  • Red LED is connected to digital pin 12 (Blink if you choose the right program and if you shake the vibration sensor)
  • White LEDs are connected to digital pin 2. (On when alarm is deactivated so that you can see touch modules).

Modules and LEDs are supplied from Arduino. So you just connect all Vcc pins to 5V on Arduino and all GND pins to GND on Arduino. Arduino doesnt have enought 5V and GND pins so you have to use breadboard.

You can supply Arduino with 9V battery or with appropriate adapter. Powering it with 9V battery will give you much more mobility, but you will need to replace it after some time.

If you want to control AC appliances you will need to connect relay module.

Step 5: Code

Code is a bit longer and if you are not familiar with programming, you can get lost very easily.

I used subprograms because this makes program more manageable.

So the idea of program is that:

  • You can choose alarm duration (1-15 seconds with 5 intervals)
  • You can choose program(With program I mean different possibilities how the alarm goes off. You can choose that only buzzer is on, that buzzer combined with LED is on or that just LED is on.)
  • You can activate and deactivate alarm (this is indicated with LEDs. With green and yellow)
  • And everything is displayed on LCD display. You have numerous possibilities for what you want to show on you LCD display.
  • So when you shake the vibration sensor alarm goes off, but it depends on what program you choose.

So on and on, if you know how to use if statements and if you know controls for LCD display(lcd.clear, lcd.setCursor(x,y)...) this program shoudnt be difficult to understand.