সুচিপত্র:

Centro De Comando Emergencias - Erupção De Vulcão E Terremotos: 7 ধাপ
Centro De Comando Emergencias - Erupção De Vulcão E Terremotos: 7 ধাপ

ভিডিও: Centro De Comando Emergencias - Erupção De Vulcão E Terremotos: 7 ধাপ

ভিডিও: Centro De Comando Emergencias - Erupção De Vulcão E Terremotos: 7 ধাপ
ভিডিও: VULCÕES: PODER E DEVASTAÇÃO - DOCUMENTÁRIO COMPLETO EM HD 2024, নভেম্বর
Anonim
সেন্ট্রো ডি কোমান্ডো এমার্জেনসিয়াস - ইরুপিও দে ভলসিও ই টেরেমোটোস
সেন্ট্রো ডি কোমান্ডো এমার্জেনসিয়াস - ইরুপিও দে ভলসিও ই টেরেমোটোস

Projeto Acadêmico para atender cenário de colaboração através da internet para divulgação de desastres naturais, onde será possível a detecção dos acontecimentos através de sensores IOT de temperatura, luminosidade, oscilação (tilte deo poteo e e boto) Ainda no cenário de colaboração prevemos integração com o Twitter e aplicativos com suporte mqtt para acionamento do alertta।

Diante a possibilidade de diversos meios de entrada na solução, caberá um centro de de operações avaliar se a informação esta correta evitando assim falsos-positivos dos dispositivos automatizado e avaliar a possibilidade de fakenews। Tal tomada de decisão é important diante ao pânico que um alarme falso pode gerar।

Como solução de alertta de mensagem estamos considerando o uso do envio de SMS, Alerta através de cliente mqtt, email, sirene e twitter।

O projeto contou com uso de recursos da AWS incluindo IOT Core, EC2 e SNS

Sensores da DragonBord 410c

ক্লায়েন্ট অ্যান্ড্রয়েড mqtt

Sendo todo desenvolvido em python

Autores:

দিয়েগো ফার্নান্দেস ডস সান্তোস - [email protected]

গ্যাব্রিয়েল পিওভানি মোরেইরা ডস সান্তোস - [email protected]

গুস্তাভো ভেনানসিও লুজ - [email protected]

পাওলো হেনরিক আলমেইদা সান্তোস - [email protected]

ধাপ 1: Dragonbord 410c - Publicação Dos Sensores - Analogicos

Dragonbord 410c - Publicação Dos Sensores - Analogicos
Dragonbord 410c - Publicação Dos Sensores - Analogicos

Abaixo o codigo de publicação dos sensores analógicos, os sensores de temperatura e luminosidade estão configurados para que assim que detectarem uma variação fora do padrão pré estelecido enviarem um alerta através do protocolo mqtt sinalizo

Este alertta começa a contagem regressiva que pode ser susensa ou acelerada pelo operador।

O contador para o alertta começa contagem regressiva em 60 seguntos, e todo novo alarta detectado decresce o contador em 20 segundos।

programma rodando dentro da dragon borad 410c

#!

# আমদানি lib para comunicacao com MOSQUITTO আমদানি paho.mqtt.client হিসাবে mqtt

spi = spidev. SpiDev () spi.open (0, 0) spi.max_speed_hz = 10000 spi.mode = 0b00 spi.bits_per_word = 8

#একটি পোর্ট ADC1 channel_select1 = [0x01, 0x80, 0x00] ব্যবহার করুন

#পারা একটি পোর্টা ADC2 ব্যবহার করে o seguinte vetor de configuraçàchannel o channel_select2 = [0x01, 0xA0, 0x00]

def on_connect (mqttc, obj, flags, rc): print ("rc:" + str (rc))

def on_message (mqttc, obj, msg): print (msg.topic + "" + str (msg.qos) + "" + str (msg.payload))

def on_publish (mqttc, obj, mid): print ("Message Id:" + str (mid) + "\ n") pass

# Criamos o client e setamos suas configuracoes mqttc = mqtt. Client ()

