How to make a vacuum cleaner Xiaomi with your own hands: full instruction

The question of how to make a vacuum cleaner Xiaomi, often arises among electronics enthusiasts who want to build their own smart device from scratch, using the popular ecosystem of Mi Home. Of course, to create a full-fledged industrial product like Xiaomi Vacuum Cleaner at home is impossible because of the complex engineering and casting cases, but to assemble a functional counterpart based on ESP32 controllers or Raspberry Pi is a very real task. This will allow you not only to save on the purchase of an expensive gadget, but also to get full control over the code.

A homemade robot vacuum cleaner integrated into the smart home network will be a great project to learn the basics of robotics and IoT. You will develop chassis, select engines, adjust the navigation system and, most importantly, write or adapt software to communicate with Xiaomi servers. In this article, we will discuss all the stages of creating such a device, from the selection of components to final debugging.

Before you start building, it is important to understand that the result will differ from factory models in the level of autonomy and cleaning quality. However, the custom solution provides unique features that are not available in serial devices, for example, using proprietary algorithms for bypassing obstacles or custom sensors. The key is to choose the right platform for emulating Xiaomi protocols, since without this integration into the application is impossible.

Component selection and hardware platform

The core of any robot is its brain and its muscles. You'll need a single board computer or a powerful microcontroller to do this. The Raspberry Pi 3 or 4 is the best option, because you can deploy a full-fledged Linux operating system, which is necessary for complex scripts and control servers. If you want a simpler solution, you can use the ESP32 bundle for motor control and the Arduino for sensors, but the functionality will be limited.

Motors with gearboxes are needed to drive. Direct current motors with encoders are best suited to accurately track the speed of the wheels. Factory Xiaomi models often use brushless motors, but for a homemade project, there are enough high-quality collector analogues with a 12 Volt supply voltage. Don't forget about motor drivers, for example, a module based on L298N or TB6612FNG, which will control the direction and speed of rotation.

  • ๐Ÿค– Controller: Raspberry Pi 4 (2GB or 4GB) for data processing and Wi-Fi communications.
  • โšก Motor Driver: Dual-channel Module TB6612FNG chassis.
  • ๐Ÿ”‹ Power: Lithium-ion batteries 18650 (minimum 4 pieces) and the fee BMS protect.
  • ๐Ÿ“ก Sensors: Lidar (optional), IR distance sensors and drop sensors (cliff sensors).

โš ๏ธ Warning: When assembling the power unit, use sufficient cross-section wires. Thin wires may overheat and cause short circuits, causing the controller to fail or the battery to catch fire.

The device can be printed on 3D-It's important to have space for all the components to be attached and to have access to the ports for debugging, and you'll need a turbine to create a vacuum. at home often use powerful fans from computer equipment or car turbines, adapting them to the air flow.

Assembly of mechanical part and chassis

The assembly starts with the wheelbase mounting. If you're using a two-wheel drive circuit and one-wheel drive circuit, make sure that the center of gravity is directly above the axis of the drive wheels. This is critical for the stability of the movement and the operation of the gyroscope. The support wheel must rotate freely so that the robot can turn in place without jamming.

Motor fastening must be rigid so that vibrations are not transmitted to sensors and the camera (if any). Use rubber gaskets or shock absorbers between the motors and the frame. To clean the dust, you need to assemble a suction assembly: the turbine is mounted above the garbage container, creating a discharge that draws air through the brush.

โ˜‘๏ธ Mechanical check

Done: 0 / 4

Pay special attention to the bottom of the robot, and you need to have cliffs that prevent you from falling down stairs, usually IR sensors that point down, and you need to have the sensor-to-floor distances that you can do experimentally, so that you can respond to the elevation changes, but you can ignore the dark mats, unless they're an obstacle.

ComponentAppointmentInstallation requirements
Drive wheelsRelocationHard fixation, lack of backlash
TurbineDust absorptionSealed connection to the container
Side brushRaiding up garbage2-3 mm gap from the floor
IR sensorsFall protectionDirected strictly down, clean lenses

Electronics and circuitry

The electrical circuitry of the homemade vacuum cleaner must be reliable and safe. The main power is supplied to motor drivers and control boards through the BMS (Battery Management System) protection system. This prevents deep battery discharge and protects against overload. To power the Raspberry Pi or ESP32, you need a quality reduction converter (DC-DC), which produces a stable 5 volts.

All components are better connected using connectors to be able to quickly turn off the nodes for diagnostics. All lines of force must be insulated by shrinkage. If you use lidar, it should be placed on an elevated level so that it can rotate without obstruction and scan the room 360 degrees.

  • ๐Ÿ”Œ BMS Fee: Mandatory for lithium batteries, balances the charge of cells.
  • ๐Ÿ“‰ DC-DC Converter: Converts 12V from batteries to 5V for logic.
  • ๐Ÿ”Œ Connectors: Use XT60 feeding JST signal-line.
  • ๐Ÿ›ก๏ธ Safety: Install a fuse at the motor power input.

