How to build an automatic cleaner v2.0
For many years, people have been filling their home with devices that are based on Microcontrollers, like virtual assistants, smart fridges, washing machines, security systems, and many others that can be either programmable, or even replicated with a couple of boards and our Python knowledge.
When learning and using Python for automation, we usually write applications that can help us on computer related tasks, like downloading things, open programs, generating documents, etc, but Python gives us the opportunity to automate things beyond our computers.
Before to start…
This cleaner v2.0 is a prototype for testing the functionality using a beginner friendly approach. This will not be the final design / implementation.
Let’s start…
Step 1: What Do We Need ?
Materials:
*Note:This is not a product placement.*- Ultrasonic distance sensor (HCSR04) (brand:)
- Servo motor (brand:)
- wheels, motors and structure (brand:robotdf)
- batteries AA (5V and 3.3 V) or other kind of battery
- mop (brand:up to your preferences)
- warm glue
- Microcontroller (CPX) (brand: Adafruit)
- Crickit (brand: Adafruit)
- Optional:
Maybe some soldering could be needed if the cables are not connected to the motor. Be sure before buy any material
Step 2: How should I start?
✨ Trying different componentsstep by step. In our system we have different challenges:
- A. Robot structure
- B. Wheels Motor
- C. Ultrasonic distance sensor
- D. Microcontroller and programming
A. Robot structure:
This depends on your choice but if you decide to go for the same as I used…It is a Mobile Robot Platform, it is easy to build and ensemble.
✨ Be sure that all the components are well assembled.
B. Wheels motors:
✨ Start designing and then programming the robot movements.
It is important to consider how your robot will react to obstacles. Each decision and situation needs to be programmed by us.
C. Ultrasonic distance sensor:
✨ The ultrasonic distance sensor measurements could be affected by the temperature and the environmental humidity. It is recommended to test the distance that perceive with some measurement tool.
D. Microcontroller and programming
The microcontroller chose for this project was a Circuitplayground Express (CPX). This project is aimed to be beginner-friendly and this microcontroller is a great option for it, because it contains a large amount of sensors and options (see below). Also no soldering is needed. It is great for experimentation and learning.
Official documentation: Adafruit Circuit Playground Express
What about the Programming language?
We will run CircuitPython in our CPX board. This version of Python is beginner friendly because it is easy to install and it is possible drag and drop code on the CIRCUITPY drive.
Official documentation: CircuitPython
crickit for Circuit Playground Express
What about the Programming logic?
I tried different behaviours, velocity and movements until I decided to apply the following logics:
✨ I truly recommend you to do that and have hours of fun!
code
Let´s talk about the code. In this case I prefer to link the code to the repo because I tried to coment the logic directly there.
The cleaner and other robots?
If you wonder.. how is this robot interacting with other objects, the answer is depends on the object, the size and the position of the object. In general, works really good, but sometimes the robot cleaner doesn´t care of other robots :)!