muhammed amar slik
Published

Security System Using Password by Arduino & Python

This project is meant to protect you from any thief who may try to hack the password to your system.

IntermediateWork in progress1.5 hours11,081
Security System Using Password by Arduino & Python

Things used in this project

Story

Read more

Schematics

aa_b8CgiwIBPv.jpg

this circuit diagram which i used in my project

Code

password.ino

Arduino
#include<LiquidCrystal.h>
#include "Keypad.h"
const byte row = 4;
const byte col = 4;
char keys[row][col]={
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
char pass[] = {'1','5','9','D','C','0'};
char newpass[6];
byte rowpins[] = {22,23,24,25};
byte colpins[] = {26,27,28,29};
int i= 0,f =0,c=0,error =0;
Keypad mykeypad = Keypad(makeKeymap(keys),rowpins,colpins,row,col);
LiquidCrystal lcd(7,6,5,4,3,2);
void print1(){
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Enter password ");
  lcd.setCursor(0,1);
   
  
}

void setup() {
  Serial.begin(9600);
  pinMode(13,OUTPUT);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("* hello there * ");
delay(2000);
print1();
}

void loop() {

  char key = mykeypad.getKey();
  if(key !=NO_KEY && i<6){
  lcd.setCursor(i,1);
  lcd.print("*");
  newpass[i] = key;
  if(newpass[i]== pass[i])
  c++;
  i++;
  }
  if (c == 6){
    delay(500);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("correct");
    digitalWrite(13,HIGH);
    delay(1000);
    digitalWrite(13,LOW);
    i=0;
    c=0;
    error = 0;
    print1();
  }
   
  if (c<6 &&i ==6){
        delay(500);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Invalid Password");
    delay(1000);
    i=0;
    c=0;
    error++;
    if (error == 3){
      lcd.print("Invalid Password");
      lcd.setCursor(0,1);
      lcd.print("u must waite ");
      delay(1000);
      Serial.println("NNMM");
      
      for (int i=180;i>=0;i--){
        
        lcd.setCursor(13,1);
        lcd.print(i);
        delay(1000);
      }
      }
      else
      print1();
    }
  

}

ser.py

Python
import serial
import smtplib
from email.mime.text import MIMEText
acc = str(input("Enter your gmail account: "))
pas = str(input("Enter your gmail account password: "))
anacc = str(input("Enter the recipient account: "))
ser = serial.Serial("COM3",9600)
x = ser.readline()
x=x.decode("utf-8")
if (x[0] == "N"):
    s =  smtplib.SMTP("smtp.gmail.com",587)
    s.starttls()
    s.login(acc,pas)
    msg = MIMEText("<h1>Your system</h1><p>Hello man\n someone is trying to guess on your password"
                   +" blacky*</p>","html")
    msg ['Subject'] = "about your system"
    msg ['From'] = "Arduino"
    msg ['To'] = "blacky"
    s.sendmail(acc,anacc,str(msg))
    s.quit()

Credits

muhammed amar slik

muhammed amar slik

0 projects • 10 followers

Comments