โš ๏ธ Warning: Never connect motor power lines directly to microcontroller logic lines, guaranteed to cause the processor to burn due to voltage surges.

Use a relay or a vacuum pump to control the vacuum pump. MOSFET-transistor controlled GPIO-This will allow you to programmatically adjust the suction power, switching between the modes of Quiet, Standard and Turbo, as in the original Xiaomi devices.

Software and firmware

The hardest part of the project is the software, and in order for your robot to become part of the Xiaomi ecosystem, it must be able to communicate with the cloud or local server using the protocols used by the manufacturer, most often using the Home Assistant platform with Xiaomi Mi Robot Vacuum integration or writing its own code in Python emulating the device.

You'll need to install an operating system (like Raspbian) and customize your environment. A key element is a script that queries sensors, controls motors through GPIOs, and sends statuses to an application. There are open source projects like VacuumZ or OpenMower that can be adapted to their own hardware.

Difficulties with encryption protocols
Xiaomi uses encryption to connect devices to the cloud, and homemade devices most often emulate local connectivity or use modified firmware versions that send data to their intermediary server and from there to the Mi Home app.

SLAM (Simultaneous Localization and Mapping) algorithms are used for navigation, if the lidar is installed. In a simplified version, the robot can operate a chaotic algorithm, changing direction when it encounters an obstacle. The code must include processing interruptions from impact and fall sensors in real time.

An example of the simplest pseudocode for moving forward



def move_forward():




set_motor_speed(left_motor, 100)




set_motor_speed(right_motor, 100)




if obstacle_detected():




stop()




turn_right(90)

Integration into a smart home and management

Once the robot has learned to ride and suck dust, you have to teach it to listen to commands from a smartphone, and the easiest way is to use the Home Assistant platform, you set up the integration, add your device as a Generic MQTT Vacuum, and then sprinkle it into HomeKit or Yandex Home through a plugin.

If your goal is to see a device in the Mi Home app, it becomes more difficult: you need to get device tokens, register your device on the Xiaomi developer server (IoT Platform), and get certificates, which requires a deep knowledge of network protocols and cryptography.

  • ๐Ÿ“ฑ Mi Home App: Official management app (requires complex emulation).
  • ๐Ÿ  Home Assistant: The Best Choice for Local Management Without Cloud.
  • ๐Ÿ—ฃ๏ธ Voice Assistants: Integration through Alice or Siri Shortcuts.
  • ๐ŸŒ MQTT: Protocol for Telemetry and Command Transmission.
๐Ÿ“Š What kind of management do you prefer?
Official Mi Home appendix
Home Assistant
Your web interface
Voice control

Remember to set up automation scenarios, such as starting a cleanup when everyone left home, or returning to base when the battery is low, and implementing a return to base will require either an IR beacon or an accurate map of the room with the coordinates of the charger.

System testing and debugging

The first run is always on weight. Lift the robot, turn on the power, and check the motors' response to the commands. Make sure the wheels spin in the right direction when you say "forward." If the robot is going backwards when you say "forward," just swap the wires on the motor driver or invert the logic in the code.

Then run tests on the floor. Check the drop sensors: hold the robot to the edge of the sofa or step, it should stop 5-10 cm to the edge. Also check the vacuum system: put a piece of paper to the brush, it should be tightly pressed by the air flow.

โš ๏ธ Warning: Do not leave the robot unattended in the first tests, it may become entangled in wires, get stuck under furniture, or, in the worst case, catch fire due to an error in the engine control code.

The final step is a long battery life, so you run the robot on full charge and track how it uses energy, and if the battery goes down too fast, maybe the motion algorithms are inefficient, or the motors are consuming too much current because of friction in the machinery.

๐Ÿ’ก

The success of the project depends not so much on the power of the motors, but on the quality of navigation algorithms and the stability of the software that manages energy saving.

Frequently Asked Questions (FAQ)

Can I refashion the original Xiaomi vacuum cleaner into my own?
Theoretically yes, if you have access to the UART-It's a port inside the device, and you know the architecture of the processor, but it's very difficult because manufacturers block bootloaders. It's easier to build the device from scratch on open platforms.
What budget is needed to build such a robot?
The cost of components (Raspberry Pi, motors, batteries, sensors, plastic) can be from 100 to 200 dollars, which is comparable to the price of budget models Xiaomi, so the economic sense is only for educational purposes.
Do you need lidar for normal work?
Lidar is not necessary for chaotic cleaning, gyroscopes and rangefinders are enough, but for mapping and efficient navigation of rooms, a laser scanner (Lidar) is highly desirable.
Is it safe to use homemade batteries?
Only if you use a quality BMS board and adhere to the rules of soldering lithium cells.Incorrect battery assembly can lead to a fire, so take this seriously.