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

Arduino Mega 2560 Autonomous Cleaning Robot with Ultrasonic Sensors and Bluetooth Control

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Autonomous Cleaning Robot with Ultrasonic Sensors and Bluetooth Control

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to control multiple DC motors, a water pump, and ultrasonic sensors using an Arduino Mega 2560. The circuit also includes a Bluetooth module for wireless communication and a power distribution board for managing power supply. The system is capable of both manual and autonomous operation modes.

Component List

  1. DC Mini Metal Gear Motor

    • Description: Small DC motor with metal gears.
    • Pins: IN1, IN2
  2. Rocker Switch

    • Description: A simple on/off switch.
    • Pins: 1, 2
  3. HC-SR04 Ultrasonic Sensor

    • Description: Ultrasonic distance sensor.
    • Pins: VCC, TRIG, ECHO, GND
  4. L298N DC Motor Driver

    • Description: Dual H-Bridge motor driver.
    • 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
  5. Water Pump

    • Description: Small water pump.
    • Pins: +, -
  6. My Battery Case

    • Description: Battery holder.
    • Pins: +, -
  7. HC-05 Bluetooth Module

    • Description: Bluetooth communication module.
    • Pins: Key, VCC, GND, TXD, RXD, State
  8. LM2596 Step Down Module

    • Description: Voltage step-down converter.
    • Pins: OUT-, OUT+, IN-, IN+
  9. Resistor

    • Description: Resistor with specified resistance.
    • Pins: pin1, pin2
    • Properties:
      • Resistance: 330 Ohms
      • Resistance: 200 Ohms
  10. Pushbutton START

    • Description: Pushbutton switch.
    • Pins: NC, NO
  11. INA219

    • Description: Current and power monitor.
    • Pins: VCC, GND, SCL, SDA, VIN -, VIN +
  12. Power Distribution Board

    • Description: Board for distributing power to multiple components.
    • Pins: Output 1+, Input +, Input -, Output 2+, Output 2-, Output 3+, Output 4+, Output 5+, Output 1-, Output 4-, Output 3-, Output 5-, Output 6+, Output 6-, Output 7+, Output 7-, Output 8+, Output 8-, Output 9+, Output 9-, Output 10+, Output 10-, Output 11+, Output 11-, Output 12+, Output 12-, Output +, Output -
  13. Arduino Mega 2560

    • Description: Microcontroller board.
    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D21/SCL, D20/SDA, D19/RX1, D18/TX1, D17 PWM/RX2, D16 PWM/TX2, D15/RX3, D14/TX3, D0 RX0, D1 TX0, D2 PWM, D3 PWM, D4 PWM, D5 PWM, D6 PWM, D7 PWM, D8 PWM, D9 PWM, D10 PWM, D11 PWM, D12 PWM, D13 PWM, AREF, SDA, SCL, D52, D50, D48, D46, D44, D42, D40, D38, D36, D34, D32, D30, D28, D26, D24, D22, D53, D51, D49, D47, D45, D43, D41, D39, D37, D35, D33, D31, D29, D27, D25, D23

Wiring Details

DC Mini Metal Gear Motor

Rocker Switch

HC-SR04 Ultrasonic Sensor

L298N DC Motor Driver

Water Pump

My Battery Case

HC-05 Bluetooth Module

LM2596 Step Down Module

Resistor

Pushbutton START

INA219

Power Distribution Board

Arduino Mega 2560

Code Documentation

#include <Wire.h>
#include <Adafruit_INA219.h>

// Pin definitions
const int motorR = 2;  // L298N IN1
const int motorL = 3;  // L298N IN2
const int motorF = 4;  // L298N IN3
const int motorB = 5;  // L298N IN4
const int brushMotor = 6;  // L298N IN1 (secondo L298N)
const int pumpMotor = 7;  // L298N IN3 (secondo L298N)
const int trigPinFront = 22;  // Front ultrasonic sensor trigger
const int echoPinFront = 23;  // Front ultrasonic sensor echo
const int trigPinBack = 24;  //