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

ESP32-Controlled Missile Launching System with L298N Motor Driver and Servo

View and Edit Project In Cirkit DesignerImage of ESP32-Controlled Missile Launching System with L298N Motor Driver and Servo

Circuit Documentation

Summary

This circuit is designed to control a missile launching system. It includes components for managing the rotation and elevation of the base, a rack-and-pinion mechanism for pulling the missile, and a servo motor for launching. An LED indicator signals readiness for launch. The system is controlled by an ESP32 microcontroller.

Component List

  1. L298N DC Motor Driver

    • Description: Dual H-Bridge motor driver for controlling DC motors.
    • Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
  2. 12V Power Supply

    • Description: Provides 12V power to the circuit.
    • Pins: +, -
  3. 12V Geared Motor

    • Description: DC motor with a gearbox for increased torque.
    • Pins: Terminal 1, Terminal 2
  4. Two Channel Relay 5V

    • Description: Relay module for switching high-power devices.
    • Pins: VCC, IN2, IN1, GND, NC2, C2, NO2, NC1, C1, NO1
  5. ESP32

    • Description: Microcontroller with Wi-Fi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
  6. Servo

    • Description: Servo motor for precise control of angular position.
    • Pins: GND, VCC, PWM
  7. LED: Two Pin (green)

    • Description: Green LED for indicating system status.
    • Pins: cathode, anode
  8. Resistor

    • Description: 200 Ohms resistor.
    • Pins: pin1, pin2

Wiring Details

L298N DC Motor Driver

12V Power Supply

12V Geared Motor

Two Channel Relay 5V

ESP32

Servo

LED: Two Pin (green)

Resistor

Code Documentation

/*
 * This Arduino Sketch controls a missile launching system.
 * It manages the rotation and elevation of the base, the rack-and-pinion
 * mechanism for pulling the missile, and the servo motor for launching.
 * An LED indicator signals readiness for launch.
 */

// Pin definitions
const int motorBaseENA = 13;
const int motorBaseIN1 = 12;
const int motorBaseIN2 = 14;
const int motorElevIN3 = 27;
const int motorElevIN4 = 26;
const int motorElevENB = 25;
const int relayIN1 = 18;
const int relayIN2 = 4;
const int ledPin = 19;
const int servoPin = 5;

#include <Servo.h>
Servo servo;

void setup() {
  // Initialize pins
  pinMode(motorBaseENA, OUTPUT);
  pinMode(motorBaseIN1, OUTPUT);
  pinMode(motorBaseIN2, OUTPUT);
  pinMode(motorElevIN3, OUTPUT);
  pinMode(motorElevIN4, OUTPUT);
  pinMode(motorElevENB, OUTPUT);
  pinMode(relayIN1, OUTPUT);
  pinMode(relayIN2, OUTPUT);
  pinMode(ledPin, OUTPUT);
  servo.attach(servoPin);

  // Start the system
  digitalWrite(motorBaseENA, HIGH);
  digitalWrite(motorBaseIN1, HIGH);
  digitalWrite(motorBaseIN2, LOW);
  delay(1000); // Rotate base for 1 second
  digitalWrite(motorBaseIN1, LOW);
  digitalWrite(motorBaseIN2, LOW);

  // Adjust elevation
  digitalWrite(motorElevENB, HIGH);
  digitalWrite(motorElevIN3, HIGH);
  digitalWrite(motorElevIN4, LOW);
  delay(1000); // Adjust elevation for 1 second
  digitalWrite(motorElevIN3, LOW);
  digitalWrite(motorElevIN4, LOW);

  // Engage rack-and-pinion
  digitalWrite(relayIN1, HIGH);
  delay(1000); // Pull missile for