Πίνακας περιεχομένων:

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 Βήματα
Βίντεο: Tsunami llega a Perú! 😱 Playa Redondo Miraflores. 2024, Νοέμβριος
Anonim
Centro De Comando Emergencias - Erupção De Vulcão E Terremotos
Centro De Comando Emergencias - Erupção De Vulcão E Terremotos

Μπορείτε να παρακολουθήσετε τις διαδικασίες που σχετίζονται με το διαδίκτυο για να διαπιστώσετε τη φύση, προσφέροντάς σας τη δυνατότητα να εντοπίσετε τις επιπτώσεις της θερμοκρασίας, της φωτεινότητας, της φωτεινότητας (tilte) και του bot. Ainda no cenário de colaboração prevemos integração com o Twitter και aplicativos com suporte mqtt para acionamento do alerta.

Δυνατότητα διαφόρων μεθόδων για την επίλυση, το κέντρο και τις λειτουργίες του avaliar που μπορούν να χρησιμοποιηθούν ως πληροφορίες για τη σωστή κάλυψη των πιθανών αυτοματισμών και των διαθέσιμων αυτοματισμών και των πιθανών ψευδών ειδών. Tal tomada de decisão é important diante ao pânico que um alarme falso pode gerar.

Λύστε την προειδοποίηση για την αξιολόγηση του προσωπικού σας για τη χρήση των SMS, την ειδοποίηση των πελατών σας, email, sirene και twitter.

Σχετικά με το AWS incluindo IOT CORE, EC2 και SNS

Sensores da DragonBord 410c

clientes android mqtt

Sendo todo desenvolvido em python

Autores:

Diego Fernandes dos Santos - [email protected]

Gabriel Piovani Moreira dos Santos - [email protected]

Gustavo Venancio Luz - [email protected]

Paulo Henrique Almeida Santos - [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 detearem uma variação fora do padrão pré estabelecido enviarem um alerta através do πρωτόκολλο mqtt sinalizand

Este alerta começa a contagem regressiva que pode ser suspensa ou acelerada pelo operador.

O contador para o alerta começa contagem regressiva em 60 seguntos, και todo novo alerta deteado decresce o contador em 20 segundos.

programa rodando dentro da dragon borad 410c

#!/usr/bin/python3import spidev από libsoc εισαγωγή gpio από χρόνο εισαγωγής ύπνου

# Importa lib para comunicacao com MOSQUITTO import paho.mqtt.client as mqtt

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

#Usando a porta ADC1 channel_select1 = [0x01, 0x80, 0x00]

#Para usar a porta ADC2 use 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 ("Αναγνωριστικό μηνύματος:" + 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)

εάν _ όνομα _ == '_ κύριο_': 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 () sleep (0.00001) gpio_cs.set_low () rx = spi.xfer (channel_select.) gp) 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 alarme, teste ultima leitura + 5%

αν adc_value_old == 0: adc_value_old = adc_value if adc_value> (adc_value_old*1.05): pub.publish ("ALARME", "ON") print ("Alarmado temperatura") adc_value_old = adc_value sleep (1)

