Misbahul Ulum
Published © CC BY

Pembuka gerbang otomatis

pembuka gerbang otomatis yang berbasis teknologi ardunio

BeginnerFull instructions provided5 hours553
Pembuka gerbang otomatis

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
RFID reader (generic)
×1
rtc ds1307
×1
Servos (Tower Pro MG996R)
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×29
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

library yang dibutuhkan

Schematics

skema pembuka gerbang

Code

Source code arduino ide pembuka gerbang otomatis

C/C++
/*
 * 
 * All the resources for this project: https://www.hackster.io/Aritro
 * Modified by Misbahul ulum
 * 
 * 
 */
 
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>          
Servo servoku;              


 
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
 
void setup() 
{
  
  Serial.begin(9600);   // Initiate a serial communication

  servoku.attach(9);  
  
  Wire.begin();
    RTC.begin();
  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
 
  
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Dekatkan Tag");
  Serial.println();
  pinMode(3, OUTPUT);

}
void loop() 
{
  DateTime now = RTC.now();
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "42 5A A0 0D" && now.hour()<22 && now.hour()>5 || content.substring(1) == "59 1F 71 8B" && now.hour()<22 && now.hour()>5) //change here the UID of the card/cards that you want to give access
  {
    digitalWrite(3, HIGH);
    delay(300);
    digitalWrite(3, LOW);         
    servoku.write(0);       
    delay(3000);
    servoku.write(90);              
    
    Serial.println("Akses diizinkan");
    Serial.println();
    delay(3000);
  }
 
 else   {
    Serial.println(" Akses ditolak");
    delay(3000);
  }
} 

Credits

Misbahul Ulum

Misbahul Ulum

1 project • 1 follower

Comments

Add projectSign up / Login