I first wanted to be able to control the robot using a glove with a sensor that would read the tilt of my hand. I then decided that since my phone has a built in accelerometer that I can use that to communicate with robot instead. Using the Adafruit Bluefruit LE UART Friend sensor and corresponding app, I was able to do just that. The Bluefruit Connect app has a lot of great functions such as a controller pad with buttons, gyroscope, accelerometer, magnetometer, and location readings which all come from your phone. Reading the data coming from my phone to the Bluefruit chip meant reading over Serial C in code composer and then transferring that over to Serial A. To set this up, I first soldered some header pins that came along with the sensor and 8 female header pins to my board. I then soldered the Transfer pin on the Bluetooth sensor to the Receive pin on the Launchpad board and the same for the Receive pin to the Transfer pin on the Launchpad.
Each type of data reading coming from my phone has the characters that correspond to the first letter of that reading. For example, accelerometer readings transmit !A and then the data thereafter. Using this data, I could read the X, Y, and Z accelerometer readings. I then had the X value correspond to the velocity of my motor and direction. So when I tilt my phone forwards the robot travels forward and the more I tilt the faster it will go. Likewise, I used the Y values to correspond to the turning motion of my robot. So when I tilt my phone either left or right, the robot will turn in that direction and with great control.
Using the buttons on the control pad in the app, when I click on one of the four buttons, a short song plays over the speaker of the robot. There are four songs to choose that correspond to four buttons. As I mentioned above, the data that get's sent over is read using the first letter of the reading that you are trying to transmit. So to read that a button was pressed, my phone would send over Serial C, ' !B#1' where the # corresponds to the button I press, 1-4. Below is the video of my functioning project.




Comments