gpio_cs.set_high () sleep (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 print ("Luminosidade: % f / n" % adc_value2) pub.publish ("luminosidade", str (adc_value2))

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

αν adc_value2_old == 0: adc_value2_old = adc_value2 εάν adc_value2> (adc_value2_old*1.5): pub.publish ("ALARME", "ON") print ("Alarmado Luminosidade") adc_value2_old = adc_value2 ύπνος (3)

Βήμα 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 detea os tremores και o botão para simular o uso de um botão de pânico.

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

programa rodando dentro da dragon borad 410c

από libsoc_zero. GPIO Κουμπί εισαγωγής από libsoc_zero. GPIO εισαγωγή Tilt from time import sleep import paho.mqtt.client ως mqtt import sys

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 ("Αναγνωριστικό μηνύματος:" + str (μέσα) + "\ n") πέρασμα

def deteaTilt (): count = 0 sleep_count = 0 while True: try: tilt.wait_for_tilt (1) εκτός από: sleep_count += 1 else: count += 1 sleep_count += 1 εάν sleep_count> 999: break

print ("count:", count) if count> 200: pub = mqttc.publish ("TERREMOTO", "ON") pub = mqttc.publish ("SISMOGRAFO", str (count)) # 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

topic = "grupo3"

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

κλίση = κλίση («GPIO-A»)

btn = Κουμπί ('GPIO-C')

while True: sleep (0,25) deteaTilt () if btn.is_pressed (): pub = mqttc.publish ("PANICO", "ON") print ("Botao ON") sleep (1) pub = mqttc.publish ("PANICO "," OFF ") # else: # 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, programa rodando dentro da dragon board 410c

# Importa lib para comunicacao com MOSQUITTOimport paho.mqtt.client as mqtt

από libsoc_zero. GPIO εισαγωγή LED από το χρόνο εισαγωγής ύπνου led = LED ('GPIO-E') #led.off ()

# Define o que fazer ao conectar def on_connect (client, obj, flags, rc): print ("Conexàestab o estabelecida com broker")

# Define o que fazer ao receber uma mensagem def on_message (client, obj, message): print ("LED" + str (message.payload.decode ("utf-8"))) if str (message.payload.decode ("utf-8")) == "on": print ("Sirene ligada") led.on () else: print ("Sierene apagada") led.off ()

# IP do broker broker_address = "34.230.74.201"

# Cria o cliente sub = mqtt. Client ("grupo3")

sub.connect (broker_address)

sub.on_message = on_message sub.on_connect = on_connect

# Αύξηση θέματος sub.subscribe ("SIRENE", qos = 0)

# Loop para escuta sub.loop_forever ()

Βήμα 4: Codigo Twitter - Δημοσίευση

Codigo Twitter - Δημοσίευση
Codigo Twitter - Δημοσίευση
Codigo Twitter - Δημοσίευση
Codigo Twitter - Δημοσίευση

Código para publicação do twitter assim que acionado o alarme.

código rodando na maquina virtual da AWS EC2

#!/usr/bin/env python #-------------------------------------------- ------------------------------- # twitter-post-status #-δημοσιεύει ένα μήνυμα κατάστασης στο χρονολόγιό σας # --- ------------------------------------------------------ ------------------ εισαγωγή paho.mqtt.subscribe as subscribe

χρόνο εισαγωγής

από εισαγωγή twitter *

#----------------------------------------------------- ---------------------- # ποια πρέπει να είναι η νέα μας κατάσταση; #----------------------------------------------------- ---------------------- new_status = "#Terremoto Procure uma zona segura-teste"

#----------------------------------------------------- ---------------------- # φορτώστε τα διαπιστευτήριά μας API # ---------------------- ----------------------------------------------------- εισαγωγή sys sys.path.append (".") εισαγωγή config

#----------------------------------------------------- ---------------------- # δημιουργία αντικειμένου twitter API # ---------------------- ---------------------------------------------------- twitter = Twitter (auth = OAuth ('senha removida))

#----------------------------------------------------- ---------------------- # δημοσιεύστε μια νέα κατάσταση # έγγραφα API twitter: https://dev.twitter.com/rest/reference/post/statu… #----------------------------------------------------- ----------------------

ενώ 1: m = subscribe.simple ("twitteralarme", hostname = "172.31.83.191", διατηρήθηκε = False) αν m.topic == "twitteralarme" και str (m.payload.decode ("utf-8")) == "on": results = twitter.statuses.update (status = (new_status)+str (time.time ())) # print ("ενημερωμένη κατάσταση: % s" % new_status)

Βήμα 5: Centro De Comando

Centro De Comando
Centro De Comando

semper que acionado και διαθέσιμο εγχειρίδιο ή εντοπισμός και εγρήγορση εγχειριδίου για τη χρήση της acionada uma contagem regressiva para envio de mensagem. O operador pode cancellar o envio ou acionar o envio imediato do alerta.

Χρησιμοποιήστε το dasboard χρησιμοποιώντας το android και το τηλέφωνό σας για τη λειτουργία ενός μηνύματος για τη λειτουργία του κέντρου.

código rodando na maquina virtual da AWS EC2

εισαγωγή paho.mqtt.client ως pahoimport paho.mqtt.subscribe as subscribe import paho.mqtt.publish as published import json time import import import six import ssl from time import sleep sleep

θέματα = ['#']

gatilho = 0 hora_disparo = 0 δημοσίευση.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 (πρόγραμμα -πελάτης, δεδομένα χρήστη, σημαίες, rc): καθολική connflag connflag = Εκτύπωση πραγματικής εκτύπωσης (connflag) ("Αποτέλεσμα σύνδεσης σύνδεσης:" + str (rc))

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

def on_log (πρόγραμμα -πελάτης, δεδομένα χρήστη, επίπεδο, buf): εκτύπωση (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.pem. crt "keyPath =" 9e85dfd42a-private.pem.key "mqttc.tls_set (caPath, certfile = certPath, keyfile = keyPath, cert_reqs = ssl. CERT_REQUIRED, tls_version = ssl. PROTOCOL_TLSvtc_tlsvt, tcscont, tc, 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) if gatilho == 1: published.single ("TEMPO", str. (γύρος (hora_disparo-hora, 0)), qos = 1, hostname = "172.31.83.191") published.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) and (gatilho == 1): # print ("TERREMOTO") # print (connflag) if connflag == True: # mqttc.publish ("message", json.dumps ({'message': "TERREMOTO"}), qos = 1) # mqttc.publish ("message", "TERREMOTO ", qos = 1) mqttc.publish (" μήνυμα ", 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 ", διατηρήθηκε = False) αν m.topic ==" ACIONADO "και str (m.payload.decode (" utf-8 ")) ==" OFF ": gatilho = 0 print (" cancellado ") αν m.topic ==" medico "και str (m.payload.decode (" utf-8 ")) ==" on ": if connflag == True: mqttc.publish (" medico ", json.dumps (" MEDICOS - EMERGENCIA TERREMOTO "), qos = 1) αν m.topic ==" bombeiro "και str (m.payload.decode ("utf -8")) == "on": if connflag == True: 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. topic == "urgente" and 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 else: print ("Acionado") published.single ("ACIONADO", 1, qos = 1, hostname = "172.31.83.191") gatilho = 1 hora_disparo = time.time ()+60

Βήμα 6: Codigo Twitter - Monitoração

Codigo Twitter - Monitoração
Codigo Twitter - Monitoração

código monitoração στο twitter, pesquisa post na regiao de sorocaba

código rodando na maquina virtual da AWS EC2

ν

από twitter import *import config import paho.mqtt.publish as published

από τον χρόνο εισαγωγής ύπνου

twitter = Twitter (auth = OAuth (config.access_key, config.access_secret, config.consumer_key, config.consumer_secret))

γεωγραφικό πλάτος = -23.546211 γεωγραφικό μήκος = -46.637840 αλκάνς = 50 αποτελέσματα = 1

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

result_count = 0 last_id = Καμία σημαία = 0

για i στην περιοχή (60): #--------------------------------------------- ------------------------------ # πραγματοποιήστε μια αναζήτηση βάσει γεωγραφικού πλάτους και γεωγραφικού μήκους # twitter API docs: https:// dev. twitter.com/rest/reference/get/search… #---------------------------------------- ---------------------------------- δοκιμάστε: query = twitter.search.tweets (q = "#Terremoto", γεωκώδικας = " %f, %f, %dkm" %(γεωγραφικό πλάτος, γεωγραφικό μήκος, αλκάνς), max_id = last_id) εκτύπωση ("leu")

εκτός από: εκτύπωση ("erro acesso twitter") διάλειμμα

για αποτέλεσμα στο ερώτημα ["statuses"]:

#----------------------------------------------------- ---------------------- # επεξεργάζεται ένα αποτέλεσμα μόνο εάν έχει γεωγραφική τοποθεσία # ----------------- ------------------------------------------------------ ---- αν αποτέλεσμα ["geo"]: result_count += 1 last_id = αποτέλεσμα ["id"] sleep (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

Utilizamos uma maquina virtual rodando ubuntu και estrutura AWS EC2

Χρησιμοποιήστε ένα AWS IOT CORE για διακόσμηση MQTT onde configuramos as ações conforme o tipo de mensagem

Χρησιμοποιήστε θέματα σχετικά με το AWS SNS que eram acionados pelo AWS IOT CORE

Συνιστάται: