Project showcase
Password-Secured AC Main Console

Password-Secured AC Main Console © GPL3+

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

  • 1,828 views
  • 1 comment
  • 1 respect

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

Arduino Control AC Water Heater temperature

Project tutorial by Mohannad Rawashdeh

  • 9,039 views
  • 0 comments
  • 6 respects

Arduino and AC Devices - Automatic Lights

Project tutorial by Ahmed Hamdy

  • 21,949 views
  • 7 comments
  • 51 respects

Nano Relay Module

Project showcase by Boaz Lawnce

  • 7,660 views
  • 0 comments
  • 9 respects

Smart Connected Open Source Pot (Scopot)

Project showcase by Hendra Kusumah

  • 3,215 views
  • 1 comment
  • 29 respects

Ingegno Retro Games Console

Project tutorial by bmcage

  • 2,169 views
  • 3 comments
  • 13 respects

Nano IR Remote for DC Motors

Project showcase by Boaz Lawnce

  • 1,522 views
  • 2 comments
  • 4 respects
Add projectSign up / Login