Meta Title: How to Build an Automatic Floor Cleaning Robot Using Arduino: Complete DIY Guide

Meta Description: Learn how to build an automatic floor cleaning robot using Arduino, ultrasonic sensors, motor drivers, water pump, and cleaning brushes. Includes wiring diagrams, bill of materials, circuit diagrams, flowcharts, troubleshooting tips, and complete assembly instructions.

An automatic floor cleaning robot is one of the most practical and impressive Arduino robotics projects you can build. Instead of manually sweeping and mopping floors, this intelligent robot moves autonomously, avoids obstacles, sprays water, and cleans the floor using rotating brushes or a microfiber mop.

This project combines robotics, automation, obstacle detection, motor control, and embedded programming, making it an excellent STEM project, engineering assignment, or smart home automation solution.


Quick Answer: Automatic Floor Cleaning Robot Wiring Diagram

If you want to build the robot immediately, follow the wiring configuration below.

ComponentPinArduino Uno Pin
HC-SR04 Ultrasonic SensorTRIGD9
HC-SR04 Ultrasonic SensorECHOD10
L298N Motor DriverIN1D5
L298N Motor DriverIN2D6
L298N Motor DriverIN3D7
L298N Motor DriverIN4D8
Relay ModuleIND4
Water PumpRelay OutputExternal 12V
Servo MotorSignalD3
BuzzerPositiveD2
Battery Voltage SensorSignalA0

Important: The water pump and drive motors should be powered from an external battery pack. Never connect them directly to the Arduino’s 5V output.

System Workflow

Obstacle Detection → Arduino Processing → Motor Control → Cleaning Brush Rotation → Water Spray → Floor Cleaning → Obstacle Avoidance


https://images.openai.com/static-rsc-4/EWpI5b1wLqnaJkHG01VAyMyyNVpbzLH8hJ1oCEhY9vtWIvKVNMkX9V82BAjVIe6Fe8GD5CshdSlse-PMzut4hwZ_oaVUyRouL4HCav-aDBgYzAFsGF9SunjOnjdxBpYwODI6DuUNdPMtb75d7YbRiu46fqRQeVjqpzWc46cSwWTEOJO5DT14AVHypBFhmo-j?purpose=fullsize
https://images.openai.com/static-rsc-4/NbZTn4UOG9FKj3DrayO3yInSrVWw4EiZCbe4KALpCXrc-QwqWMzGG1UeoODDZVvZRsBSnUoKTWvtNjNOuzNFRfcJiYAO6ErR1A4ORFTAeR9UJF4NgOV8MZ0HXS1Y9OhkV3jFoZiEjWJsimaWipqcYv7PXcs-RhSMTKPbht95pmx3Om0pVg4UjSsls0cuLxTx?purpose=fullsize
https://images.openai.com/static-rsc-4/mPhLxmjLeQIrRxAiEvMIUHX6FK2A9Fl8zN55Tok1oFwqCCBR8UgtO6s5V-I82yDTwL9V_y7TMyFawRL1rF2UoFO8n5zBCvgbxH-MEJovrIz7lnw7xUnrKLnwPjtR2THIk2AxpFHN6huGhng-_hXwAEQrG7NHa-AhQNbpqtJE6nnJ__xNBNTFN38yM5EJImLK?purpose=fullsize

5

Why Build an Automatic Floor Cleaning Robot?

Cleaning floors manually requires time and effort. Autonomous cleaning robots improve convenience by performing routine cleaning without constant human supervision.

Building your own Arduino-based cleaning robot helps you understand robotics, sensor integration, automation, and motor control while creating a practical smart home device.

Benefits

  • Automatically cleans floors
  • Detects and avoids obstacles
  • Saves time and effort
  • Improves home automation
  • Affordable compared to commercial robot cleaners
  • Excellent STEM and engineering project

This project demonstrates how robotics can simplify daily household tasks.


How Does the Automatic Floor Cleaning Robot Work?

The cleaning robot combines several subsystems that work together to clean efficiently.

1. Obstacle Detection

An HC-SR04 ultrasonic sensor continuously measures the distance to objects in front of the robot.

2. Navigation System

The Arduino processes sensor readings and decides whether to move forward, stop, or turn to avoid obstacles.

3. Cleaning Mechanism

A rotating cleaning brush loosens dirt while a microfiber mop wipes the surface.

A small water pump sprays water or cleaning solution ahead of the mop.

4. Motor Control

The L298N motor driver controls the two DC gear motors that move the robot.