mqttc.on_message = on_message mqttc.on_connect = on_connect mqttc.on_publish = on_publish

pub = mqtt. Client ("grupo3")

# Conexao com localhost, uma vez que testamos fora do labredes। broker_address = "34.230.74.201"

pub.connect (broker_address)

যদি _name _ == '_ main_': gpio_cs = gpio. GPIO (18, gpio. DIRECTION_OUTPUT)

gpio.request_gpios ([gpio_cs]): contador = 0 adc_value_old = 0 adc_value2_old = 0 যখন contador <50: gpio_cs.set_high () ঘুম (0.00001) gpio_cs.set_low () rx = spi.xfer (channel_select1) g) contador = contador + 1 adc_value = (rx [1] << 8) & 0b1100000000 adc_value = adc_value | (rx [2] & 0xff) adc_value = (((adc_value * 5) / 1024) - 0.5) * 100 print ("Temperatura: % f / n" % adc_value) pub.publish ("temperatura", str (adc_value)) # teste para acionar contador do alarm, teste ultima leitura + 5%

যদি adc_value_old == 0: adc_value_old = adc_value যদি adc_value> (adc_value_old*1.05): pub.publish ("ALARME", "ON") প্রিন্ট ("Alarmado temperatura") adc_value_old = adc_value ঘুম (1)

gpio_cs.set_high () ঘুম (0.00001) gpio_cs.set_low () rx = spi.xfer (channel_select2) gpio_cs.set_high () contador = contador + 1 adc_value2 = (rx [1] << 8) এবং 0b1100000000 adc_value2 = (rx [2] এবং 0xff) adc_value2 = adc_value2 /10 মুদ্রণ ("Luminosidade: % f / n" % adc_value2) pub.publish ("luminosidade", str (adc_value2))

# teste para acionar contador do alarm, teste ultima leitura + 50%

যদি adc_value2_old == 0: adc_value2_old = adc_value2 যদি adc_value2> (adc_value2_old*1.5): pub.publish ("ALARME", "ON") প্রিন্ট ("Alarmado Luminosidade") adc_value2_old = adc_value2

ধাপ 2: Sensores Digitais - Publicação

Sensores Digitais - Publicação
Sensores Digitais - Publicação

código para publicação dos sensores digitais

Os sensores digitais neste projeto foram o tilte que detecta os tremores e o botão para simular o uso de um botão de pânico।

quando detectado uma anomalia ou botão de pânico pressionado a contagem regressiva é iniciada।

programma rodando dentro da dragon borad 410c

libsoc_zero. GPIO থেকে আমদানি বাটন

def on_connect (mqttc, obj, flags, rc): print ("Conectado" + str (rc))

def on_message (mqttc, obj, msg): print (msg.topic + "" + str (msg.qos) + "" + str (msg.payload))

def on_publish (mqttc, obj, mid): # print ("Message Id:" + str (mid) + "\ n") pass

def detectaTilt (): count = 0 sleep_count = 0 যদিও True: try: tilt.wait_for_tilt (1) ছাড়া: sleep_count += 1 else: count += 1 sleep_count += 1 if sleep_count> 999: break

print ("count:", count) যদি count> 200: pub = mqttc.publish ("TERREMOTO", "ON") pub = mqttc.publish ("SISMOGRAFO", str (count)) # Criamos o client e setamos suas কনফিগারাকোস mqttc = mqtt. Client ()

mqttc.on_message = on_message mqttc.on_connect = on_connect mqttc.on_publish = on_publish

বিষয় = "grupo3"

# Conexao com localhost, uma vez que testamos fora do labredes। mqttc.connect ("34.230.74.201", 1883)

tilt = tilt ('GPIO-A')

btn = বোতাম ('GPIO-C')

যখন সত্য: ঘুম (0.25) detectaTilt () যদি btn.is_pressed (): pub = mqttc.publish ("PANICO", "ON") প্রিন্ট ("Botao ON") ঘুম (1) pub = mqttc.publish ("PANICO "," OFF ") # অন্য: # pub = mqttc.publish (" PANICO "," OFF ") # print (" Botao OFF ")

