This circuit is designed to control a robotic cleaning system equipped with multiple sensors and actuators. The system is powered by a 12V battery and is controlled by an Arduino Nano microcontroller. The circuit includes motor and wheel assemblies for movement, a 5V mini water pump for wet cleaning, water level and dust sensors for environmental monitoring, and multiple HC-SR04 ultrasonic sensors for obstacle detection and navigation. A L293D motor driver is used to control the motors, and an I2C LCD screen provides a user interface for mode selection and status display.
+
, -
vcc
, GND
positive pin
, negative pin
SIG
, VCC
, GND
D8
, 5V
, GND
VCC
, TRIG
, ECHO
, GND
B1
, B2
, A1
, EN_B
, EN_A
, A2
, GND
, VCC
, +
, -
, MPIN_1
, MPIN_2
, MPIN_3
, MPIN_4
D1/TX
, D0/RX
, RESET
, GND
, D2
, D3
, D4
, D5
, D6
, D7
, D8
, D9
, D10
, D11/MOSI
, D12/MISO
, VIN
, 5V
, A7
, A6
, A5
, A4
, A3
, A2
, A1
, A0
, AREF
, 3V3
, D13/SCK
SCL
, SDA
, VCC
, GND
+
to Arduino Nano VIN
-
to common ground netvcc
to L293D Motor Driver MPIN_x
(where x is the respective motor pin number)GND
to common ground netpositive pin
to Arduino Nano D13/SCK
negative pin
to common ground netSIG
to Arduino Nano A3
VCC
to common 5V netGND
to common ground netD8
to Arduino Nano D12/MISO
5V
to common 5V netGND
to common ground netVCC
to common 5V netTRIG
to respective Arduino Nano digital pins (D3
, D5
, D8
, A1
)ECHO
to respective Arduino Nano digital pins (D2
, D4
, D7
, A0
)GND
to common ground netB1
, B2
, A1
, A2
to respective Arduino Nano pins (A6
, A7
, D10
, D9
)EN_B
, EN_A
to Arduino Nano pins (D11/MOSI
, D6
)GND
to common ground netVCC
, +
to common 5V net-
to common ground netVIN
connected to Battery 12V +
GND
to common ground net5V
to common 5V netSCL
to Arduino Nano A5
SDA
to Arduino Nano A4
VCC
to common 5V netGND
to common ground net#include <NewPing.h> // Import libraries for ultrasonic sensors
#include <LiquidCrystal_I2C.h> // I2C LCD library
#include <Wire.h> // I2C library
// Initialize pin numbers for ultrasonic sensors and motor control
const int echo_L = 2; const int trig_L = 3;
const int echo_M = 4; const int trig_M = 5;
const int echo_R = 7; const int trig_R = 8;
const int echo_Crack = A0; const int trig_Crack = A1;
const int dustSensorPin = A2; // Dust sensor
const int waterLevelPin = A3;
const int L1 = 6; const int L2 = 9;
const int R1 = 10; const int R2 = 11;
const int pump = 13; // Pump control for wet cleaning
// Additional variables and constants
int motor_speed = 255;
int max_distance = 200;
int distance_L = 0; int distance_M = 0;
int distance_R = 0; int distance_Crack = 0;
bool isWetCleaning = false;
bool isWaterLow = false;
unsigned long lastPumpTime = 0;
// Initialize ultrasonic sensors and LCD
NewPing sonar_L(trig_L, echo_L, max_distance);
NewPing sonar_M(trig_M, echo_M, max_distance);
NewPing sonar_R(trig_R, echo_R, max_distance);
NewPing sonar_Crack(trig_Crack, echo_Crack, max_distance);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// Setup pin modes and initial states
pinMode(L1, OUTPUT); pinMode(L2, OUTPUT);
pinMode(R1, OUTPUT); pinMode(R2, OUTPUT);
pinMode(pump, OUTPUT);
digitalWrite(L1, LOW); digitalWrite(L2, LOW);
digitalWrite(R1, LOW); digitalWrite(R2, LOW);
digitalWrite(pump, LOW);
lcd.begin(16, 2); lcd.print("Choose Mode");
Serial.begin(9600);
delay(2000);
}
void loop() {
// Mode selection and sensor reading logic
// Movement control and wet cleaning logic
// Dust detection and water level checking
// Functions for moving the robot and controlling the pump
}
// Functions for reading sensors and controlling actuators
// Detailed function implementations are omitted for brevity
The code provided is a high-level overview of the embedded software running on the Arduino Nano. It includes initialization of sensors and actuators, setup of pin modes, and the main loop with logic for mode selection, movement control, sensor reading, and actuator control. Functions for reading sensors, moving the robot, and controlling the pump are declared and used within the loop.