Roomba robots are a fun and easy way to dip your toes in the world of robotics. In this Instructable, we will detail how to convert a simple Roomba into a controllable rover that simultaneously analyzes its surroundings.
2.) Roomba (with vacuum cleaning parts removed)
3.) Raspberry-pi contoller
4.) Arduino controlled camera
5.) Optional butter knife
Step 1: Attain Roomba Toolboxes
Run the code above to add the proper toolboxes for connecting to your Roomba in MATLAB.
Step 2: Connect to Roomba
After installing the Roomba toolboxes, you must connect to your Roomba. There are multiple channels to connect through such as Bluetooth, but we connected over wifi. First, execute a hard reset by pressing down the "dock" and "spot" buttons for 10 seconds. Connect the Roomba and operating device to the same wifi network. Next, use the follow command in your Editor window to connect to your robot:
r = roomba( # of the Roomba )
After this command is complete, the roomba will be at your control.
Step 3: Connecting to Phone (Remote Control)
Controlling the Roomba through your phone allows for a level of precision that cannot be attained with the autonomous mode of the Roomba. It is critical to establish this connection because on the vast martian landscape the ability to choose a certain location to investigate is key. The following instructions detail how to accomplish this.
1.Use MATLAB Connector™ to set up the connection between your computer running MATLAB and the MATLAB Mobile application on your iOS device.
2.In the MATLAB Command Window, enter
connector('on', 'password', 'mypassword'); Specify your own password in the last argument. Use the default port. To check which port the connector is using, start the connector and look at the URL it displays for the test link. In the MATLAB Command Window, click the test link displayed to ensure that the computer is ready to connect. Note the DNS name and IP address, which you need to complete the connection.
3.In MATLAB Mobile, select Connect to Your Computer. If you previously connected to the cloud or a different computer, go to Settings, and tap Add a Computer.
4.In the Computer setting, enter the DNS name or IP address that was displayed in step 2.
5.In the Connector Password setting, enter the password that you specified in step 1.
6.Save your settings, and start the connection by tapping Connect at the top of the screen.
7.In subsequent MATLAB sessions with the same computer, start the connection on the computer and the device. In MATLAB, enter connector on. In MATLAB Mobile Settings, tap the button next to the computer IP address in the Connect to Your Computer section.
8.You can now create your mobiledev object and start acquiring data, as described in Acquire Sensor Data Streaming.
Step 4: Color Recognition
This entire step is accomplished in MATLAB. First, find image data for the appropriate colors and then set the Roomba to recognize those colors. When the Roomba recognizes the appropriate RGB value, it will output a message or perform an action. For instance, our Roomba stabs aliens (color red) with an attached butter knife (or desired object of defense) and also sends a message back to the home base when it finds astronauts (color green).
Step 5: Test Robot
This step is arguably the most important step of the process. It is pertinent to make sure the remote works properly as well as the color recognition and the rest of the default sensors on the Roomba. Varying light levels can affect your robot's ability to detect colors so those inputs may require adjusting.
Our code is attached below. One key thing to watch out for is that the turning angles will vary from Roomba to Roomba so it is important to determine your own angles. This is also true for the RGB values.