In this project, we connected one of our team member’s phones to the Roomba iRobot in order to control it through the phone’s orientation (position). This allows for easier control of the robot.
To accomplish this we created an infinite loop of MATLAB code which receives phone orientation sensor data and causes different outputs (ex. message box, picture, backing up) based on what data is returned.
Inputs: Phone Orientation, Camera, Cliff Sensors, Light Bumpers, Bumpers
Outputs: roomba move, roomba turn, display picture, show message box, end
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Software and Hardware Requirements
In order to start using your Gyrobot a few things are first required:
1) A Desktop computer or Laptop with MATLAB installed.
2) A raspberry pi with a usb port to attach to the robot. The coding for the communication between the roomba and the raspberry pi is attached.
4) An sd card containing the code (it is a different language than MATLAB) for the roomba, this is attached above.
3) The roombaInstall.M toolbox file installed. The page to install this file can be found at https://ef.engr.utk.edu/ef230-2017-08/projects/ro... This page will be very helpful.
4) A smart phone with MATLAB Application installed.
5) iRobot's Create2 Robot
Step 2: Connecting Your Computer to Gyrobot
-Make sure the code you are typing is being executed in the same location as the roombaIntsall.M toolbox.
-Also make sure that your iRobot has a connected Raspberry Pi. This makes sure your devices can 'communicate' with each other. This does require a wi-fi system, and we used 'EFD Roomba Linksys' which was already made for us to complete this project.
-Start with a blank m.file in MATLAB to begin.
-In order to connect your computer to the Gyrobot you must first turn on the Gyrobot. Next you identify the assigned Roomba number on the top of the Gyrobot. Then, in the command window in MATLAB type the command “r=roomba("robot name")” (in this case the Roomba name/number was 35). To make sure you have the correct toolbox, try the command "r.getVersion. The Gyrobot will if properly connected to your computer will now play a tune that signifies a connection has been made.
Step 3: Connecting Your Smartphone
To connect your smart-phone to the Gyrobot you must first download the MATLAB app in your smart-phone’s app store and follow these steps.
1) Into the command window on your computer type “connector on”
2) Next, on your phone connect to the Computer using it’s IP address Next, assign the phone a variable in MATLAB on your computer using M=mobiledev.
3) Now open the sensor tab on your smartphone and press start sending
Your phone screen should now look similar to the picture included.
Your smartphone should now be communicating its orientation with your computer.
Troubleshooting: If your phone is not communicating with your computer check that the IP address was entered correctly
Step 4: Movement
The Gyrobot is coded to use the gyro-sensors in a smart phone for control. One simply just has to tilt their smart-phone once properly connected.
- To begin place your phone flat in your hand with the screen facing up.
There are two tilt commands for forward motion.
-A slight tilt and a full tilt. The slight tilt will move the Gyrobot forward 0.03m.
-The full tilt will move the Gyrobot forward 0.30m.
Step 5: Turning
There are two turning motion commands one for a left turn and one for a right turn. In order to turn the Gyrobot you must simply “roll” your phone to the side in which you want to turn the Gyrobot.
Step 6: Backwards Motion
Similarly, to the forward motion tilt commands the Backwards motion tilt commands also have a slight tilt and a full tilt. (the full tilt however should not be pulled completely back as this tilt command will take a photograph)
The slight backwards tilt will move the Gyrobot backwards
The full backwards tilt will move the Gyrobot backwards
Step 7: Taking Pictures
The Gyrobot is capable of taking pictures. To take a picture tilt your smartphone all the way backwards. View the pictures included to visualize how to orient the phone.
Step 8: Stopping Tilt Commands
To stop the Gyrobot from taking tilt commands you need to flip your smartphone face down. (screen facing the floor back of the phone facing upwards)
Step 9: Warning Messages
In order to protect the Gyrobot from operator error the Gyrobot has sensors that will prevent it from being driven into objects and off of elevated surfaces. Before a movement command is executed the Gyrobot will scan its surroundings to ensure the movement command is executable.
1) WALL! If the Gyrobot reads that an object is within the move distance it will display the warning message “Wall!” and a warning sound.
2) LAVA! Similarly if the Gyrobot is told to be moved forward and it senses a change in cliff sensor data it will stop. The Gyrobot will play a warning sound and display the warning message “LAVA!”
3) You Hit Something! If the Gyrobot light bumper fails to identify an object in front of it and hits that object if the bumper is compressed then it will display the warning message “You Hit Something!”. The Gyrobot will then play a warning sound and move itself backward to await the next command
Step 10: You're Done!
Included in the picture is a Logic Flow Chart to help better understand the coding process. We included actual pictures of the code but please do not plagiarize!
The full, copiable txt file is also included.