Wet & Dry Waste Smart Dustbin for House | Best science Project | Harish Projects

Image
 Watch Full Detailed video πŸ‘‡πŸ» Diagram in VideoπŸ‘† //Arduino Code// //YouTube: Harish Projects //Order Electronic Parts & Project kit:  HarishProjects.com // #include <Servo.h> Servo servo1; const int trigPin = 12; const int echoPin = 11; long duration; int distance=0; int potPin = A0; //input pin int soil=0; int fsoil; void setup()  {   Serial.begin(9600); //Serial.print("Humidity"); pinMode(trigPin, OUTPUT);  pinMode(echoPin, INPUT);  servo1.attach(8); } void loop()  { //YouTube: Harish Projects //Order Electronic Parts & Project kit:  HarishProjects.com //      int soil=0;   for(int i=0;i<2;i++)   { digitalWrite(trigPin, LOW); delayMicroseconds(7); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); delayMicroseconds(10); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2+distance; delay(10);   }   distance=distance/2;   Serial.println(distance); if ...

How to Make RFID car Best science Project / Arduino Project.


                                                  Click Here to watch video on YouTube

...........................................................................Diagram...................................................................




 ................................................................. Arduino Car Code...........................................................


 char t;

 

void setup() {

pinMode(13,OUTPUT);   //left motors forward

pinMode(12,OUTPUT);   //left motors reverse

pinMode(11,OUTPUT);   //right motors forward

pinMode(10,OUTPUT);   //right motors reverse

pinMode(9,OUTPUT);   //Led

Serial.begin(9600);

 

}

 

void loop() {

if(Serial.available()){

  t = Serial.read();

  Serial.println(t);

}

 

if(t == 'F'){            //move forward(all motors rotate in forward direction)

  digitalWrite(13,HIGH);

  digitalWrite(11,HIGH);

}

 

else if(t == 'B'){      //move reverse (all motors rotate in reverse direction)

  digitalWrite(12,HIGH);

  digitalWrite(10,HIGH);

}

 

else if(t == 'L'){      //turn right (left side motors rotate in forward direction, right side motors doesn't rotate)

  digitalWrite(11,HIGH);

}

 

else if(t == 'R'){      //turn left (right side motors rotate in forward direction, left side motors doesn't rotate)

  digitalWrite(13,HIGH);

}


else if(t == 'W'){    //turn led on or off)

  digitalWrite(9,HIGH);

}

else if(t == 'w'){

  digitalWrite(9,LOW);

}

 

else if(t == 'S'){      //STOP (all motors stop)

  digitalWrite(13,LOW);

  digitalWrite(12,LOW);

  digitalWrite(11,LOW);

  digitalWrite(10,LOW);

}

delay(100);

}




.................................................................RFID Code...........................................................................



 #include <SPI.h>

#include <MFRC522.h>


#define RST_PIN         9           // Configurable, see typical pin layout above

#define SS_PIN          10          // Configurable, see typical pin layout above


MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.


String read_rfid;                   // Add how many you need and don't forget to include the UID.

String ok_rfid_1="f9a112e8";        // This is for my main RFID Card. aka. The one I will be using to turn on my PC. Can also be used to shut it down if you want to.

String ok_rfid_2="19e3c1b1";        // This is for the RFID Keyfob. aka. Shutdown Keyfob. Not advisable tho. Just shutdown your PC normally.

int lock = 7;                       // For the Card.

int lock2 = 7;                      // For the Keyfob.

/*

 * Initialize.

 */

void setup() {

    Serial.begin(9600);         // Initialize serial communications with the PC

    while (!Serial);            // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

    SPI.begin();                // Init SPI bus

    mfrc522.PCD_Init();         // Init MFRC522 card


    //Choose which lock below:

    pinMode(lock, OUTPUT);

    pinMode(lock2, OUTPUT);

}

/*

 * Helper routine to dump a byte array as hex values to Serial.

 */

