ControlServo-BLEApp

(Github repository)

Ori Licht, orilicht10@gmail.com
Netanel Yosephian, yosephian@mail.tau.ac.il

Android and TI-RTOS applications that communicate over BLE. Android app reads the rotation vector from the phone (only the pitch and roll), and sends it to the TI-RTOS BLE application (firmware is installed on the CC-1350 launchpad).

Motivation

Our initial goal was to make the Metal Marble Labyrinth Puzzle accesible, the game:

game

As one can see in the image, the game requires using both hands (one for axis controller). With our implementation, one can play this game with one (or none) hand. Besides the mentioned game, the software can be used for several application such as: model airplanes or ships, etc.

Equipment

board

servo

galaxy

matrix

Implementation

Android application

Used Android Studio 3.0.1 for the development process.

Development process:

  1. Using Android Sensor API to read the Rotation Vector (Pitch and Roll only), Used this example for the implementation. The pitch and roll orientation: rotation
  2. For the BLE connection establishment with the micro-controller we used this example, from Google's Android examples Github.
  3. We changed the UI of the above example, and added the BLE writing data functionality.
  4. Finally, we combined both applications, so it will the read the rotation vector of the phone, and send it immediately to the micro-controller.

Application flow:

  1. Android application looks for the exact TI-RTOS application name in all optional BLE devices. If not found - raises an appropriate "Toast" message.
  2. If found, by the end of the scan, a "start" button will appear. Upon user's click on the "start" button the application will try to connect to the micro-controller.
  3. After connection is established, a listener for the rotation vector will be automatically registered, and in each vector read - the app will send the degree to the micro-controller.
  4. To end the connection - the user can click the "pause" button.

Technical details:

TI-RTOS application (servo engines control)

Used Code Composer Studio 7.3.0 for the development process.

Development process:

  1. Using Simple BLE Peripheral example from the TI-RTOS examples library to establish the BLE connection to the Galaxy S3 device.
  2. Used the TI-RTOS PWM API to generate output pulses, which will determine the engines position.
  3. Used the SG90 datasheet to create a linear mapping from the required degree to the appropriate pulse width (measured in ms).

Application flow:

  1. Upon established connection, start reading the data from the 0xfff3 write characteristic.
  2. The read data will then be mapped to respective pulse width to the PIN output.
  3. Servo engines will be positioned accordingly.

Technical details:

Demonstration:

Our learning process

Android

TI-RTOS

Building the Project

Pre-requisites:

Recommended build steps:

  1. Download the latest Android Studio and Code Composer Studio.
  2. clone the project from the repository to your local PC, i.e.,
$ git clone https://github.com/netanelyo/AdvancedComputerSystems.git
  1. Open the AndroidApp/ControlServo-BLEApp project in Android Studio.
  2. Connect your android device.
  3. Download the app to your android device by entering "debug mode".
  4. Open the BoardApp/simple_peripheral_cc1350lp_stack_FlashROM and BoardApp/simple_peripheral_cc1350lp_app_FlashROM projects in Code Composer Studio.
  5. Connect your CC1350 launchpad.
  6. Download the app to the board by entering the "debug mode".