Deborah Joseph
Published © GPL3+

ATM Machine Prototype

I am curious to know how things works and to replicate them. This project is a replicate of the user interface of an ATM.

BeginnerFull instructions provided2 hours7,126
ATM Machine Prototype

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Multi-Turn Precision Potentiometer- 10k ohms (25 Turn)
Multi-Turn Precision Potentiometer- 10k ohms (25 Turn)
×1
Resistor 1k ohm
Resistor 1k ohm
×2
Jumper wires (generic)
Jumper wires (generic)
×1
arduino keypad
×1

Story

Read more

Schematics

arduino_BJOLA9sPms.jpg

Code

ATM_machine_Prototype.ino

Arduino
This code is written in the simplest form and also for newbies in Programming using Arduino to understand.
//The library used are listed below

#include <Wire.h> 
#include <LiquidCrystal.h>
#include <Keypad.h>

//the datatype of variables

const byte ROWS = 4;
const byte COLS = 4;
int count = 0;
char password[2][5]= {"1234A" ,"5678B"};
int ask=0;
char key;
int choice;
int amount;
char PIN [4]; 
int balance = 10000;



//character hexaKeys is a multidimensional array 0f 3*4
char hexaKeys[ROWS][COLS] = {
    {'1','2','3'},
    {'4','5','6'},
    {'7','8','9'},
    {'E','0','C'}
    
};

//Declaring the keypad keys as an input 

byte rowPins[ROWS] ={A4, 7, 6};
byte colPins[COLS] = {2, 3, 4, 5};


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

// for the lcd pins 
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);  


void setup(){
                Serial.begin(9600);
                // set up the LCD's number of columns and rows:
                lcd.begin(16, 2);
                // Print a message to the LCD.
                lcd.setCursor(0, 0); 
                lcd.print( " Welcome to GTBank ");
                
                lcd.setCursor(0,0);

                // for the scrolling effect of text on the lcd
                for (int scrollCounter = 0; scrollCounter <12 ; scrollCounter++)
                {
                  lcd.scrollDisplayLeft();
                  delay(500);   
                }
                lcd.clear();
                
}