void dump_byte_array(byte *buffer, byte bufferSize) {

    read_rfid="";

    for (byte i = 0; i < bufferSize; i++) {

        read_rfid=read_rfid + String(buffer[i], HEX);

    }

}


void open_lock() {

  //Use this routine when working with Relays and Solenoids etc.

  digitalWrite(lock,HIGH);

  delay(500);

  digitalWrite(lock,HIGH);

}



void close_lock2() {          // You can also just use the card to shutdown your PC. This is just for those moments that you really need to shut it down quickly. 

  //Use this routine when working with Relays and Solenoids etc.

  digitalWrite(lock2, LOW);

  delay(5000);                

  digitalWrite(lock2,LOW);

}



void loop() {


      // Look for new cards

    if ( ! mfrc522.PICC_IsNewCardPresent())

        return;


    // Select one of the cards

    if ( ! mfrc522.PICC_ReadCardSerial())

        return;


    dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);

    Serial.println(read_rfid);

    if (read_rfid==ok_rfid_1) {

      //ok, open the door.

      open_lock();

    }


    Serial.println(read_rfid);

    if (read_rfid==ok_rfid_2) {

      //ok, open the door.

      close_lock2();

    }

    //Add below as many "keys" as you want

    //if (read_rfid==ok_rfid_2) {

      //also ok, open the door

    //  open_lock();

    //}

    // else not needed. Anything else is not ok, and will not open the door...

}


Comments

Veeresh said…
I need driving licence scanner audrino uno program
Anangpal said…
Sir aapne Jo driving licence scan karke gadi chalane Wale project ke baare me video banaya tha Please uska code bhej dijiye Please sir
Please sir send driving licence scanning device code πŸ™
ron dsilva said…
#include
#include

#define SS_PIN 10 // Define SS_PIN for RFID module
#define RST_PIN 9 // Define RST_PIN for RFID module
#define MOTOR_PIN 5 // Define pin connected to the motor driver

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create an instance of the RFID module

void setup() {
Serial.begin(9600); // Start serial communication
SPI.begin(); // Initiate SPI communication
mfrc522.PCD_Init(); // Initiate RFID module
pinMode(MOTOR_PIN, OUTPUT); // Set MOTOR_PIN as output
stopMotor(); // Make sure the motor is initially stopped
}

void loop() {
// Look for new RFID cards
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
Serial.println("Card detected!");

// Check if the detected card is authorized
if (isAuthorizedCard()) {
Serial.println("Access granted!");
startMotor(); // Start the motor when an authorized card is detected
delay(5000); // Run the motor for 5 seconds (adjust as needed)
stopMotor(); // Stop the motor after the specified time
} else {
Serial.println("Access denied!");
}

mfrc522.PICC_HaltA(); // Halt the card to stop further reads
}
}

bool isAuthorizedCard() {
// Replace the following UID with the UID of the authorized RFID card
byte authorizedCardUID[] = {0xAA, 0xBB, 0xCC, 0xDD};

// Compare the detected card's UID with the authorized card's UID
for (byte i = 0; i < mfrc522.uid.size; i++) {
if (mfrc522.uid.uidByte[i] != authorizedCardUID[i]) {
return false; // Not an authorized card
}
}

return true; // Authorized card detected
}

void startMotor() {
digitalWrite(MOTOR_PIN, HIGH); // Turn on the motor
}

void stopMotor() {
digitalWrite(MOTOR_PIN, LOW); // Turn off the motor
}
ron dsilva said…
INCLUDE THE MFRC522 LIBRARY IN ARDUINO UNO
Joog Ghori said…
This comment has been removed by the author.
tanmay mankar said…
sir your code is not working please resent it to me
ron dsilva said…
You should first get the uid code (rfid card code ) , and then you need to update the uid in the code , And please do let me know What error you are getting

Popular posts from this blog

Smart Bridge - Automatic Hight increase when flooding | Best science Project

How to make Phone control RC car using Arduino #phoneControlCar

Inspire Award Project | Train accident Prevention project | Best science Project / Harish Projects