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

Arduino Mega Fire Fighting Robot with Flame and Ultrasonic Sensors

View and Edit Project In Cirkit DesignerImage of Arduino Mega Fire Fighting Robot with Flame and Ultrasonic Sensors

Fire Fighting Robot Circuit Documentation

Summary

This document provides a detailed overview of a fire-fighting robot circuit. The robot is designed to detect fire using flame sensors and navigate towards the fire using ultrasonic sensors. It then extinguishes the fire using a water pump controlled by a motor driver. The robot is powered by a combination of 9V and 12V batteries, and an Arduino Mega ADK microcontroller is used to control the various components.

Component List

  1. 9V Battery

    • Description: Provides 9V power supply.
    • Pins: +, -
  2. KY-026 Flame Sensor

    • Description: Detects the presence of fire.
    • Pins: A0, GND, VCC, D0
  3. HC-SR04 Ultrasonic Sensor

    • Description: Measures distance to objects.
    • Pins: VCC, TRIG, ECHO, GND
  4. Step Up Boost Power Converter, Adjustable Voltage Regulator

    • Description: Boosts voltage to a required level.
    • Pins: VOUT+, VOUT-, VIN+, VIN-
  5. Rocker Switch (SPST)

    • Description: Simple on/off switch.
    • Pins: 1, 2
  6. Tower Pro SG90 Servo

    • Description: Small servo motor for precise control.
    • Pins: Signal, +5V, GND
  7. Water Pump

    • Description: Pumps water to extinguish fire.
    • Pins: VCC, GND
  8. Battery 12V

    • Description: Provides 12V power supply.
    • Pins: +, -
  9. Motor Driver (L298N)

    • Description: Controls the motors and water pump.
    • Pins: OUT 1, OUT 2, OUT 3, OUT 4, +12V INPUT, GND, +5V OUTPUT, ENA, IN 1, IN 2, IN 3, IN 4, ENB
  10. DC Motor with Encoder

    • Description: Motor with encoder for precise control.
    • Pins: Encoder B, Encoder A, GND, VCC, Motor +ve, Motor -ve
  11. Arduino Mega ADK (Rev3)

    • Description: Microcontroller for controlling the robot.
    • Pins: A0-A15, D0-D53, ICSP, RESET, 3V3, 5V, GND, VIN, USB

Wiring Details

9V Battery

KY-026 Flame Sensor

HC-SR04 Ultrasonic Sensor

Step Up Boost Power Converter, Adjustable Voltage Regulator

Rocker Switch (SPST)

Tower Pro SG90 Servo

Water Pump

Battery 12V

Motor Driver (L298N)

DC Motor with Encoder

Arduino Mega ADK (Rev3)

Documented Code

// Fire Fighting Robot Code
#include <Servo.h>

// Define pins for Motor Driver (L298N)
#define ENA 9
#define ENB 10
#define IN1 7
#define IN2 6
#define IN3 5
#define IN4 4

// Define pins for Encoders
#define ENCODER_A1 2
#define ENCODER_B1 3
#define ENCODER_A2 18
#define ENCODER_B2 19

// Define pins for Flame Sensors
#define FLAME_SENSOR_1 22
#define FLAME_SENSOR_2 23
#define FLAME_SENSOR_3 24

// Define pins for Ultrasonic Sensors
#define TRIG_1 49
#define ECHO_1 48
#define TRIG_2 47
#define ECHO_2 46

// Define pins for Servo Motors
#define SERVO_VERTICAL 11
#define SERVO_HORIZONTAL 13

// Define pins for Water Pump
#define PUMP_ENA 8
#define PUMP_IN1 36
#define PUMP_IN2 38

// Servo objects
Servo verticalServo;
Servo horizontalServo;

// Function to read distance from ultrasonic sensor
long readUltrasonicDistance(int trigPin, int echoPin)