https://images.openai.com/static-rsc-4/b6SLUWWdrIrJ8dGQgOOqApNM-JjVjgL7-YRDOsuK-Czd0QkHOduSklItQHTtjIiS1CYg2yFJfSPD7D80A76sOiTy38lMVgalhEvW0byY7Ilt7XWs7JH0Gk29r1PHqMSJ3NK5oNJeWjMxv4SgjOFqeVG9nkiMe0ckKQZEmVuxdKrnVN5sIZjp5FibLpEi_Lgu?purpose=fullsize
https://images.openai.com/static-rsc-4/1kWf0bEkXx3j0rilSYiXENcP4BQCM08U3lqe2hsKyRDHp9mU9u4LqwvPImVXTCiXAjgAO1QrtgelAP8sscr4uCrKhLRoPAXLLXVuzB4qg9LRYU5TGUooZICb-O6QEflKmsJXoct2TE70V6uqNa2UOVLy69aXI1_Gvrz39eJPvgKNNRcJv3R1B7_5ofNdso3j?purpose=fullsize
https://images.openai.com/static-rsc-4/CzvBLrLFacUaihOr2FKaXctx_ydCY2HLpfo4NlhsVISVpE48fJKOjoSUUdVLYCV9Ffcl9wdwcxxf9Wx7pssQOO99zw8pEqvhPLgy59HIv6rWOPoymw-u96LHQlkOsRjHUCStqmXgGs--rGzR1pYIc10yC7oz5HCzQAbuqUAvZk5zo0Igvw3lEICtiQEgGJS-?purpose=fullsize

4

Bill of Materials (BOM)

ComponentQuantityPurpose
Arduino Uno or Nano1Main controller
HC-SR04 Ultrasonic Sensor1Obstacle detection
L298N Motor Driver1Controls drive motors
DC Gear Motors2Robot movement
Robot Chassis1Supports components
Cleaning Brush Motor1Rotates cleaning brush
Microfiber Mop1Wipes floor
Mini Water Pump1Sprays water
Relay Module1Controls pump
Servo Motor1Rotates ultrasonic sensor
Battery Pack (12V)1Main power supply
Wheels2Robot mobility
Castor Wheel1Front support
Jumper WiresSeveralElectrical connections
Water Tank1Holds cleaning solution

Estimated Project Cost

ItemApproximate Cost
Arduino Uno$10
Motor Driver$4
Ultrasonic Sensor$3
Robot Chassis Kit$18
Motors$15
Water Pump$10
Battery$18
Miscellaneous$15

Estimated Total Cost: $75–95


Circuit Connections Explained

Ultrasonic Sensor

  • TRIG → D9
  • ECHO → D10
  • VCC → 5V
  • GND → GND

Motor Driver

  • IN1 → D5
  • IN2 → D6
  • IN3 → D7
  • IN4 → D8

Relay Module

  • IN → D4

Servo Motor

  • Signal → D3

Battery Monitor

  • Analog Output → A0

https://images.openai.com/static-rsc-4/-c3DkTX0kxEueC5AKYxTGlJc0MfYgMYJa5sTtDJxGUXBa5xJuHHAdLI5RtlrRbBOAvj07VpfFCvu0tRtVSksSYyqCeeA58Oos7oga54QshjgMiECFkfh1DNNR0298AAcTXw5m0JH2Zw7BWYF-v1ole2RZJdohtmXK9eSb1hppiVYaKmVASCx9XFpj9igTKmi?purpose=fullsize
https://images.openai.com/static-rsc-4/hLECCL85BpYugrdxCTCq2Qu4gtCzT6APMT9xFAA67FqLg82Q6ZWrL5qLd9_KjjCJR_k4JFw4DCvNPGwxinDWqwoTVdC_0AeqxURsPek0eFPKJBGHNssuChxZZpzg-HYHUxBM7bb6WUq5d-01JBcevrHo42anF3GyGKBFRozaPJlnDtvGlISsRP0UYPcwKXAy?purpose=fullsize
https://images.openai.com/static-rsc-4/EGbZHlzyfPq4fBiFTdVUpzopkJXryxhtJD6Kw_Y41QPg_oLsBmHrgl8yd7MesAZRRWrpMkc1w_xSToomj4joegf2nstbG-i65-EoLmtMt0c49A8g16o_yaYt6CqbJWuuj84yiLX3hmyE1PLEi5ev3SijhGtw4tqxNMHDVbg9b6ImllZeT7ld9BSqYgmYKs_f?purpose=fullsize

