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

Arduino UNO R4 WiFi-Based Smart Lock System with RFID and Motion Detection

View and Edit Project In Cirkit DesignerImage of Arduino UNO R4 WiFi-Based Smart Lock System with RFID and Motion Detection

Circuit Documentation

Summary

This document provides a detailed overview of a circuit that integrates an Arduino UNO R4 WiFi microcontroller with various sensors and actuators. The circuit includes an RFID reader, an MPU-6050 accelerometer and gyroscope, a push-pull solenoid, a 9V battery, a four-pin LED, resistors, and a 1-channel 5V relay module. The Arduino UNO R4 WiFi is programmed to control these components, enabling functionalities such as RFID-based access control and motion detection.

Component List

  1. Arduino UNO R4 WiFi

    • Description: A microcontroller board based on the ATmega328P, featuring built-in WiFi capabilities.
    • Pins: OFF, GND, VRTC, IIC0_SCL, IIC0_SDA, 3V3, GPIO 41, GPIO 0, GPIO 42, GPIO 43, GPIO 44, BOOT, IOREF, RESET, 5V, VIN, A0, A1, A2, A3, A4, A5, RSPCKA, CIPO, COPI, D0/RX, D1/TX, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, AREF, SDA, SCL
  2. RFID-RC522

    • Description: An RFID reader module used for reading RFID tags.
    • Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA
  3. MPU-6050

    • Description: A 6-axis motion tracking device that includes a 3-axis gyroscope and a 3-axis accelerometer.
    • Pins: VCC, GND, SCL, SDA, XDA, XCL, AD0, INT
  4. Push Pull Solenoid

    • Description: An electromechanical device used to push or pull when activated.
    • Pins: +ve, -ve
  5. 9V Battery

    • Description: A power source providing 9V DC.
    • Pins: -, +
  6. LED: Four Pin

    • Description: A four-pin LED with separate cathodes for red, green, and blue, and a common anode.
    • Pins: red cathode, common anode, green cathode, blue cathode
  7. Resistor (330 Ohms)

    • Description: A resistor with a resistance of 330 Ohms.
    • Pins: pin1, pin2
  8. 1 Channel 5V Relay Module

    • Description: A relay module used to control high voltage devices with a low voltage signal.
    • Pins: VCC+, VCC- (GND), IN, N.O., COM, N.C.

Wiring Details

Arduino UNO R4 WiFi

RFID-RC522

MPU-6050

Push Pull Solenoid

9V Battery

LED: Four Pin

Resistors (330 Ohms)

1 Channel 5V Relay Module

Code Documentation

#define BLYNK_TEMPLATE_ID "TMPL2Gs1tAZOJ"
#define BLYNK_TEMPLATE_NAME "Pave"
#define BLYNK_AUTH_TOKEN "FdVKB9c2zOUlEW3MLIxDQHp-sebYt-jO"

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

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <BlynkSimpleWifi.h>

Adafruit_MPU6050 mpu;

int redpin = 4;
int bluepin = 2;
int greenpin = 3;

int pistonpin = 8;

int pos = 0;    // variable to store the servo position

char ssid[] = "Galaxy S22 ADFA";
char password[] = "y&b072224";

void setup() 
{
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, password);
  pinMode(redpin, OUTPUT);
  pinMode(bluepin, OUTPUT);
  pinMode(greenpin, OUTPUT);
  pinMode(pistonpin, OUTPUT);

  Serial.begin(115200);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522

  digitalWrite(pistonpin, LOW);

  Serial.println("Approximate your card to the reader...");
  Serial.println();

  while (!Serial) {
    delay(10); 
  }

  if (!mpu.begin()) {
    Serial.println("Failed to find MPU6050 chip");
    while (1) {
      delay(10);
    }
  }

  mpu.setAccelerometerRange(MPU6050_RANGE_16_G);
  mpu.setGyroRange(MPU6050_RANGE_250_DEG);
  mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
  delay(100);
}