Access Control Using RFID, Raspberry Pi and AppInventor
Access Control Using RFID, Raspberry Pi and AppInventor
Access Control Using RFID, Raspberry Pi and AppInventor
Gabriel Hugo Alvares, Pedro Henrique Galdino Silva, Eduardo Bento Pereira
GCOM - Grupo de Controle e Modelagem
Departamento de Engenharia Eletrica
UFSJ - Universidade Federal de Sao Joao del-Rei
Pca. Frei Orlando, 170 - Centro - 36307-352 - Sao Joao del-Rei, MG, Brasil
Abstract In this paper, the concept of Internet of Things is applied in the development of a system to
control the access of students to a universitys laboratory through radio frequency card transmiters. The system
can be managed in real time through a cellphone application, which communicates with the physical system
through a cloud database. Details on the development of the project and the results are presented.
Resumo Neste trabalho, o conceito de Internet das Coisas e aplicado no desenvolvimento de um sistema
de controle de acessos de alunos a um laboratorio da universidade atraves de cartoes transmissores de radio
frequencia. O sistema desenvolvido pode ser gerenciado em tempo real atraves de aplicativo para celular, que se
comunica com o sistema fsico atraves de um banco de dados na nuvem. Detalhes do desenvolvimento do projeto
e os resultados obtidos sao apresentados.
3 Metodologia
Tensao de entrada;
Corrente de trabalho;
Protocolo de comunicacao.
Agradecimentos
Figura 8: Prototipo.
Os autores agradecem ao grupo Cyros e ao pro-
fessor Eduardo pelo suporte e por disponibilizar
os componentes necessarios para realizacao deste
trabalho.
Referencias
5 Conclusao
def server():
x_rfid = json.loads(url_rfid.text)
y_rfid = json.loads(x_rfid[2])
lista = str(y_rfid)
file = open(arquivo_rfid,"r")
global rfid
rfid=file.readline()
file.close()
global rfid1
rfid1=ast.literal_eval(rfid)
x_usuario = str(url_usuario.text)
y_usuario = ast.literal_eval(x_usuario)
lista = ast.literal_eval(y_usuario[2])
lista1=str(lista)
#Salvando o banco de dados USUARIO no raspberry
arquivo_usuario="arquivo_usuario.text"
file = open(arquivo_usuario,"w")
file.write(lista1)
file.close()
file = open(arquivo_usuario,"r")
usuario=file.readline()
file.close()
global usuario1
usuario1=ast.literal_eval(usuario)
#print usuario1
#print usuario1[2]
threading.Timer(10, server).start()
server()
#Definindo as configuracoes das GPIOs
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
#Mesangem inicial
print(Aproxime a tag do leitor RFID)
code =
counter = counter + 1
if counter == 1:
code = code[:0] + code[(1):]
else:
code = code[:0] + code[(1):]
code = code[:0] + code[(1):]
code = code[:0] + code[(1):]
print(code)
# cases=[(rfid,code)]
if code in rfid1:
print(Cartao liberado)
#Abre a fechadura
GPIO.output(12,GPIO.HIGH)
time.sleep(1)
GPIO.output(12,GPIO.LOW)
arquivo_hist_usuario="arquivo_hist_usuario.text"
file_hist_usuario = open(arquivo_hist_usuario,"r")
hist_usuario = file_hist_usuario.readline()
file_hist_usuario.close()
if hist_usuario == :
hist_usuario1=[usuario1[posicao_usuario]]
hist_usuario=str(hist_usuario1)
else:
hist_usuario1 = ast.literal_eval(hist_usuario)
hist_usuario1.append(usuario1[posicao_usuario])
hist_usuario=str(hist_usuario1)
file_hist_usuario = open(arquivo_hist_usuario,"w")
file_hist_usuario.write(hist_usuario)
file_hist_usuario.close()
data_hist={"tag":"hist_usuario","value":hist_usuario}
r = requests.post(http://iot-lab-access.appspot.com/storeavalue,data_hist)
arquivo_hora="arquivo_hora.text"
file_hora= open(arquivo_hora,"r")
hora = file_hora.readline()
file_hora.close()
hour=datetime.datetime.now().strftime("%H:%M")
if hora == :
hora1=[hour]
horas=str(hora1)
else:
hora1 = ast.literal_eval(hora)
hora1.append(hour)
horas=str(hora1)
file_hora = open(arquivo_hora,"w")
file_hora.write(horas)
file_hora.close()
data_hora={"tag":"hora","value":horas}
r = requests.post(http://iot-lab-access.appspot.com/storeavalue,data_hora)
arquivo_data="arquivo_data.text"
file_data= open(arquivo_data,"r")
data = file_data.readline()
file_data.close()
date=datetime.datetime.now().strftime("%d-%m-%y")
if data == :
data1=[date]
datas=str(data1)
else:
data1 = ast.literal_eval(data)
data1.append(date)
datas=str(data1)
file_data = open(arquivo_data,"w")
file_data.write(datas)
file_data.close()
data_data={"tag":"data","value":datas}
r = requests.post(http://iot-lab-access.appspot.com/storeavalue,data_data)
else:
print(Acesso negado)
code =
else:
code = code + data
#Fim do algoritmo
]
6 Anexo B - Lista de materiais
https://www.raspberrypi.org/learning/getting-started-with-node-red/worksheet/
https://www.raspberrypi.org/learning/physical-computing-with-python/analogue/
https://www.raspberrypi.org/learning/python-web-server-with-flask/
https://www.raspberrypi.org/learning/networking-lessons/lesson-3/plan/
https://www.raspberrypi.org/learning/lamp-web-server-with-wordpress/worksheet/
https://www.raspberrypi.org/learning/demo-programs/worksheet/
https://www.youtube.com/watch?v=tZPWXnMdIRU
https://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address/37921#37921
http://wiringpi.com/the-gpio-utility/pin-test/
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=147291
https://www.raspberrypi.org/documentation/remote-access/ssh/windows.md
https://raspberrypi.stackexchange.com/questions/1303/do-ssh-failing-in-initial-setup
http://ask.xmodulo.com/disable-desktop-gui-raspberry-pi.html
http://cadernodelaboratorio.com.br/2015/06/10/inicializando-um-programa-automaticamente-no-raspberrypi/
http://wiki.sunfounder.cc/index.php?title=How_to_Use_an_RFID_RC522_on_Raspberry_Pi
http://raspmer.blogspot.com.br/2015/07/how-to-use-rfid-rc522-on-raspbian.html
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=147291
https://www.tutorialspoint.com/python/python_quick_guide.htm
http://bradsrpi.blogspot.com.br/2013/01/rfid-with-innovations-id12-rfid-reader.html
http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python/
http://elinux.org/RPi_GPIO_Interface_Circuits
https://sourceforge.net/p/raspberry-gpio-python/wiki/Outputs/
https://pypi.python.org/pypi/RPi.GPIO
https://www.youtube.com/watch?v=b6ZagKRnRdM
https://www.youtube.com/watch?v=qawFgeJldAQ
http://appinventor.mit.edu/explore/content/custom-tinywebdb-service.html
https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=24121&p=234826
http://www.instructables.com/id/Reading-JSON-With-Raspberry-Pi/
http://kio4.com/appinventori/8file_database.htm
http://appinventor.pevest.com/?p=914
https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests
http://www.thegeekstuff.com/2013/06/python-list/?utm_source=feedly
http://www.pythonforbeginners.com/basics/python-datetime-time-examples
https://stackoverflow.com/questions/8600161/executing-periodic-actions-in-python
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=122220&p=824154
http://www.pythonforbeginners.com/requests/using-requests-in-python
https://iot-lab-access.appspot.com/getvalue
http://blog.evaldojunior.com.br/aulas/python/2009/02/08/curso-de-python-aula-12.html