6

Step-by-Step Guide: How to Build an Automatic Floor Cleaning Robot Using Arduino

Step 1: Assemble the Robot Chassis

Install the DC motors, wheels, and castor wheel.

Ensure the chassis is balanced before mounting electronic components.


Step 2: Install the Cleaning System

Attach the rotating brush beneath the chassis.

Install the microfiber mop behind the brush.

Mount the water tank securely above the pump.


Step 3: Install the Ultrasonic Sensor

Mount the HC-SR04 sensor at the front of the robot.

For improved navigation, mount it on a servo motor to scan left and right.


Step 4: Connect the Electronics

Wire all components according to the wiring table.

Verify polarity and motor connections before powering the system.


Step 5: Upload the Arduino Program

The Arduino software should perform the following tasks:

  • Measure obstacle distance.
  • Drive the motors.
  • Activate the cleaning brush.
  • Turn the water pump ON.
  • Avoid obstacles automatically.

Example program logic:

Start

↓

Initialize Sensors

↓

Measure Distance

↓

Obstacle?

↓

YES → Turn Left or Right

↓

NO → Move Forward

↓

Brush ON

↓

Pump ON

↓

Repeat

Step 6: Test the Robot

Place the robot on a smooth floor.

Verify that:

  • It moves forward smoothly.
  • It detects obstacles.
  • It changes direction automatically.
  • The cleaning brush rotates.
  • The pump sprays water.
  • The mop cleans the floor effectively.

https://images.openai.com/static-rsc-4/IEFyHZSqNjJWsgRklgBJRCXw78t6QcTq8gMm1OQ0pHxIn_5bzBNIweFoXn934I7TaIhR2xRe5K6JcOjHoxBXX4vApjx7IFyIBiMufGmIzbrG2URa2EEl3R0WAZMw_KfSUkPacpUYPiO9cMwocbmQdEEQ_E3JBAXasnYZmqBnfQabc6EKxru4WkDC7WNX1Mr7?purpose=fullsize
https://images.openai.com/static-rsc-4/NbZTn4UOG9FKj3DrayO3yInSrVWw4EiZCbe4KALpCXrc-QwqWMzGG1UeoODDZVvZRsBSnUoKTWvtNjNOuzNFRfcJiYAO6ErR1A4ORFTAeR9UJF4NgOV8MZ0HXS1Y9OhkV3jFoZiEjWJsimaWipqcYv7PXcs-RhSMTKPbht95pmx3Om0pVg4UjSsls0cuLxTx?purpose=fullsize
https://images.openai.com/static-rsc-4/BHHbv8mHlHJYKz6SuGWxu7kvCT_IlGHNlWY20rhftbXWHnixIZZMxWHX7fwElkHoup82av43RTP5KtH7vbrfwSFfXw0I_JKJA2Pfcd2aWhOr8VaFAkb-pyyEv_UvWzkiKKqKHk3MGCJz7_0krYMlv8fFc7-f6zOUc9neiIUv1BP1cwbjOxAiAzDI0ceAVxqr?purpose=fullsize

5

Arduino Program Logic

The Arduino continuously executes the following sequence:

  1. Read ultrasonic sensor values.
  2. Detect nearby obstacles.
  3. Decide movement direction.
  4. Control DC motors.
  5. Rotate cleaning brush.
  6. Activate water pump.
  7. Continue cleaning until stopped.

This feedback loop enables fully autonomous floor cleaning.


Applications

This cleaning robot can be used in:

  • Homes
  • Offices
  • Schools
  • Hospitals
  • Hotels
  • Shopping malls
  • Laboratories
  • Smart buildings

Advantages and Limitations

Advantages

  • Fully automatic cleaning
  • Obstacle avoidance
  • Water-saving operation
  • Affordable DIY project
  • Expandable with Wi-Fi and AI

Limitations

  • Limited battery life
  • Small water tank capacity
  • Basic navigation compared to commercial robots
  • Requires regular brush maintenance

Safety Tips

  • Keep electrical components away from water leaks.
  • Disconnect power before maintenance.
  • Avoid cleaning highly uneven surfaces.
  • Secure all wiring before testing.
  • Use only low-voltage DC power supplies.

Frequently Asked Questions

Can I Add Wi-Fi Monitoring?

Yes. Replace the Arduino Uno with an ESP32 for Wi-Fi connectivity and remote control using platforms like Blynk or MQTT.

Can the Robot Vacuum Dust?

Yes. You can add a miniature vacuum fan and dust collection chamber.

