Mithun Das
Published © GPL3+

Touchless ATM using Augmented Reality

Touchless keypad such as ATM, Gas station, Store self checkout to prevent spread of COVID-19.

IntermediateShowcase (no instructions)10 hours998

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
Used to program ATM machine
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
Used to dispatch money from ATM machine
×1
4x4 Matrix Keypad
×1

Software apps and online services

Unity
Unity
Vuforia
Arduino IDE
Arduino IDE
MQTT
MQTT

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Servo Motor, Premium Male/Male Jumper Wires
Servo Motor, Premium Male/Male Jumper Wires

Story

Read more

Schematics

ATM

Code

ATM Nodemcu

Arduino
This program is uploaded to NodeMCU
#include <Keypad.h>
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <PubSubClient.h>

const char* ssid = "";//put your wifi network name here
const char* password = "";//put your wifi password here
const char* mqtt_server = "broker.hivemq.com";

WiFiClient espClient;
PubSubClient client(espClient);

const byte n_rows = 4;
const byte n_cols = 4;
 
char keys[n_rows][n_cols] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
 
byte colPins[n_rows] = {D3, D2, D1, D0};
byte rowPins[n_cols] = {D7, D6, D5, D4};
 
Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, n_rows, n_cols); 
Servo myservo;
String passcode="";
String myPasscode="5432"; //predefined passcode, change as per your desire
 
void setup(){
  Serial.begin(115200);
  myservo.attach(15); //attach the servo on pin D8)
  myservo.write(150);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
}


void setup_wifi() {
    delay(100);
  // We start by connecting to a WiFi network
    Serial.print("Connecting to ");
    Serial.println(ssid);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) 
    {
      delay(500);
      Serial.print(".");
    }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
 
  Serial.print("Message arrived in topic: ");
  Serial.println(topic);
 
  Serial.print("Message:");
  String message;
  
  for (int i = 0; i < length; i++) {
    //Serial.print((char)payload[i]);
    message+=(char)payload[i];
  }
  if(message==myPasscode){
    publish("Approved");
    dispatchMoney();
  }else{
    publish("Denied");
  }
  Serial.println();
  Serial.println("-----------------------");
 
}

void publish(String msg){

     char message[100];
     msg.toCharArray(message,100);
    client.publish("/ABC/ATM/ACK", message);
}

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) 
  {
    Serial.print("Attempting MQTT connection...");
    // Create a random client ID
    String clientId = "ESP8266Client-";
    clientId += String(random(0xffff), HEX);
    // Attempt to connect
    //if you MQTT broker has clientID,username and password
    //please change following line to    if (client.connect(clientId,userName,passWord))
    if (client.connect(clientId.c_str()))
    {
      Serial.println("connected");
     //once connected to MQTT broker, subscribe command if any
      client.subscribe("/ABC/ATM/RCV");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 6 seconds before retrying
      delay(6000);
    }
  }
} //end reconnect()

 
void loop(){

  if (!client.connected()) {
      reconnect();
    }
    client.loop();

    
  char myKey = myKeypad.getKey();
 
  if (myKey != NULL){
    if(myKey =='#'){
      Serial.print("You entered: ");
      Serial.println(passcode);
      if(passcode == myPasscode){
        Serial.println("Your are welcome");
        
        dispatchMoney();
       
      }else{
        Serial.println("Password did not match");
       
      }
      passcode="";
    }else{
      
      passcode+=myKey;
      
    }
    delay(200);
  }
}


void dispatchMoney() {
  Serial.println("Dispatching money...");
  myservo.write(90); //rotates the motor counterclockwise at slow speed
  delay(5000);
  myservo.write(150); //rotates the motor counterclockwise at slow speed
  
}

Unity Code

Credits

Mithun Das

Mithun Das

10 projects • 27 followers
A tech enthusiast who loves creating, sharing, evaluating and learning new technology.

Comments