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)