Can It Return to a Charging Station?

Yes. By adding infrared beacons or charging contacts, you can develop an automatic docking system.

Can It Map Rooms?

Yes. Integrating LiDAR or vision sensors enables simultaneous localization and mapping (SLAM).


How to Fix Common Arduino Upload Errors

Error: “avrdude: stk500_recv(): programmer is not responding”

Solutions

  • Select the correct COM port.
  • Disconnect modules connected to RX/TX.
  • Replace the USB cable.
  • Restart the Arduino IDE.

Error: Robot Does Not Move

Solutions

  • Check battery voltage.
  • Verify motor driver wiring.
  • Test each motor individually.

Error: Ultrasonic Sensor Reads Incorrect Distances

Solutions

  • Mount the sensor securely.
  • Remove objects blocking the sensor.
  • Check TRIG and ECHO connections.

Error: Water Pump Does Not Start

Solutions

  • Test the relay separately.
  • Verify the external power supply.
  • Check pump polarity.

Error: Robot Continuously Hits Obstacles

Solutions

  • Increase obstacle detection distance.
  • Improve servo scanning angle.
  • Adjust turning delay values.

https://images.openai.com/static-rsc-4/Ol6zxzbL6qb2SeEMTTUBOZqWR3tZPtJtbKTimtC1RdgrmGhldhdnMajQgTUI9dtrZjQ6MhFpEwNqz6ZXNBr1qJT2_ML0cHwNugsUnzRkDfUJQUXEi8SufGEGvxDPxcXa-V69WrauoPSd0Wpd6xa2NaevorOJIYfOsxRNpJZu6ALOa9JxyEE_-Y0_aqUZKJa3?purpose=fullsize
https://images.openai.com/static-rsc-4/5-xPQePB2Wa4fR9PjU8eStxkaD4l-jGccgrz7Sn9n18NeLofqOy0LvgoPZHkekCAWpeD8Ks90ybciByaRzLVCmjZrOmzNkOABc1ai-hSAgeXvv8y1Iv8m4Ha1tbSSpCyIycB_ZTzMSdcCJy68-20n48TaUsZj0-GLKs2mjJpYcEzfi-fLKGZzIoYX0XAnyU0?purpose=fullsize
https://images.openai.com/static-rsc-4/1om3d3ktQRxEFKo2onB7VA7gWot6r85LJ8cnUuwDdCKZ8cMP0ce-jbDX52GKqDgLVyGwka5_m-BE_EdhWy2r7aHnEltfHIcq-P48O5erVkhdbfKPLn8g7bu1MMQEmv9-Pwuwn-wv0I91RH7DFipuW_9Lab5BRVdTlogtUeDU0Xs4Kd0UO4Qmf9_avUO91rKK?purpose=fullsize

5

Final Thoughts

Learning how to build an automatic floor cleaning robot using Arduino is an excellent way to explore robotics, automation, and smart home technology.

By combining ultrasonic obstacle detection, motor control, water spraying, and autonomous navigation, you can build a practical robot capable of cleaning indoor floors with minimal human intervention.

As your skills advance, you can enhance the robot with ESP32-based Wi-Fi control, camera vision, AI object recognition, LiDAR navigation, automatic charging, and mobile app integration, creating a next-generation intelligent cleaning robot suitable for advanced research and real-world applications

  • mbeva

    Dominic Mbeva is a science teacher, experienced researcher, innovator, and creative technologist with expertise in STEM education, digital media, and scientific research. As a Kenya Science and Engineering Fair (KSEF) advisor and projects manager, he mentors young scientists, guiding them in developing award-winning innovations. He is also an IC Technorat, leading advancements in science and technology. Beyond education, Dominic is a skilled photographer and video editor, using visual storytelling to make science more engaging. His philosophy, “If you take care of minutes, hours will take care of themselves,” reflects his belief in consistent effort, strategic thinking, and innovation to drive success in both research and creativity.

    Related Posts

    How to Make an Automated Electric Anti-Theft System

    How to Make an Automated Electric Anti-Theft System Project Title Design and Construction of an Automated Electric Anti-Theft Security System Using Arduino and Motion Sensors Project Images System Components Main…

    Read more

    How to Build a Fingerprint Door Lock System Using Arduino

    Fingerprint-based security systems are becoming increasingly popular in schools, homes, offices, and laboratories because they provide higher security than traditional keys and passwords. In this project, you will learn how…

    Read more

    Leave a Reply

    Your email address will not be published. Required fields are marked *