Garden Helper Roomba Bot

This instructable will teach you how to program a Roomba Bot, using MATLAB, to navigate through a garden, detecting circular-shaped fruits/vegetables that are ripe enough to be picked based on their size. This robot also sends you an email, alerting you how many fruit are ready to be picked and the path in which it traveled.

Features:

Uses light sensors to detect walls and turn slightly in order to avoid hitting them

Uses bump sensors in order to break the program when it hits the rock at the end of the garden

Uses image processing to detect a circle in the garden and then determine its radius

Uses cliff sensors to detect a colored tape that indicates the presence of a fruit

Step 1: Materials and Supplies:

One Laptop

MATLAB 2017

Roomba Vaccum Cleaner

Raspberry Pi

Wood Blocks

White Paper

Black Paper

Colored tape/thin strip of colored paper

Large Rock

Step 2:

Step 3: Assembling Your "Garden"

Take your black paper and cut circles of various sizes

Tape these black circles onto a large white paper

This contrast will be necessary when detecting a fruit

Use your woodblocks to construct a maze-like garden path for your robot to navigate

We chose a U-shaped path as pictured above

At the end of your garden add a rock or door or another object for your robot to know it is done

Tape your white paper with the circle onto the walls of the garden

We used buckets to tape it to because our walls were too short for the camera

Put colored tape/thin strip of colored paper on the ground in front of the fruit

Step 4: Writing the Code

Navigating the Garden

Using Bump Sensors: To run the program, we place the coding in a while statement that loops through various if statements until the code is broken. If any of the bumpers are hit, it will result in their value equaling true (which in Boolean is a value of 1). An if statement is used to break the code when one of their values equals 1.

Using Cliff Sensors: Within the while statement, we use an if statement to tell the Roomba when it has arrived at the location of a plant. The Roomba detects the colored tape on the floor by examining the threshold of red that the cliff sensors pick up. If the left or right cliff sensor detects a color with a greater threshold than that of the ground, then it will stop the robot for 2 seconds (using pause command). During these 2 seconds, the Roomba will take and display an image of the fruit. Using the imfindcircles built in command, set a range for your circles' radii, and your Roomba will find your so-called fruit.

Using Image Processing: Within the if statement, we embed another if statement that says: if the radius detected,radii3, is greater than or equal to our minimum requirement of a ripe fruit, r1 (you decide this), then count and display on the Roomba how many fruit are ready and turn to continue through the garden. If not, the turn to continue through the garden. Note: you may need to adjust the angle that you turn because every Roomba is different

Using Light Bumpers: In another if statement, the light bumpers are analyzed to be sure none of them become greater than our determined threshold. If either the left, right, left center, right center, left front, or right front light bumper goes above the threshold, then the Roomba will turn slightly in the appropriate angle to avoid hitting a wall. Hence, navigating the maze.

The rest of the code is used to plot the path taken by the Roomba and then send the results to your email

Step 5: Copy the Code

% Purpose: Based on their sizes the roomba will go through a garden and distinguish vegetables/fruits that are ready to be picked up. % Inputs: Lightbump sensors, Cliff sensors, Bump sensors, image from camera % Outputs: Whenever light sensors are greater than threshold the roomba will turn and take an image, beeps if the radius of % vegetables/fruits is between a specific range. The code breaks when roomba bumps into % an object, sends the astronaut an email about how many fruits are ready to be % picked up and a mapping of the roomba's movement. % Usage: If and while statements, plotting commands,email code from MATLAB