ধাপ 3: Codigo Para Acionamento Sirene

Codigo Para Acionamento Sirene
Codigo Para Acionamento Sirene

Codigo para subscrição para acionamento da SIRENE, programma rodando dentro da dragon board 410c

# আমদানি lib para comunicacao com MOSQUITTOmport paho.mqtt.client হিসাবে mqtt

libsoc_zero. GPIO থেকে LED আমদানি সময় থেকে আমদানি স্লিপ LED = LED ('GPIO-E') #led.off ()

# সংজ্ঞায়িত করুন o que fazer ao conectar def on_connect (client, obj, flags, rc): print ("ConexÃÆ' estab o estelecida com broker")

# সংজ্ঞায়িত করুন o que fazer ao receber uma mensagem def on_message (client, obj, message): print ("LED" + str (message.payload.decode ("utf-8"))) যদি str (message.payload.decode ("utf-8")) == "on": print ("Sirene ligada") led.on () else: print ("Sierene apagada") led.off ()

# IP দালাল broker_address = "34.230.74.201"

# Cria ও ক্লায়েন্ট সাব = mqtt. Client ("grupo3")

sub.connect (broker_address)

sub.on_message = on_message sub.on_connect = on_connect

# সাব সাবস্ক্রাইব করার জন্য কোন টপিক বাড়ান না ("সিরিন", qos = 0)

# লুপের জন্য escuta sub.loop_forever ()

ধাপ 4: কোডিগো টুইটার - পোস্ট

কোডিগো টুইটার - পোস্ট
কোডিগো টুইটার - পোস্ট
কোডিগো টুইটার - পোস্ট
কোডিগো টুইটার - পোস্ট

Cigodigo para publicação do twitter assim que acionado o alarm।

código rodando na maquina virtual da AWS EC2

#!/usr/bin/env পাইথন #---------------------------------------- ------------------------------- # টুইটার-পোস্ট-স্ট্যাটাস #-আপনার টাইমলাইনে একটি স্ট্যাটাস বার্তা পোস্ট করে # --- -------------------------------------------------- ------------------ আমদানি paho.mqtt.subscribe হিসাবে সাবস্ক্রাইব করুন

আমদানির সময়

টুইটার আমদানি থেকে *

#------------------------------------------------- ---------------------- # আমাদের নতুন অবস্থা কি হওয়া উচিত? #------------------------------------------------- ---------------------- new_status = "#Terremoto procure uma zona segura-teste"

#------------------------------------------------- ---------------------- # আমাদের এপিআই শংসাপত্র লোড করুন # ---------------------- ------------------------------------------------- আমদানি sys sys.path.append ("।") আমদানি কনফিগ

#------------------------------------------------- ---------------------- # টুইটার এপিআই অবজেক্ট তৈরি করুন # ---------------------- ------------------------------------------------- টুইটার = টুইটার (auth = OAuth ('সেনহা রিমুভিডা))

#------------------------------------------------- ---------------------- # একটি নতুন স্ট্যাটাস পোস্ট করুন # টুইটার এপিআই ডক্স: https://dev.twitter.com/rest/reference/post/statu… #------------------------------------------------- ----------------------

যখন 1: m = subscribe.simple ("twitteralarme", hostname = "172.31.83.191", বজায় রাখা = মিথ্যা) যদি m.topic == "twitteralarme" এবং str (m.payload.decode ("utf-8")) == "অন": ফলাফল = twitter.statuses.update (status = (new_status)+str (time.time ())) # print ("হালনাগাদ অবস্থা: % s" % new_status)

ধাপ 5: সেন্ট্রো ডি কোমান্ডো

সেন্ট্রো ডি কোমান্ডো
সেন্ট্রো ডি কোমান্ডো

semper que acionado um dispositivo manual ou detectado um alarta manual do usuário é acionada uma contagem regressiva para envio de mensagem। হে অপারেডর পোড ক্যানসার o envio ou acionar o envio imediato do alertta।

