Michael DiNicola, Senior in MIS & Marketing
The robotic arm project uses an Android device to control a small robotic arm connected to a computer. The app utilizes Bluetooth technology in order to connect with the computer to send the robot commands. Once the app is connected with the computer all you have to do is start clicking the commands and the robot will start moving. I was able to first have two phones communicate via Bluetooth and then got it to work on the computer. Then I had to incorporate the code that communicates with the robot. Once that was all in place I set up the app to send a certain character for each command. Once the computer receives that command, it goes through the logic to find out which command to then send to the robotic arm. I incorporated the accelerometer into one of the ways that you can control the robot. First I had to figure out how to read the sensors on the phone in the app. I accomplished this by making a simple class and setting up variables to equal the 3 sensors values. There are X, Y, and Z values for the accelerometer. While holding down one of the joint buttons, the app reads these 3 values. For the shoulder button it only needs to sense the X value of the sensors because it is only moving up and down. To move the shoulder up you would raise the phone up which then cause the X value to go up. Once the value is above 5 the app will start sending the command for shoulder up; once the value drops below 5 then it will begin to send the command for shoulder down.
One complication with this app is that by default a button press only sends a command once. I wanted the possibility for the app to send commands until you let go of the button. In order to get the app to continually send a command I had to incorporate a function in android called an AsycnTask. This function allows for 2 things to occur at the same time in the app: it senses that a button is held down and switches to AsycnTask in order to send the commands.