Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO RFID-RC522 Controlled L293D Motor Driver Shield

View and Edit Project In Cirkit DesignerImage of Arduino UNO RFID-RC522 Controlled L293D Motor Driver Shield

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with an RFID-RC522 module and an L293D motor driver shield. The purpose of the circuit is to control a set of motors based on RFID card detection. When a specific RFID card is scanned, the motors are either driven forward or backward, depending on the card's ID.

Component List

Arduino UNO

RFID-RC522

L293D Motor Driver Shield

Wiring Details

Arduino UNO

RFID-RC522

L293D Motor Driver Shield

Documented Code

Arduino UNO Code (sketch.ino)

/*
 * This Arduino Sketch interfaces with an RFID-RC522 module and an L293D motor driver shield.
 * When RFID card 1 is scanned, all motors run forward.
 * When RFID card 2 is scanned, all motors run backwards.
 */

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9
#define SS_PIN 10

MFRC522 rfid(SS_PIN, RST_PIN);

const int motorPins[] = {2, 3, 4, 5, 6, 7, 8};

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  for (int i = 0; i < 7; i++) {
    pinMode(motorPins[i], OUTPUT);
  }
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  String cardID = "";
  for (byte i = 0; i < rfid.uid.size; i++) {
    cardID += String(rfid.uid.uidByte[i] < 0x10 ? "0" : "");
    cardID += String(rfid.uid.uidByte[i], HEX);
  }
  cardID.toUpperCase();
  Serial.println(cardID);

  if (cardID == "CARD1_ID") {
    runMotorsForward();
  } else if (cardID == "CARD2_ID") {
    runMotorsBackward();
  }

  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

void runMotorsForward() {
  for (int i = 0; i < 7; i++) {
    digitalWrite(motorPins[i], HIGH);
  }
}

void runMotorsBackward() {
  for (int i = 0; i < 7; i++) {
    digitalWrite(motorPins[i], LOW);
  }
}

L293D Motor Driver Shield Code (sketch.ino)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Note: The L293D Motor Driver Shield code provided is empty and does not contain any operational code.