Para uso do dasboard utilizamos um android do telefone para compor a mesa de operação do centro de comando।

código rodando na maquina virtual da AWS EC2

paho.mqtt.client pahoimport paho.mqtt.subscribe সাবস্ক্রাইব হিসাবে আমদানি paho.mqtt.publish আমদানি json আমদানি সময় আমদানি ছয় আমদানি ssl সময় আমদানি ঘুম থেকে

বিষয় = ['#']

gatilho = 0 hora_disparo = 0 published.single ("ACIONADO", "OFF", qos = 1, hostname = "172.31.83.191") published.single ("sensor1", "OFF", qos = 1, hostname = "172.31.83.191 ") published.single (" sensor2 "," OFF ", qos = 1, hostname =" 172.31.83.191 ")

connflag = মিথ্যা

def on_connect (client, userdata, flags, rc): global connflag connflag = True print (connflag) print ("কানেকশন রিটার্ন রেজাল্ট:" + str (rc))

def on_message (client, userdata, msg): # print ("teste") print (msg.topic+""+str (msg.payload))

def on_log (ক্লায়েন্ট, ইউজারডাটা, লেভেল, বুফ): প্রিন্ট (msg.topic+""+str (msg.payload))

mqttc = paho. Client ("Broker_MSG") mqttc.on_connect = on_connect mqttc.on_message = on_message

awshost = "data.iot.us-east-1.amazonaws.com" awsport = 8883 clientId = "a2rczvc6ni8105" thingName = "Ufscar2018" caPath = "aws-iot-rootCA.crt" certPath = "9e85dfd42a-certificate। crt "keyPath =" 9e85dfd42a-private.pem.key "mqttc.tls_set (caPath, certfile = certPath, keyfile = keyPath, cert_reqs = ssl. CERT_REQUIRED, tls_version = ssl।, keepalive = 60) mqttc.loop_start ()

যখন 1: hora = time.time () sleep (.1) published.single ("LEDTERREMOTO", "on", qos = 1, hostname = "172.31.83.191")

# if connflag == True: # mqttc.publish ("message", json.dumps ({'message': "TERREMOTO"}), qos = 1) যদি gatilho == 1: published.single ("TEMPO", str (বৃত্তাকার (hora_disparo-hora, 0)), qos = 1, hostname = "172.31.83.191") pub.single ("LEDTERREMOTO", "on", qos = 1, hostname = "172.31.83.191") অন্য: প্রকাশ.single ("TEMPO", "99", qos = 1, hostname = "172.31.83.191") # print ("") if (hora> hora_disparo) এবং (gatilho == 1): # print ("TERREMOTO") # মুদ্রণ করুন ", qos = 1) mqttc.publish (" message ", json.dumps (" TERREMOTO - PROCURE UMA ZONA SEGURA "), qos = 1)

