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

Arduino UNO Bluetooth-Controlled Smart Locker with Servo Motor

View and Edit Project In Cirkit DesignerImage of Arduino UNO Bluetooth-Controlled Smart Locker with Servo Motor

Circuit Documentation

Summary

This circuit is designed to control a servo motor using an Arduino UNO, an HC-05 Bluetooth module, and various other components. The circuit includes a 24/12V buck converter to step down the voltage, a 5V relay for switching, and an IR sensor for distance measurement. The Arduino UNO is programmed to control the servo motor based on Bluetooth commands and distance measurements.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. HC-05 Bluetooth Module

    • Description: Bluetooth module for wireless communication.
    • Pins: Key, VCC, GND, TXD, RXD, State
  3. Servo

    • Description: Servo motor for precise control of angular position.
    • Pins: GND, VCC, PWM
  4. 5A Fuse

    • Description: Fuse to protect the circuit from overcurrent.
    • Pins: 1, 2
  5. 24/12V Buck Converter

    • Description: Buck converter to step down voltage from 24V to 12V.
    • Pins: VIN+, VIN-, 5V, GND
  6. IR Sensor

    • Description: Infrared sensor for distance measurement.
    • Pins: out, gnd, vcc
  7. MKE-M08 LCD2004 I2C Module

    • Description: LCD display module with I2C interface.
    • Pins: GND, 5V, SDA, SCL
  8. 5V Relay

    • Description: Relay module for switching high power devices.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
  9. 2.1mm Barrel Jack with Terminal Block

    • Description: Power connector for external power supply.
    • Pins: POS, NEG
  10. DIP Switch 1 Position

    • Description: Single position DIP switch for manual control.
    • Pins: 1, 2
  11. 12V 5Ah Battery

    • Description: Battery for powering the circuit.
    • Pins: 12v +, 12v -
  12. Electrolytic Capacitor

    • Description: Capacitor for filtering and smoothing voltage.
    • Pins: -, +
    • Properties: Capacitance: 0 Farads
  13. Resistor

    • Description: Resistor for current limiting.
    • Pins: pin1, pin2
    • Properties: Resistance: 2000 Ohms
  14. Resistor

    • Description: Resistor for current limiting.
    • Pins: pin1, pin2
    • Properties: Resistance: 1000 Ohms

Wiring Details

Arduino UNO

HC-05 Bluetooth Module

Servo

5A Fuse

24/12V Buck Converter

IR Sensor

MKE-M08 LCD2004 I2C Module

5V Relay

2.1mm Barrel Jack with Terminal Block

DIP Switch 1 Position

12V 5Ah Battery

Electrolytic Capacitors

Resistors

Documented Code

#include <Servo.h>

const int trigPin = 7;
const int echoPin = 6;
const int servoPin = 9;
const int bluetoothRx = 10;
const int bluetoothTx = 11;

Servo lockerServo;
long duration;
int distance;
char bluetoothData;

void setup() {
  lockerServo.attach(servoPin);
  lockerServo.write(0);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  distance = getDistance();

  if (distance <= 50) {
    if (Serial.available()) {
      bluetoothData = Serial.read();
      if (bluetoothData == 'U' || bluetoothData == 'u') {
        unlockLocker();
      } else if (bluetoothData == 'L' || bluetoothData == 'l') {
        lockLocker();
      }
    }
  }

  delay(500);
}

int getDistance() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  return