Project showcase
Password-Secured AC Main Console

Password-Secured AC Main Console © GPL3+

Arduino Nano-based, password-protected AC Main Console.

  • 2,437 views
  • 1 comment
  • 3 respects

Components and supplies

About this project

In my country, most of the farms and street fuse carriers are not secured or locked. Everyone can access the AC console and theft the current. Like that, when we do not have protection for it in our homes or without a gate, they can take our water or current. To avoid that, we have to protect our assets.

This project meets this problem. Arduino Nano opens the AC console if you give the correct password. Otherwise it cannot open or access your console even if you close the switch.

The AC line is connected through one relay. The password is required to open this relay. We can input the password using a 4x4 matrix keypad.

Hardware prototype of password protected AC Console

Code

CodeC/C++
#include <Keypad.h>
#include <Password.h>

String newPasswordString;
char newPassword[6];

Password password = Password( "0248163264" );

byte maxPasswordLength = 10;
byte currentPasswordLength = 0;
const byte ROWS = 4;
const byte COLS = 4;

boolean Alpha = false;

char keys[ROWS][COLS] =
{
  {'0', '4', '8', 'C'},
  {'1', '5', '9', 'D'},
  {'2', '6', 'A', 'E'},
  {'3', '7', 'B', 'F'}
};

byte rowPins[ROWS] = {6, 7, 8, 9};

byte colPins[COLS] = {2, 3, 4, 5};

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup()
{
  pinMode(11, OUTPUT);
  digitalWrite(11, LOW);
  Serial.begin(9600);

}

void loop()
{
  char key = keypad.getKey();
  if (key != NO_KEY)
  {
    delay(60);
    switch (key)
    {
      case 'A':
        Alpha = false;
        Serial.println("Console goes OFF state");
        break;
      case 'B': break;
      case 'C': break;
      case 'D': break;
      case 'E': checkPassword(); break;
      case 'F': resetPassword(); break;
      default: processNumberKey(key);
    }
    switch (Alpha)
    {
      case true : Motor__ON(); break;
      case false : Motor__OFF(); break;
      default: processNumberKey(key);
    }
  }
}

void processNumberKey(char key) {
  Serial.print(key);
  currentPasswordLength++;
  password.append(key);
  if (currentPasswordLength == maxPasswordLength) {
    checkPassword();
  }
}

void checkPassword() {
  if (password.evaluate()) {
    Serial.println(" OK.");
    Alpha = true;
  } else {
    Serial.println(" Wrong passwowrd!");
    Alpha = false;
  }
  resetPassword();
}

void resetPassword() {
  password.reset();
  currentPasswordLength = 0;
}
void Motor__ON()
{
  digitalWrite(11, HIGH);
}
void Motor__OFF()
{
  digitalWrite(11, LOW);
}

Schematics

Circuit Diagram
Arduino - 4x4 Keypad - Relay - AC
Circuit%20diagram

Comments

Similar projects you might like

The hydroMazing Smart Garden System

Project tutorial by Cory Potter

  • 51,499 views
  • 17 comments
  • 195 respects

Arduino Radar With Processing

Project in progress by Akshay6766

  • 20,840 views
  • 9 comments
  • 64 respects

Rain Warning Display on Mobile for your Home Garden

Project showcase by Kaustubh Agarwal

  • 11,012 views
  • 7 comments
  • 34 respects

Secure Watering System

Project in progress by foss-he-men

  • 4,914 views
  • 0 comments
  • 5 respects

Arduino and AC Devices - Automatic Lights

Project tutorial by Ahmed Hamdy Mahmoud Hassanein

  • 40,804 views
  • 12 comments
  • 74 respects

Arduino Control AC Water Heater temperature

Project tutorial by Mohannad Rawashdeh

  • 25,435 views
  • 1 comment
  • 12 respects
Add projectSign up / Login