top of page

Coding Project with Roomba & Lego Maze

“Real Obstacles don’t take you in circles. They can be overcome. Invented ones are like

maze.” To improve a child’s cognitive thought process, there is nothing better than a maze. Mazes mimic the real-time scenarios which a child can seemly solve on a fun basis. Legos or blocks are something that children more likely relate to and enjoy which in turn leads to grasping more skills than theoretically teaching them. This coding is the combination of maze solving using coding along with legos playing.

We are going to see in this project, how an obstacle avoiding robot is coded. Roomba is a cleaning robot. In this project, we will explore the obstacle avoidance part of it. In upcoming projects, we will also focus on the cleaning part.


Lego Maze is basically creating a 2D scenario or rather workspace of a maze using legos.

Creating a code to get through the maze is an immensely creative and inventive method to develop a number of skills. The live implementation of this activity in its advanced form is a Roomba. It is a series of autonomous robotic vacuum cleaners. Roomba features a set of sensors that enable it to navigate the floor area of a home and clean it

So, basically it cleans the space, whenever it detects an obstacle - it changes its path and continues its job.

The fundamental rule that we will use is conditional statements. Conditional statements are features of a programming language, which perform different computations or actions depending on whether a programmer, the specified boolean condition evaluates to true or false:

If/Else Statement

  • The if/else statement executes a block of code if a specified condition is true

  • If the condition is false, another block of code can be executed

Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed if the same condition is false.


  • Lego

  • Plastic caps of bottles

  • Glue and Scissor

  • Instruction Tag Sheet (Attached here)

Download the Below Sheets & Print:

Maze icons
Download PDF • 11KB

Maze Icons1
Download PDF • 127KB


Decide a room of your house which you want to create using lego

  1. Create all the furniture of the particular room using lego and position them as per the real-time places

  2. Now, using the instruction sheet, code for the Roomba to clean that particular room

  3. Stick the instruction tags

(Refer the sample project sheet attached)

Learning Opportunity:

Solving mazes boosts a child’s patience and persistence and teaches them about the rewards of work. Herein, a child needs to code in a manner which has its outcomes very efficiently. Solving mazes are wonderful for improving coordination.

Concentrating on a maze also helps with memory too along with developing problem-solving skills.

Using the activity sheet, create your own algorithms and maze structures.

Time Required: 20 minutes

Cost: NIL


In this video, we drew a maze pattern using lego and printed icons which represent the floor plan. Obstacle Avoidance Robot, Roomba follows the path and turn or move around if there is an object found. In addition to this, we have used conditional statements to define its path. Initially, it starts from the same position and comes back to the same position for recharging its battery. One can create its own floor plan and rest Roomba does the job for you.

3,559 views0 comments

Recent Posts

See All


bottom of page