# print ("teste SNS") # published.single ("LED", "on", hostname = "172.31.83.191") published.single ("SIRENE", "on", qos = 1, hostname = "172.31। 83.191 ") published.single (" TEMPO "," TERREMOTO ", qos = 1, hostname =" 172.31.83.191 ") published.single (" ACIONADO "," OFF ", qos = 1, hostname =" 172.31.83.191 ") published.single ("twitteralarme", "on", qos = 1, hostname = "172.31.83.191") published.single ("twitter", "TERREMOTO - PROCURE UMA ZONA SEGURA", qos = 1, hostname = "172.31.83.191 ") gatilho = 0 ঘুম (5) m = subscribe.simple (বিষয়, হোস্টনাম =" 172.31.83.191 ", বজায় রাখা = মিথ্যা) যদি m.topic ==" ACIONADO "এবং str (m.payload.decode (" utf-8 ")) ==" বন্ধ ": gatilho = 0 মুদ্রণ (" বাতিল ") যদি m.topic ==" medico "এবং str (m.payload.decode (" utf-8 ")) ==" অন ": if connflag == সত্য: mqttc.publish (" medico ", json.dumps (" MEDICOS - EMERGENCIA TERREMOTO "), qos = 1) যদি m.topic ==" bombbeiro "এবং str (m.payload.decode ("utf -8")) == "অন": যদি connflag == সত্য: mqttc.publish ("bombeiro", json.dumps ("BOMBEIRO - EMERGENCIA TERREMOTO"), qos = 1) যদি m.topic == " ambulancia "এবং str (m.payloa d.decode ("utf -8")) == "on": if connflag == True: mqttc.publish ("ambulancia", json.dumps ("AMBULANCIA - EMERGENCIA TERREMOTO"), qos = 1) যদি m। বিষয় == "urgente" এবং str (m.payload.decode ("utf-8")) == "on": published.single ("ACIONADO", 1, qos = 1, hostname = "172.31.83.191") gatilho = 1 hora_disparo = time.time ()+5 if str (m.payload.decode ("utf-8")) == "ON": if gatilho == 1: print ("acelerado 20") hora_disparo = hora_disparo -20 অন্য: মুদ্রণ ("Acionado") published.single ("ACIONADO", 1, qos = 1, hostname = "172.31.83.191") gatilho = 1 hora_disparo = time.time ()+60

ধাপ 6: Codigo টুইটার - Monitoração

Codigo টুইটার - Monitoração
Codigo টুইটার - Monitoração

código monitoração do twitter, pesquisa post na regiao de sorocaba

código rodando na maquina virtual da AWS EC2

n

টুইটার আমদানি থেকে *আমদানি কনফিগ আমদানি paho.mqtt.publish হিসাবে প্রকাশ করুন

সময় থেকে আমদানি ঘুম

টুইটার = টুইটার (auth = OAuth (config.access_key, config.access_secret, config.consumer_key, config.consumer_secret))

অক্ষাংশ = -23.546211 দ্রাঘিমাংশ = -46.637840 আলক্যান্স = 50 ফলাফল

published.single ("twitter_alarme", "ON", hostname = "34.230.74.201")

result_count = 0 last_id = None flag = 0

আমার জন্য পরিসরে (60): #----------------------------------------- ------------------------------ # অক্ষাংশ এবং দ্রাঘিমাংশের উপর ভিত্তি করে একটি অনুসন্ধান করুন # টুইটার এপিআই ডক্স: https:// dev। twitter.com/rest/reference/get/search… #------------------------------------- ---------------------------------- চেষ্টা করুন: query = twitter.search.tweets (q = "#Terremoto", জিওকোড = " %f, %f, %dkm" %(অক্ষাংশ, দ্রাঘিমাংশ, alcance), max_id = last_id) মুদ্রণ ("leu")

ব্যতীত: মুদ্রণ ("ত্রুটি অ্যাক্সেসো টুইটার") বিরতি

প্রশ্নের ফলাফলের জন্য ["অবস্থা"]:

#------------------------------------------------- ---------------------- # শুধুমাত্র একটি ফলাফল প্রক্রিয়া করুন যদি এটি একটি ভৌগলিক অবস্থান # ----------------- -------------------------------------------------- ---- যদি ফলাফল ["জিও"]: result_count += 1 last_id = result ["id"] ঘুম (1) if result_count == resultados: flag += 1 published.single ("twitter_alarme", "ON", hostname = "34.230.74.201") published.single ("twitter", "TERREMOTO - DETECTADO", hostname = "34.230.74.201") বিরতি

ধাপ 7: Estrutura AWS

Estrutura AWS
Estrutura AWS
Estrutura AWS
Estrutura AWS
Estrutura AWS
Estrutura AWS

ইউটিলিজামোস উমা মাকুইনা ভার্চুয়াল রোডান্ডো উবুন্টু না ইস্ট্রুতুরা এডব্লিউএস ইসি 2

AWS IOT Core para serviço de MQTT onde configuramos as ações conforme o tipo de mensagem

AWS SNS que eram acionados pelo AWS IOT Core ব্যবহার করে

প্রস্তাবিত: