Assembling all the parts together
In this blog, I will put together all the components of the landslide monitoring system - The vibration sensor, the buzzer and the Arduino inside the enclosure box. I chose the non-transparent 1554UGY water-tight enclosure box to prevent the electronics from any rainwater or any possible collapse of the box into a nearby river or valley due to a landslide.
The complete system looks like this -
Here's the code for triggering the alarm and reading the signal from the vibration sensor.
int a; //variable to store the vibration sensor signal
void setup() {
// put your setup code here, to run once:
pinMode(5,INPUT); //pin for vibration sensor
pinMode(6,OUTPUT); // pin for buzzer
digitalWrite(6,LOW); //initialise buzzer to off state
}
void loop() {
// put your main code here, to run repeatedly:
a = digitalRead(5);
if(a==0)
{
a = 0; //latch the state of the vibration sensor
while(1){ //keep the buzzer on infinitely
digitalWrite(6,HIGH); //sound the buzzer
}
}
}
The Arduino continuously monitors the status of the vibration sensor and as soon as the sensor is triggered, the arduino sounds the buzzer alarm and the LEDs to indicate a landslide. If the audio alarm is loud enough, this can be heard at a long distance and hence accidents can be prevented. The entire electronics is powered using a power bank. In the future, I plan to make a solar version of this so that the power bank can be charged from the solar panel and it won't require an external power source.
In the next blog, I will test the system in the field.