// main loop 
void loop (){
    
     // ask is the number of times for transaction to be make
     while  (ask=1){
     lcd.setCursor(0,0);
     lcd.print("Enter your pin");
     delay(100);
       
     char key = keypad.getKey();
     if (key) {
               lcd.setCursor ( count ,1);
               delay (100);
                 
               PIN [count]=key;
               lcd.print(PIN [count]);
               count++ ;
                       if (count ==4){
                       delay (1000);
                       lcd.clear();
                       delay (1000);

     if ( (PIN[0] == password[0][0]||PIN[0]==password[1][0]) &&( PIN[1] ==password[0][1]||PIN[1]==password[1][1]) && 
          (PIN[2] == password[0][2]||PIN[2]==password[1][2]) && (PIN[3] == password[0][3]||PIN[3]==password[1][3]) )
          {         
         lcd.print("Welcome");
         delay (1000);
         lcd.clear();      
         lcd.setCursor (0,0);
         if (password[0][4])
         {
          lcd.setCursor(1,0);
          lcd.print("Deborah");
          delay(1000);
         }
         else {
          lcd.setCursor(1,0);
          lcd.print("Shade");
          delay(1000);
         }
        // lcd.print(password[0][4]);
         //delay(1000);
        // lcd.clear(); 
         //lcd.setCursor(0,0);
         lcd.print( " 1- Withdrawal "); 
         lcd.setCursor(0,1);
         lcd.print (" 2- Deposit");
         delay (1000);
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print( " 3- Balance "); 
         lcd.setCursor(0,1);
         lcd.print(" 4- Transfer");
         delay (1000);
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print(" 5- Exit ");
         delay(1000);
     
         lcd.setCursor(0,0);
         delay (1000);
         int take= 0;
         while (take<=1 ){ 
                char key = keypad.getKey();
                if (key){

                      if(key !=NO_KEY ){
                           if (key=='1'){
              
                int amount;
                 int others;
                 lcd.clear();
                 lcd.setCursor(0,0);
                 lcd.print( "Transaction in Process ") ;
                 lcd.clear();
                 delay(1000);
                 lcd.setCursor(0,0);
                 lcd.print( " 1- #1000  "); 
                 lcd.setCursor(0,1);
                 lcd.print (" 2- #2000  ");
                 delay (500);
                 lcd.setCursor(0,0);
                 lcd.print( " 3- #5000  "); 
                 lcd.setCursor(0,1);
                 lcd.print (" 4- #10000  ");
                 delay (500);
                 lcd.setCursor(0,0);
                 lcd.print( " 5- #20000  "); 
                 lcd.setCursor(0,1);
                 lcd.print (" 6- other ");
                 delay (5000);
                 int i=0;

                     while (i<=1){ 
                            char key = keypad.getKey();
                            if (key){
                               if( key !=NO_KEY ){
                                  if ( 0 < amount && amount <= 5 ){
                                  lcd.clear();
                                  lcd.setCursor(0,0);
                                  lcd.print( " Please wait ");
                                  }
                 
                            else{
                            lcd.clear();
                            lcd.setCursor(0,0);
                            lcd.print( "Enter the amount ");
                            int j =0;
                            int k =0;
                            while (j<=1){
                            char key = keypad.getKey();
                                   if (key) {
                                      lcd.setCursor ( k ,1);
                                      lcd.print(key);
                                      k ++ ;
                                      
                                      if (k==6){
                                         lcd.clear();
                                         lcd.setCursor(0,0);
                                         }
                                      }
                 
                                }
                            break;
                           }
                 
                     break;
                 }
              }
            }
          }

              if (key!=NO_KEY){
                  if (key=='2'){
                     int allow=0;
                     lcd.clear();
                     lcd.setCursor(0,0);
                     lcd.print ( "Enter the amount" );
                     lcd.setCursor(0,1);

                     int b=0;
                     int a =0;
                     while (a<=1){
                          char key = keypad.getKey();
                          if (key){     
                              
                             lcd.setCursor ( b ,1);
                             lcd.print(key);
                             b ++ ;
                             if (b ==6){ 
                                lcd.clear();
                                lcd.print ("Transaction in Progress ");
                                break;
                                }
                           } 
                     }
                  }


                  if (key!=NO_KEY){
                      if (key=='3'){
                          lcd.clear();
                          lcd.setCursor(0,0);
                          lcd.print ("Please wait") ;
                          delay (2000);
                          lcd.clear();
                          lcd.setCursor(0,0);
                          lcd.print ("Your Account Balance is");
                          delay (3000);
                          lcd.setCursor(0,1);
                          lcd.print(balance);
                          delay(1000);
                          lcd.clear();
                          delay(2000);
                          break;
                    }
                 }


               if (key!=NO_KEY){
                   if (key=='4'){
                      lcd.clear();
                      lcd.setCursor(0,0);
                      lcd.print ("Please wait") ;
                      delay ("1000");
                      lcd.clear();
                      lcd.setCursor(0,0);
                      lcd.print (" Transaction in Progress");
                      delay (1000);
                      break;
                    }
           }

           if (key != NO_KEY){
               if (key=='5'){
                  lcd.clear();
                  lcd.setCursor(0,0);
                  delay (1000);
                  lcd.print("Take your card"); 
                  delay (2000);
                  break;
                  }
              }
                      }
             }
        }
    }
                      
                     
  }
     
     else{
     lcd.print(" Incorrect pin"); 
     delay(1000);
     lcd.clear();
     lcd.setCursor(0,0);
     count=0;
     }
    }
   }
  }
 }

Credits

Deborah Joseph

Deborah Joseph

1 project • 1 follower
Electrical and Electronics Engineering Student, University of Ibadan, Nigeria.

Comments