Artificial Hand Uisng Embedded Systemslandslide Detection Using Raspberry Pi
Artificial Hand Uisng Embedded Systemslandslide Detection Using Raspberry Pi
CHAPTER - 1
INTRODUCTION
In order to reduce and prevent the damage of landslides, landslide monitoring
is very important to the prediction and estimation of the landslide hazard and
prevention. Landslide monitoring is an important topic related at the hill slides.
Landslides are geological phenomena causing significant loss of life and loss of
properties in damages each year in many countries. Therefore technology has to be
developed to capture relevant signals with minimum monitoring delay. Wireless
sensors are one of the technologies that can quickly respond to rapid changes of data
and send the sensed data to the receiver section in areas where cabling is not available.
Wireless sensor network (WSN) technology has the capability of quick capturing,
processing, and transmission of required data in real-time with high resolution.
However, it has its own limitations such as relatively low amounts of battery power
and low memory availability compared to many existing technologies. It does, though,
have the advantage of deploying sensors in hostile environments with a minimum of
maintenance. This fulfils a very important need for any real time monitoring, especially
in hazardous or remote scenarios.
An embedded system is one that has computer hardware with software embedded
in it as one of its components. Or
▪ We can define an embedded system as “A microprocessor-based system that
does not look like a computer”.
Or
▪ we can say that it is “A combination of computer hardware and software, and
perhaps additional mechanical or other parts, designed to perform a dedicated
function. In some cases, embedded systems are part of a larger system or
product, as is the case of an antilock braking system in a car “.
▪ An embedded system is a special-purpose computer system designed to
perform certain dedicated functions. It is usually embedded as part of a complete
device including hardware and mechanical parts.
Page no. 1
LANDSLIDE DETECTION USING RASPBERRY PI
Significance
Due to their compact dimension, low rate and easy design features made
embedded programs very general and encroached into human lives and have grow to
be integral. They are discovered the place from kitchen ware to house craft. To stress
this inspiration here are some illustrations
1.2 What Is Inside an Embedded System?
Every embedded system consists of custom-built hardware built around a
Central Processing Unit (CPU). This hardware additionally comprises reminiscence
chips onto which the software is loaded. The software residing on the reminiscence
chip is also called the ‘firmware’. The operating process runs above the hardware, and
the application software runs above the operating system. The equal structure is
relevant to any pc including a computer. However, there are massive differences. It
isn't obligatory to have an operating process in every embedded for small home
equipment such as remote manipulate units, air-conditioners, toys and many others.,
there is not any need for a working process, and we are able to write best the program
specific to that utility. For applications involving tricky processing, that you must have
an operating process. In any such case, you need to combine the appliance software
with the working method after which transfer the whole software on to the memory
chip. As soon as the application is transferred to the memory chip, the program will
proceed to run for a long time, and you don’t have to reload new application.
In any such case, you need to combine the appliance software with the working
method after which transfer the whole software on to the memory chip. As soon as the
application is transferred to the memory chip, the program will proceed to run for a long
time, and you don’t have to reload new application.
Page no. 2
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 3
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 4
LANDSLIDE DETECTION USING RASPBERRY PI
CHAPTER – 2
LANDSLIDE DETECTION
Block Diagram:
LCD DISPLAY
POWER SUPPLY
(16*2 LINES)
WEBSERVER
ACCELEROMETER
GSM MODULE
SENSOR
RASPBERRY-PI
TEMPERATURE
BUZZER
WATER LEVEL
SENSOR
Page no. 5
LANDSLIDE DETECTION USING RASPBERRY PI
Description:
The Raspberry Pi has made quite a splash since it was first announced. The
credit score-card sized pc is competent of most of the things that your computer does,
like spreadsheets, word-processing and video games. It moreover performs excessive-
definition video. It would run a couple of flavors of Linux and is getting used to train
youngsters in each single place the field easy methods to software… Oh yeah, and it
does all that for below $50.The key sauce that makes this pc so small and strong is the
Broadcom BCM2835, a procedure-on-Chip that comprises an ARM1176JZFS with
floating point, going for walks at 700MHz, and a Video core 4 GPU. The GPU offers
Open GL ES 2. Zero, hardware-accelerated Open VG, and 1080p30 H.264 immoderate-
profile decode and is ready of 1Gpixel/s, 1.5Gtexel/s or 24 GFLOPs of usual intent
compute. What’s that everyone means? It means that when you plug the Raspberry Pi
into your HDTV, you might watch Blue Ray satisfactory video, utilizing H.264 at
40MBits/s.But wait, there’s more. The model B additionally has a 10/a hundred
Ethernet port so which you could surf the online (or serve web pages) from proper there
on the Pi. The process volume lives on an SD card, so it’s easy to arrange, run and
debug a number of distinct running programs on the equal hardware. Most Linux
distributions for the Pi will fortunately survive a 2GB SD card nonetheless higher
playing cards are supported. The mannequin B’s two developed-in USB ports provide
ample connectivity for a mouse and keyboard, nonetheless if you wish to add extra you
can use a USB hub. It's recommended that you simply use a powered hub in order not
to overtax the on-board voltage regulator.
Powering the Raspberry Pi is easy, readily plug any USB vigor give into the
micro-USB port. There’s no vigor button so the Pi will to boot as quickly as vigor is
utilized, to show it off without difficulty get rid of energy. On top of all that, the low-
degree peripherals on the Pi make it exceptional for hardware hacking. The 0.1" spaced
GPIO header on the Pi offers you access to eight GPIO, UART, I2C, SPI as well
as3.Three and 5V sources. Mating ribbon cables will also be discovered in the
associated merchandise under. Dimensions: eighty-five.60mm x 56mm x 21mm.
Page no. 6
LANDSLIDE DETECTION USING RASPBERRY PI
CHAPTER - 3
REQUIREMENTS
3.1HARDWARE REQUIREMENTS:
Introduction:
The rarer 400 and 450 MHz frequency bands are assigned in some countries,
where these frequencies were previously used for first-generation systems.
GSM-900 uses 890–915 MHz to send information from the mobile station to
the base station (uplink) and 935–960 MHz for the other direction (downlink),
providing 124 RF channels (channel numbers 1 to 124) spaced at 200 kHz. Duplex
spacing of 45 MHz is used. In some countries the GSM-900 band has been extended to
cover a larger frequency range. This 'extended GSM', E-GSM, uses 880–915 MHz
(uplink) and 925–960 MHz (downlink), adding 50 channels (channel numbers 975 to
1023 and 0) to the original GSM-900 band. Time division multiplexing is used to allow
eight full-rate or sixteen half-rate speech channels per radio frequency channel. There
are eight radio timeslots (giving eight burst periods) grouped into what is called a
TDMA frame. Half rate channels use alternate frames in the same timeslot. The channel
data rate is 270.833 Kbit/s, and the frame duration is 4.615 ms.
GSM Advantages:
GSM also pioneered a low-cost, to the network carrier, alternative to voice calls,
the Short t message service (SMS, also called "text messaging"), which is now
supported on other mobile standards as well. Another advantage is that the standard
includes one worldwide Emergency telephone number, 112. This makes it easier for
Page no. 7
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 8
LANDSLIDE DETECTION USING RASPBERRY PI
The switching system (SS) is responsible for performing call processing and
subscriber-related functions. The switching system includes the following functional
units.
Home location register (HLR): The HLR is a database used for storage and
management of subscriptions. The HLR is considered the most important database, as
it stores permanent data about subscribers, including a subscriber's service profile,
location information, and activity status. When an individual buy a subscription from
one of the PCS operators, he or she is registered in the HLR of that operator.
Mobile services switching center (MSC): The MSC performs the telephony switching
functions of the system. It controls calls to and from other telephone and data systems.
It also performs such functions as toll ticketing, network interfacing, common channel
signaling, and others.
Visitor location register (VLR): The VLR is a database that contains temporary
information about subscribers that is needed by the MSC in order to service visiting
subscribers. The VLR is always integrated with the MSC. When a mobile station roams
into a new MSC area, the VLR connected to that MSC will request data about the
mobile station from the HLR. Later, if the mobile station makes a call, the VLR will
have the information needed for call setup without having to interrogate the HLR each
time.
Authentication center (AUC): A unit called the AUC provides authentication and
encryption parameters that verify the user's identity and ensure the confidentiality of
each call. The AUC protects network operators from different types of fraud found in
today's cellular world.
Equipment identity register (EIR): The EIR is a database that contains information
about the identity of mobile equipment that prevents calls from stolen, unauthorized, or
defective mobile stations. The AUC and EIR are implemented as stand-alone nodes or
as a combined AUC/EIR node.
Page no. 9
LANDSLIDE DETECTION USING RASPBERRY PI
All radio-related functions are performed in the BSS, which consists of base station
controllers (BSCs) and the base transceiver stations (BTSs).
• BSC: The BSC provides all the control functions and physical links between
the MSC and BTS. It is a high-capacity switch that provides functions such as
handover, cell configuration data, and control of radio frequency (RF) power
levels in base transceiver stations. A number of BSCs are served by an MSC.
• BTS: The BTS handles the radio interface to the mobile station. The BTS is the
radio equipment (transceivers and antennas) needed to service each cell in the
network. A group of BTSs are controlled by a BSC.
• Message center (MXE): The MXE is a node that provides integrated voice,
fax, and data messaging. Specifically, the MXE handles short message service,
cell broadcast, voice mail, fax mail, e-mail, and notification.
• Mobile service node (MSN): The MSN is the node that handles the mobile
intelligent network (IN) services.
Page no. 10
LANDSLIDE DETECTION USING RASPBERRY PI
• GSM inter-working unit (GIWU): The GIWU consists of both hardware and
software that provides an interface to various networks for data
communications. Through the GIWU, users can alternate between speech and
data during the same call. The GIWU hardware equipment is physically located
at the MSC/VLR which consists of the hardware requirements of the system.
3.1.4 GSM Network Areas:
Location Areas:
The cell is the area given radio coverage by one base transceiver station. The
GSM network identifies each cell via the cell global identity (CGI) number assigned to
each cell. The location area is a group of cells. It is the area in which the subscriber is
paged. Each LA is served by one or more base station controllers, yet only by a single
MSC Each LA is assigned a location area identity (LAI) number.
Page no. 11
LANDSLIDE DETECTION USING RASPBERRY PI
An MSC/VLR service area represents the part of the GSM network that is
covered by one MSC and which is reachable, as it is registered in the VLR of the MSC.
GSM Specifications:
• Frequency band: The frequency range specified for GSM is 1,850 to 1,990
MHz (mobile station to base station).
• Transmission rate: GSM is a digital system with an over-the-air bit rate of 270
kbps.
• Access method: GSM utilizes the time division multiple access (TDMA)
concept. TDMA is a technique in which several different calls may share the
same carrier. Each call is assigned a particular time slot.
• Speech coder: GSM uses linear predictive coding (LPC). The purpose of LPC
is to reduce the bit rate. The LPC provides parameters for a filter that mimics
the vocal tract. The signal passes through this filter, leaving behind a residual
signal. Speech is encoded at 13 kbps.
Page no. 12
LANDSLIDE DETECTION USING RASPBERRY PI
DTMF is a tone signaling scheme often used for various control purposes via
the telephone network, such as remote control of an answering machine. GSM supports
full-originating DTMF.
Short message services: A convenient facility of the GSM network is the short
message service. A message consisting of a maximum of 160 alphanumeric characters
can be sent to or from a mobile station. This service can be viewed as an advanced form
of alphanumeric paging with a number of advantages. If the subscriber's mobile unit is
powered off or has left the coverage area, the message is stored and offered back to the
subscriber when the mobile is powered on or has reentered the coverage area of the
network. This function ensures that the message will be received.
Cell broadcast: A variation of the short message service is the cell broadcast facility.
A message of a maximum of 93 characters can be broadcast to all mobile subscribers
in a certain geographic area. Typical applications include traffic congestion warnings
and reports on accidents.
Voice mail: This service is actually an answering machine within the network, which
is controlled by the subscriber. Calls can be forwarded to the subscriber's voice-mail
box and the subscriber checks for messages via a personal security code.
Fax mail: With this service, the subscriber can receive fax messages at any fax
machine. The messages are stored in a service center from which they can be retrieved
by the subscriber via a personal security code to the desired fax number
Page no. 13
LANDSLIDE DETECTION USING RASPBERRY PI
Supplementary Services:
Call forwarding: This service gives the subscriber the ability to forward incoming
calls to another number if the called mobile unit is not reachable, if it is busy, if there
is no reply, or if call forwarding is allowed unconditionally.
Barring of outgoing calls: This service makes it possible for a mobile subscriber to
prevent all outgoing calls.
Barring of incoming calls: This function allows the subscriber to prevent incoming
calls. The following two conditions for incoming call barring exist: baring of all
incoming calls and barring of incoming calls when roaming outside the home PLMN.
Advice of charge (AOC): The AOC service provides the mobile subscriber with an
estimate of the call charges. There are two types of AOC information: one that provides
the subscriber with an estimate of the bill and one that can be used for immediate
charging purposes. AOC for data calls is provided on the basis of time measurements.
Call hold: This service enables the subscriber to interrupt an ongoing call and then
subsequently reestablish the call. The call hold service is only applicable to normal
telephony.
Call waiting: This service enables the mobile subscriber to be notified of an incoming
call during a conversation. The subscriber can answer, reject, or ignore the incoming
call. Call waiting is applicable to all GSM telecommunications services using a circuit-
switched connection.
Page no. 14
LANDSLIDE DETECTION USING RASPBERRY PI
The restriction service enables the calling party to restrict the presentation. The
restriction overrides the presentation.
Closed user groups (CUGs): CUGs are generally comparable to a PBX. They are a
group of subscribers who are capable of only calling themselves and certain numbers
Main AT commands:
"AT command set for GSM Mobile Equipment” describes the Main AT
commands to communicate via a serial interface with the GSM subsystem of the phone.
AT commands are instructions used to control a modem. AT is the abbreviation of
Attention. Every command line starts with "AT" or "at". That's why modem commands
are called AT commands. Many of the commands that are used to control wired dial-
up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO
(Return to online data state), are also supported by GSM/GPRS modems and mobile
phones. Besides this common AT command set, GSM/GPRS modems and mobile
phones support an AT command set that is specific to the GSM technology, which
includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS
(Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR
(Read SMS messages).
Note that the starting "AT" is the prefix that informs the modem about the start
of a command line. It is not part of the AT command name. For example, D is the actual
AT command name in ATD and +CMGS is the actual AT command name in
AT+CMGS. However, some books and web sites use them interchangeably as the name
of an AT command.
Here are some of the tasks that can be done using AT commands with a GSM/GPRS
modem or mobile phone:
• Get basic information about the mobile phone or GSM/GPRS modem. For
example, name of manufacturer (AT+CGMI), model number (AT+CGMM),
IMEI number (International Mobile Equipment Identity) (AT+CGSN) and
software version (AT+CGMR).
Page no. 15
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 16
LANDSLIDE DETECTION USING RASPBERRY PI
3.2.1 Introduction:
Features:
Page no. 17
LANDSLIDE DETECTION USING RASPBERRY PI
Pin diagram:
Applications:
The LM35 can be applied easily in the same way as other integrated-circuit
temperature sensors. It can be glued or cemented to a surface and its temperature will
be within about 0.01°C of the surface temperature. This presumes that the ambient air
temperature is almost the same as the surface temperature; if the air temperature were
much higher or lower than the surface temperature, the actual temperature of the LM35
die would be at an intermediate temperature between the surface temperature and the
air temperature. This is especially true for the TO-92 plastic package, where the copper
leads are the principal thermal path to carry heat into the device, so its temperature
might be closer to the air temperature than to the surface temperature. To minimize this
problem, be sure that the wiring to the LM35, as it leaves the device, is held at the same
temperature as the surface of interest. The easiest way to do this is to cover up these
wires with a bead of epoxy which will insure that the leads and wires are all at the same
temperature as the surface, and that the LM35 die’s temperature will not be affected by
the air temperature. The TO-46 metal package can also be soldered to a metal surface
or pipe without damage. Of course, in that case the V- terminal of the circuit will be
grounded to that metal. Alternatively, the LM35 can be mounted inside a sealed-end
metal tube and can then be dipped into a bath or screwed.
Page no. 18
LANDSLIDE DETECTION USING RASPBERRY PI
3.3.1 PROGRAM:
# facerec.py
import sys,os
import time
import RPi.GPIO as GPIO
# Import SPI library (for hardware SPI) and MCP3008 library.
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import Adafruit_ADXL345
import serial
from time import sleep
import re
from decimal import *
import subprocess
global MNo
Msg = ""
#user mobile number
Mobile_No1 = "8919074081"
Mobile_No2 = "9703586587"
Mobile_No3 = "7288027470"
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
Water_level_1 = 18
Water_level_2 = 23
Water_level_3 = 24
buz = 25
GPIO.setup(Water_level_1,GPIO.OUT)
GPIO.setup(Water_level_2,GPIO.OUT)
GPIO.setup(Water_level_3,GPIO.OUT)
GPIO.output(Water_level_1,GPIO.HIGH)
Page no. 19
LANDSLIDE DETECTION USING RASPBERRY PI
GPIO.output(Water_level_2,GPIO.HIGH)
GPIO.output(Water_level_3,GPIO.HIGH)
GPIO.setup(buz,GPIO.OUT)
GPIO.output(buz,GPIO.HIGH)
#ADC GPIO pins
CLK = 11
MISO = 9
MOSI = 10
CS = 8#25
mcp = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS, miso=MISO, mosi=MOSI)
accel = Adafruit_ADXL345.ADXL345()
def buzzer_on():
GPIO.output(buz,GPIO.LOW)
time.sleep(5)
GPIO.output(buz,GPIO.HIGH)
class Adafruit_CharLCD(object):
# commands
LCD_CLEARDISPLAY = 0x01
LCD_RETURNHOME = 0x02
LCD_ENTRYMODESET = 0x04
LCD_DISPLAYCONTROL = 0x08
LCD_CURSORSHIFT = 0x10
LCD_FUNCTIONSET = 0x20
LCD_SETCGRAMADDR = 0x40
LCD_SETDDRAMADDR = 0x80
# flags for display entry mode
LCD_ENTRYRIGHT = 0x00
LCD_ENTRYLEFT = 0x02
LCD_ENTRYSHIFTINCREMENT = 0x01
LCD_ENTRYSHIFTDECREMENT = 0x00
# flags for display on/off control
LCD_DISPLAYON = 0x04
Page no. 20
LANDSLIDE DETECTION USING RASPBERRY PI
LCD_DISPLAYOFF = 0x00
LCD_CURSORON = 0x02
LCD_CURSOROFF = 0x00
LCD_BLINKON = 0x01
LCD_BLINKOFF = 0x00
# flags for display/cursor shift
LCD_DISPLAYMOVE = 0x08
LCD_CURSORMOVE = 0x00
# flags for display/cursor shift
LCD_DISPLAYMOVE = 0x08
LCD_CURSORMOVE = 0x00
LCD_MOVERIGHT = 0x04
LCD_MOVELEFT = 0x00
# flags for function set
LCD_8BITMODE = 0x10
LCD_4BITMODE = 0x00
LCD_2LINE = 0x08
LCD_1LINE = 0x00
LCD_5x10DOTS = 0x04
LCD_5x8DOTS = 0x00
def __init__(self, pin_rs=13, pin_e=19, pins_db=[26, 21, 20, 16], GPIO=None):
# Emulate the old behavior of using RPi.GPIO if we haven't been given
# an explicit GPIO interface to use
if not GPIO:
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
self.GPIO = GPIO
self.pin_rs = pin_rs
self.pin_e = pin_e
self.pins_db = pins_db
self.GPIO.setmode(GPIO.BCM)
self.GPIO.setup(self.pin_e, GPIO.OUT)
self.GPIO.setup(self.pin_rs, GPIO.OUT)
for pin in self.pins_db:
Page no. 21
LANDSLIDE DETECTION USING RASPBERRY PI
self.GPIO.setup(pin, GPIO.OUT)
self.write4bits(0x33) # initialization
self.write4bits(0x32) # initialization
self.write4bits(0x28) # 2 line 5x7 matrix
self.write4bits(0x0C) # turn cursor off 0x0E to enable cursor
self.write4bits(0x06) # shift cursor right
self.displaycontrol = self.LCD_DISPLAYON | self.LCD_CURSOROFF |
self.LCD_BLINKOFF
self.displayfunction = self.LCD_4BITMODE | self.LCD_1LINE |
self.LCD_5x8DOTS
self.displayfunction |= self.LCD_2LINE
# Initialize to default text direction (for romance languages)
self.displaymode = self.LCD_ENTRYLEFT |
self.LCD_ENTRYSHIFTDECREMENT
self.write4bits(self.LCD_ENTRYMODESET | self.displaymode) # set the entry
mode
self.clear()
def begin(self, cols, lines):
if (lines > 1):
self.numlines = lines
self.displayfunction |= self.LCD_2LINE
def home(self):
self.write4bits(self.LCD_RETURNHOME) # set cursor position to zero
self.delayMicroseconds(3000) # this command takes a long time!
def clear(self):
self.write4bits(self.LCD_CLEARDISPLAY) # command to clear display
self.delayMicroseconds(3000) # 3000 microsecond sleep, clearing the display
takes a long time
def setCursor(self, col, row):
self.row_offsets = [0x00, 0x40, 0x14, 0x54]
if row > self.numlines:
row = self.numlines - 1 # we count rows starting w/0
self.write4bits(self.LCD_SETDDRAMADDR | (col + self.row_offsets[row]))
def noDisplay(self):
Page no. 22
LANDSLIDE DETECTION USING RASPBERRY PI
self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
def rightToLeft(self):
""" This is for text that flows Right to Left """
self.displaymode &= ~self.LCD_ENTRYLEFT
self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
def autoscroll(self):
""" This will 'right justify' text from the cursor """
self.displaymode |= self.LCD_ENTRYSHIFTINCREMENT
self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
def noAutoscroll(self):
""" This will 'left justify' text from the cursor """
self.displaymode &= ~self.LCD_ENTRYSHIFTINCREMENT
self.write4bits(self.LCD_ENTRYMODESET | self.displaymode)
def write4bits(self, bits, char_mode=False):
""" Send command to LCD """
self.delayMicroseconds(1000) # 1000 microsecond sleep
bits = bin(bits)[2:].zfill(8)
self.GPIO.output(self.pin_rs, char_mode)
for pin in self.pins_db:
self.GPIO.output(pin, False)
for i in range(4):
if bits[i] == "1":
self.GPIO.output(self.pins_db[::-1][i], True)
self.pulseEnable()
for pin in self.pins_db:
self.GPIO.output(pin, False)
for i in range(4, 8):
if bits[i] == "1":
self.GPIO.output(self.pins_db[::-1][i-4], True)
self.pulseEnable()
def delayMicroseconds(self, microseconds):
seconds = microseconds / float(1000000) # divide microseconds by 1 million for
seconds
sleep(seconds)
Page no. 24
LANDSLIDE DETECTION USING RASPBERRY PI
def pulseEnable(self):
self.GPIO.output(self.pin_e, False)
self.delayMicroseconds(1) # 1 microsecond pause - enable pulse must be >
450ns
self.GPIO.output(self.pin_e, True)
self.delayMicroseconds(1) # 1 microsecond pause - enable pulse must be >
450ns
self.GPIO.output(self.pin_e, False)
self.delayMicroseconds(1) # commands need > 37us to settle
def message(self, text):
""" Send string to LCD. Newline wraps to second line"""
for char in text:
if char == '\n':
self.write4bits(0xC0) # next line
else:
self.write4bits(ord(char), True)
def program_exit():
# You may do some clean-up here, but you don't have to.
print ("\n")
print ("Exiting application...")
GPIO.cleanup()
subprocess.call('setterm -cursor on', shell=True)
subprocess.call('spincl -ib', shell=True)
print( " ")
def ctrlCHandler(*whatever):
# Just sets the value of CONTROL_C
global CONTROL_C
CONTROL_C = True
THREEPLACES = Decimal(10) ** -3
subprocess.call('setterm -cursor off', shell=True)
subprocess.call('spincl -ib', shell=True)
Page no. 25
LANDSLIDE DETECTION USING RASPBERRY PI
# change these as desired - they're the pins connected from the SPI port on the ADC
to the RPi
SPICLK = 11
SPIMISO = 9
SPIMOSI = 10
SPICS = 8
# set up the SPI interface pins
GPIO.setup(SPIMOSI, GPIO.OUT)
GPIO.setup(SPIMISO, GPIO.IN )
GPIO.setup(SPICLK, GPIO.OUT)
GPIO.setup(SPICS, GPIO.OUT)
# 10k trim pot connected to adc #0
def lcd_display():
lcd.clear()
lcd.message("T: S: ")
lcd.write4bits(0xC0) # next line
lcd.message("M: IR: ")
#-------------------------------------------------------
class gsm():
echo_on = 1
def __init__(self,serialPort):
self.serialPort = serialPort
def sendCommand(self,at_com):
self.serialPort.write(at_com + '\r')
def getResponse(self):
self.serialPort.flushInput()
self.serialPort.flushOutput()
if gsm.echo_on == 1:
response = self.serialPort.readline() # comment this line if echo off
response = self.serialPort.readline()
response = response.rstrip()
# lcd.clear()
# lcd.message(response)
Page no. 26
LANDSLIDE DETECTION USING RASPBERRY PI
return response
def getPrompt(self):
if gsm.echo_on == 1:
response = self.serialPort.readline() # comment this line if echo off
if (self.serialPort.readline(1) == '>'):
return True
else:
return False
def sendMessage(self,phone_number, message):
flag = False
self.sendCommand('AT+CMGS=\"' + phone_number + '\"')
time.sleep(2)
print 'SUCCESS'
self.serialPort.write(message)
self.serialPort.write('\x1A') # send messsage if prompt received
flag = True
time.sleep(5)
print self.getResponse
return flag
lcd = Adafruit_CharLCD()
lcd.clear()
lcd.message(" LANDSLIDE")
lcd.write4bits(0xC0)
lcd.message("DETECTION SYSTEM..")
time.sleep(3)
gsm_ser = serial.Serial()
gsm_ser.port = "/dev/ttyAMA0"
gsm_ser.baudrate = 9600
gsm_ser.timeout = 3
gsm_ser.xonxoff = False
gsm_ser.rtscts = False
Page no. 27
LANDSLIDE DETECTION USING RASPBERRY PI
gsm_ser.bytesize = serial.EIGHTBITS
gsm_ser.parity = serial.PARITY_NONE
gsm_ser.stopbits = serial.STOPBITS_ONE
#---------------------------------------------------------------------
gsm_ser.open()
gsm_ser.flushInput()
gsm_ser.flushOutput()
lcd.message("Water Level:")
lm35_cel = adc = mcp.read_adc(0)
lm35_cel = (3*lm35_cel*100.0)/4095
lm35_cel = round(lm35_cel,2)
time.sleep(0.2)
time.sleep(0.2)
time.sleep(0.2)
Water_level_1_status = GPIO.input(Water_level_1)
Water_level_2_status = GPIO.input(Water_level_2)
Water_level_3_status = GPIO.input(Water_level_3)
if Water_level_1_status== 0 and Water_level_2_status== 0 and
Water_level_3_status== 0:
level_status = '3'
if Water_level_1_status== 0 and Water_level_2_status== 0 and
Water_level_3_status== 1:
level_status = '2'
if Water_level_1_status== 0 and Water_level_2_status== 1 and
Water_level_3_status== 1:
level_status = '1'
if Water_level_1_status== 1 and Water_level_2_status== 1 and
Water_level_3_status== 1:
level_status = '0'
print "water level: ",level_status
x,y,z = accel.read()
print('x={0},y={1},z={2}'.format(x,y,z))
Page no. 29
LANDSLIDE DETECTION USING RASPBERRY PI
if x>200:
lcd.clear()
lcd.message("landslide")
lcd.write4bits(0xc0) # next line
lcd.message("Falling down")
buzzer_on()
GSM.sendMessage(Mobile_No1, "LANDSLIDE Falling Down Please Alert!!")
GSM.sendMessage(Mobile_No2, "LANDSLIDE Falling Down Please Alert!!")
GSM.sendMessage(Mobile_No3, "LANDSLIDE Falling Down Please Alert!!")
buzzer_on()
lcd.message(str(level_status))
time.sleep(2)
3.3.2 LCD DISPLAY:
Page no. 31
LANDSLIDE DETECTION USING RASPBERRY PI
LCD_MOVERIGHT = 0x04
LCD_MOVELEFT = 0x00
# flags for function set
LCD_8BITMODE = 0x10
LCD_4BITMODE = 0x00
LCD_2LINE = 0x08
LCD_1LINE = 0x00
LCD_5x10DOTS = 0x04
LCD_5x8DOTS = 0x00
# GPIO connections for LCD
def __init__(self, pin_rs=13, pin_e=19, pins_db=[26, 21, 20, 16]):
self.pin_rs = pin_rs
self.pin_e = pin_e
self.pins_db = pins_db
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.pin_e, GPIO.OUT)
GPIO.setup(self.pin_rs, GPIO.OUT)
for pin in self.pins_db:
GPIO.setup(pin, GPIO.OUT)
self.write4bits(0x33) # initialization
self.write4bits(0x32) # initialization
self.write4bits(0x28) # 2 line 5x7 matrix
self.write4bits(0x0C) # turn cursor off 0x0E to enable cursor
self.write4bits(0x06) # shift cursor right
self.clear()
def clear(self):
self.write4bits(self.LCD_CLEARDISPLAY) # command to clear display
self.delayMicroseconds(3000) # 3000 microsecond sleep, clearing the display
takes a long time
def write4bits(self, bits, char_mode=False):
""" Send command to LCD """
Page no. 32
LANDSLIDE DETECTION USING RASPBERRY PI
self.write4bits(ord(char), True)
'''
if __name__ == '__main__':
lcd = Adafruit_CharLCD()
lcd.clear()
lcd.message("Elegant ")
lcd.write4bits(0xC0)
lcd.message("LCD test")
sleep(2)
Page no. 34
LANDSLIDE DETECTION USING RASPBERRY PI
3.3.3 GSM:
def sendCommand(self,at_com):
self.serialPort.write(at_com + '\r')
def getResponse(self):
self.serialPort.flushInput()
self.serialPort.flushOutput()
lcd_t = lcd.elegant_CharLCD()
if elegant_gsm.echo_on == 1:
response = self.serialPort.readline() # comment this line if echo off
response = self.serialPort.readline()
response = response.rstrip()
lcd_t.clear()
lcd_t.message(response)
return response
def getPrompt(self):
if elegant_gsm.echo_on == 1:
response = self.serialPort.readline() # comment this line if echo off
if (self.serialPort.readline(1) == '>'):
return True
else:
return False
Page no. 35
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 36
LANDSLIDE DETECTION USING RASPBERRY PI
CHAPTER – 4
IMPLEMENTATON
Description:
The Raspberry Pi has made particularly a splash given that it used to be first
introduced. The credit score-card sized laptop is able of some of the matters that your
laptop computer does, like spreadsheets, word-processing and video games. It
additionally performs excessive-definition video. It'll traditionally run a few flavors of
Linux and is getting used to coach kids some distance and large the field suggestions
on tips on how to software… Oh yeah, and it does all that for under $50.The key sauce
that makes this computer so small and robust is the Broadcom BCM2835, a system-on-
Chip that contains an ARM1176JZFS with floating point, jogging at 700MHz, and a
Video core 4 GPU. The GPU presents Open GL ES 2.0, hardware-accelerated Open
VG, and 1080p30 H.264 high-profile decode and is ready of 1Gpixel/s, 1.5Gtexel/s or
24 GFLOPs of general reason compute. What’s that every one mean? It means that for
those who plug the Raspberry Pi into your HDTV, you could watch Blue Ray excellent
video, utilizing H.264 at 40MBits/s.But wait, there’s
Page no. 37
LANDSLIDE DETECTION USING RASPBERRY PI
The approach volume lives on an SD card, so it’s easy to organize, run and
debug a couple of distinct working systems on the identical hardware. Most Linux
distributions for the Pi will happily live to tell the tale a 2GB SD card however bigger
cards are supported.
Processor
Voltage and
MHz
GPIO 40 26 40
USB 2.0 1 2 4
Audio Multi channel HD audio over HDMI, Analog stereo from 3.5mm audio jack
Page no. 38
LANDSLIDE DETECTION USING RASPBERRY PI
The model B’s two developed-in USB ports furnish enough connectivity for a
mouse and keyboard, but in case you desire to add more you should utilize a USB hub.
It is recommended that you simply conveniently use a powered hub so as to not overtax
the on-board voltage regulator. Powering the Raspberry Pi is easy, just plug any USB
vigor give into the micro-USB port. Dimensions: 85.60mm x 56mm x 21mm
Currently there are 5 items of Raspberry pi boards are on hand on the planet.
On this undertaking we're using raspberry pi 2 mannequin B. The below table illustrates
the assessment between exceptional items.
Raspberry pi 2 model B:
• 4 USB ports
• 40 GPIO pins
• Full HDMI port
• Ethernet port
• Combined 3.5mm audio jack and composite video
• Camera interface (CSI)
• Display interface (DSI)
• Micro SD card slot
• Video Core IV 3D graphics core
Because it has an ARMv7 processor, it can run the full range of ARM GNU/Linux
distributions, including Snappy Ubuntu Core, as well as Microsoft Windows 10.
Page no. 39
LANDSLIDE DETECTION USING RASPBERRY PI
Features:
Page no. 40
LANDSLIDE DETECTION USING RASPBERRY PI
Processor/system on chip(soc):
Page no. 41
LANDSLIDE DETECTION USING RASPBERRY PI
The Broadcom soc used in the raspberry is similar to a chip utilized in an ancient
shrewd mobile phone (Android or phone). At the same time operating at 900MHz, the
raspberry provides a real-world performance roughly identical to the 0.041GFLOPS.
On the CPU level the efficiency is similar to 300MHz Pentium II, but the GPU presents
1Gpixels/s, 1.5Gtexel/s or 24GFLOPS of basic motive compute and the photo
capabilities of the raspberry pi are roughly an identical to the extent of efficiency of the
Xbox of 2001. The raspberry pi chip working at 900MHz through default, will not
emerge as sizzling adequate to desire a heat sink or specific cooling.
Power source:
SD card:
The raspberry pi does now not have any onboard storage on hand. The running
system is loaded in a SD card and which is inserted into the SD card slot on the
raspberry pi. The operating method loaded on the card utilizing a card reader on any
pc.
Page no. 42
LANDSLIDE DETECTION USING RASPBERRY PI
Each and every of the 3 banks has its own VDD enter pin. On Raspberry Pi, all
GPIO banks are provided from 3.3V. Connection of a GPIO to a voltage higher than
3.3V will possible destroy the GPIO block inside the SOC.
Page no. 43
LANDSLIDE DETECTION USING RASPBERRY PI
• Input values can be often be used as IRQs (typically for wakeup events)
DSI Connector:
Audio Jack:
A standard 3.5mm TRS connector available in the raspberry pi for stereo audio
output. Any headphone or 3.5mm audio cable can be connected directly. Although this
jack cannot be used for taking audio input, USB mics or USB sound cards can be used.
USB 2.0 ports are the means to connect accessories such as mouse and keyboard
to the raspberry pi. There is a one port on model A, two on model B, four on B+ and pi
2 model B.
Ethernet:
CSI connector:
Page no. 44
LANDSLIDE DETECTION USING RASPBERRY PI
The Raspberry pi foundation provides a camera specially made for the pi which
can be connected with the pi using a CSI connector.
JTAG headers:
Joint test action group (JTAG) is an organization that started back in the mid 1980’s
to address test point access issues on PCB with surface mount device. The institution
devised a procedure of entry to gadget pins by way of a serial port that became often
called faucet (experiment access port). In 1990 the approach grew to be recognized
international typical (IEEE std 1149.1). Many 1000s of devices now include this
standardized port as a characteristic to enable scan and design engineers to access pins.
HDMI:
High definition multimedia interface (HDMI) port is provided on the board for
connecting raspberry pi to the HDMI screen.
SD CARD:
Any HDMI/DVI monitor or TV should work as a display for the Pi . For best
results, use one with a HDMI input, but other connections are available for older
devices. Use a standard Ethernet cable for internet access. The Pi 3 includes built-in
wireless LAN.
Page no. 45
LANDSLIDE DETECTION USING RASPBERRY PI
Any standard USB keyboard and mouse will work with your Raspberry Pi
Power supply:
Use a 5V micro USB power supply to power your Raspberry Pi. Be careful that
whatever power supply you use outputs at least 5V; insufficient power will cause your
Pi to behave in strange way.
4.2 Buzzer:
Mechanical:
Electromechanical:
Piezoelectric:
Piezoelectric disk beeper:
Uses:
• Annunciator panels
• Electronic metronomes
• Game shows
Page no. 46
LANDSLIDE DETECTION USING RASPBERRY PI
4.3MEMS SENSOR
Page no. 47
LANDSLIDE DETECTION USING RASPBERRY PI
4.4.1 Introduction:
This power supply unit change the AC signal into DC signal and also by
decrease the signal. The available voltage signal from the mains is 230V/50Hz which
is an AC voltage, but we are wanted DC voltage (no frequency) with the amplitude of
+5V or +12V for various applications.
The power supply unit consists of Transformer, Bridge rectifier are connected
consecutively and voltage regulator via a capacitor (1000µF) in similar are connected
similar as shown in the circuit diagram below.
Transformer:
Page no. 48
LANDSLIDE DETECTION USING RASPBERRY PI
Including a load to the secondary circuit, you possibly can make present float in the
transformer, as a result transferring energy from one circuit to the other.
Working Principle:
The transformer is based on two types of ideas: first one that an electric present
can boost an electromagnetism and ultimate one is a various magnetic field amongst a
coil of wire makes a voltage across the completing of a the coil. By way of various the
current in fist coil, it various the intensity of its magnetic discipline, in a while the
varying magnetic discipline extends into the 2nd coil, a voltage is made in the course
of the 2d.
Bridge Rectifier:
Page no. 49
LANDSLIDE DETECTION USING RASPBERRY PI
biased. When the AC enter is negative, the diodes C and D are forward-biased, whilst
diodes A and B are reverse-biased. Bridge rectifier supplies the identical polarity of
output voltage for any polarity of enter voltage. The under diagram represents the bridge
rectifier and its enter and output waveforms.
Filter:
Voltage Regulator:
Voltage regulator is a device which converts the varying input voltage into
constant regulated output voltage level. Most of the projects required power supplies of
5V or 12V. We are intended to get these voltage levels, LM7805 and LM7812 voltages
regulators are to be using. The series 78xx and 79xx are the most commonly used and
well-known voltage regulators. The digit 78 indicates the positive voltage regulator,
while 79 indicates the negative voltage regulator. The last two digits represent the
Page no. 50
LANDSLIDE DETECTION USING RASPBERRY PI
voltage rating. In this project we are using LM7805 for getting constant DC voltage.
The regulator consists of three pins.
Those are:
1. Input pin
2. ground pin
3. output pin, through this pin we are getting constant voltage.
Liquid crystal displays (LCD) are widely used in now a days as compared to
LEDs. This is due to low price of LCD and in most of embedded applications LCD
used as graphical user interface, LCD can display numbers, characters and by using
graphical LCD we can display special characters and inside there is a refreshing
controller.
In this way diminishing the CPU of the assignment of invigorating the LCD
furthermore the simplicity of programming for characters and representation.
Page no. 51
LANDSLIDE DETECTION USING RASPBERRY PI
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
Selects command register when low; and data register Register
4
when high Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
Page no. 52
LANDSLIDE DETECTION USING RASPBERRY PI
The voltage VCC and VSS provide +5V and ground respectively, while VEE
controlling LCD contrast. Variable voltage between Ground and Vcc specify the
contrast (or "darkness") of the characters on the LCD screen.
RS (register select):
There are two very important registers inside the LCD. The RS pin their register
selection. If RS=0, the command register is selected, this mode allows programmer /
user to initialize, blinking, shifting, home to cursor etc.. If RS=1, the data register is
selected or mode is selected, this mode allows the user or programmer to display data
on LCD.
R/W (read/write):
The R/W (read/write) input allows the user / programmer to read the
information from the LCD and writes the information to the LCD. The pin R/W=1 for
reading the data from LCD and R/W=0 for selecting write mode. Mostly will perform
LCD read operation , LCD write are do when we want to pass LCD information as input
to the another devices or micro controllers.
EN (enable):
The LCD contains 8-data pins, whenever data passed on to this lines we need to
latch the information on LCD pin. This is done by using enable pin of LCD. A high-to-
low pulse must be applied to this pin in order for the LCD to latch in the data presented
at the data pins.
The LCD have 8 data pins which are D0-D7, by using this pins we can send
information to the LCD and we can read the information stored in the internal registers
of LCD.
Page no. 53
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 54
LANDSLIDE DETECTION USING RASPBERRY PI
To get started with Raspberry Pi, you need an operating system. NOOBS (New Out Of
Box Software) is an easy operating system install manager for the Raspberry Pi.
SD cards with NOOBS preinstalled are available from many of our distributors and
independent retailers, such as Pomeron, Adafruit and The Pi Hut. For older models of
Raspberry Pi, you’ll need a full-size SD card; for the Pi Zero, A+, B+, Pi 2 and Pi 3
you’ll need a micro SD card. We recommend using an SD card with a minimum
capacity of 8GB.
• click on the download ZIP button beneath ‘NOOBS (offline and network set
up)’ and opt for a folder to put it aside to.
• Extract the files from the zip.
• format your SD card. It's great to format your SD card before copying the
NOOBS files onto it. To do this: talk over with the SD association’s website
and down load SD Formatter four. Zero for both windows or Mac.
• Insert your SD card into the laptop or computing device’s SD card reader and
make an observation of the pressure letter allocated to it, e.g. G:/
• In SD Formatter, choose the drive letter on your SD card and structure it.
• Drag and drop NOOBS records
• once your SD card has been formatted, drag the entire documents within the
extracted NOOBS folder and drop them onto the SD card force.
Page no. 55
LANDSLIDE DETECTION USING RASPBERRY PI
First boot:
• Your Raspberry Pi will boot, and a window will appear with a list of different
operating systems that you can install. We recommend that you use Raspbian
– tick the box next to Raspbian and click on Install.
• Raspbian will then run through its installation process. Note that this can take
a while.
When the install approach has completed, the Raspberry Pi configuration menu
(raspy-config) will load. Right here you might be competent to set the time and date on
your neighborhood, permit a Raspberry Pi digital camera board, or even create
customers. That you could exit this menu by utilizing Tab on your keyboard to
maneuver to conclude.
4.6.2 Python:
Python helps more than one programming paradigms, together with object-
oriented, relevant and sensible programming or procedural patterns. It features a
dynamic type process and automated reminiscence management and has a massive and
complete normal library.
stand-alone executable packages for one of the vital most standard running techniques,
so Python-founded software can also be allotted to, and used on, those environments
and not using a must set up a Python interpreter.
Advantages/Benefits of Python
The Python Package Index (PYPI) contains numerous third-party modules that
make Python capable of interacting with most of the other languages and platforms.
Python supplies a significant general library which includes areas like web
protocols, string operations, web offerings tools and running method interfaces. Many
high use programming tasks have already been scripted into the common library which
reduces size of code to be written tremendously.
Further, its development is driven by the community which collaborates for its
code through hosting conferences and mailing lists and provides for its numerous
modules.
Page no. 57
LANDSLIDE DETECTION USING RASPBERRY PI
Python has built-in list and dictionary data structures which can be used to
construct fast runtime data structures. Further, Python additionally supplies the choice
of dynamic excessive-level knowledge typing which reduces the length of aid code
that's needed.
Page no. 58
LANDSLIDE DETECTION USING RASPBERRY PI
CHAPTER - 5
RESULTS
Page no. 59
LANDSLIDE DETECTION USING RASPBERRY PI
➢ When the natural causes occurs like, tsunami , earthquake etc , we will get a
message to the mobiles those live in the surroundings.
Page no. 60
LANDSLIDE DETECTION USING RASPBERRY PI
➢ When the tsunami will occur water over flow will occur an we will get a
message to mobiles who are living in the surroundings.
Page no. 61
LANDSLIDE DETECTION USING RASPBERRY PI
Page no. 62
LANDSLIDE DETECTION USING RASPBERRY PI
CHAPTER - 6
CONCLUSION
This system is developed using Raspberry pi, Wireless sensor network for landslide
detection is one of the challenging research areas available today in the field of geophysical
research. Landslides have become very serious problem at hill and mountain area. Because of
landslide and thunderstorms disaster many people lost their lives and also property. This
system uses raspberry pi, interfaced with sensors, LCD and GSM module for real time
monitoring of data. Data from sensors is sent to raspberry pi and displaying alert message on
LCD. The results of the analysis in the form of landslide and lightning warnings will be provided
to the user with the help of GSM. Hence landslide and lightning detection system alert before
landslide and lightning by using sensor values.
FUTURE SCOPE
This system can be connect to internet for real time application and the
information related to land slide is available on the internet after the use of the this
system can be connect to a barrier if there is land slide occur the alarm will on and the
barrier get down and due to this we can save many life of human.
Page no. 63
LANDSLIDE DETECTION USING RASPBERRY PI
BIBLIOGRAPHY
Page no. 64