Code Monkey home page Code Monkey logo

sensortag-fpv's Introduction

SensorTag FPV

Name: John Hughes College: Pembroke CRSID: jplh4

App that analyses FPV drone freestyle with the TI SensorTag CC2650. This was my final project for the 4B25 Embedded Systems module at the University of Cambridge. See demo on YouTube here.

Getting Started

These instructions will get you a copy of the app running on your phone for testing and development purposes.

Prerequisites

Required

Optional

These items are only required if your SensorTag does not have the original firmware on it. Please see the section called Installing CCS and BLE-STACK and Flashing SensorTag firmware for more details.

Installing the app

Firstly, follow the EvoThings instructions here in order to setup the required environment. Next, clone this repository and simply drag and drop the index.html file into the My Apps section of the desktop studio.

Running the app

Click Run once connected to the EvoThings app and the 'SensorTag FPV Drone App' will load on your screen. Press the right button on the SensorTag to put it into discovery mode and hit the Connect button in the app. You should now see the 3D model of the drone moving as you change the orientation of the SensorTag!

Functionality

The app provides the following features

  • Easy connect button to start communication with the SensorTag via BLE.
  • Freestyle Analysis - this section gives the user comments on their aerobatic manoeuvres such as 'Great right roll' or 'Spectacular power loop'. It can also detect more complex moves such as a split S.
  • Drone model - a 3D representation of the drone is rendered in the app and shows real time changes in orientation. This is possible by using the gyroscope readings and the drift is accounted for by using the accelerometer to calculate the tilt when the SenorTag is stationary.
  • Sensor Readings - the measurements from the accelerometer, gyroscope and magnetometer are given for each axis.
Screenshot 1 Screenshot 2

Directory Structure

The differences of the structure to the blank EvoThings applications are the contents of index.html, new images and the addition of the JavaScript library three.js used to render 3D models.

.
├── libs/                  # JavaScript and EvoThings libraries
│   ├── evothings/         # Evothings libraries for interfacing with the SensorTag
│   └── js/                # JavaScript libraries such as Three.js for 3D rendering
├── model/                 # .dae file which defines the drone 3D model
├── res/                   # Screenshots of the app
├── ui/                    # User interface - css files and images
├── README.md              # Getting started information
├── evothings.json         # Metadata for the EvoThings studio
├── image.png              # Drone image used in the app
└── index.html             # Heart of the application. Layout and functionality all configured here.

Installing CCS and BLE-STACK

Note: Only required if SensorTag does not have the original firmware on it.

Windows (recommended)

If your SensorTag no longer has the factory firmware loaded on it, you will have to reflash using the Code Composer Studio (CCS) which can be downloaded here. Choose v7.4.0 and the off-line installer is recommended. Run the installer and choose all default options (including installation location) but for Processor Support please make sure you pick SimpleLink CC13xx and CC26xx Wireless MCUs.

Download BLE-STACK v2.2.1 from here. You will have to create an account with Texas Instruments and agree to the terms. The executable is only Windows but there are ways to install on a Linux machine and the steps to do so are given at the end of this document.

Linux VM

It is highly recommend to use Windows instead of a Linux VM on a Mac. Everything works almost seamlessly. In addition, I ran into a driver problem as outlined below which meant I couldn't flash the SenorTag.

VirtualBox

Install VirtualBox and extension pack here.

  • VirtualBox 5.2.22 (OS X hosts)
  • VirtualBox 5.2.22 Oracle VM VirtualBox Extension Pack (All supported platforms)

Install VM with Ubuntu image from here.

  • Image: ubuntu-16.04.5-desktop-amd64.iso
  • Default setup with minimum of 20gb storage

CCS

Download CCS v7.4.0 from here and extract.

sudo apt-get install libc6:i386
sudo apt-get update
cd Downloads
chmod +x ccs_setup_linux64_7.4.0.00015.bin
./ccs_setup_linux64_7.4.0.00015.bin

Same installation options as given in the previous section.

WINE

Download Wine to emulate windows so the BLE-STACK can be installed.

sudo dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'
sudo apt-get update
sudo apt-get install --install-recommends winehq-stable
winecfg

BLE-STACK

Download BLE-STACK v2.2.1 from here. and extract.

cd Downloads
wine ble_sdk_2_02_01_18_setup.exe
sudo apt install git
git clone https://github.com/jcormier/TI_BLE_CC2650_Linux_Convert.git
./convert_ti_ble_sdk_2_02_01_18_to_linux.sh ~/ti/ erase_it_all_and_copy_from_wine

See steps in course notes (D.4) to configure CCS.

Driver Problem

Error message when testing connection: “An attempt to connect to the XDS110 failed.” CCS cannot seem to communicate with SensorTag through VM. Tried fixing by installing the VirtualBox Extension Pack and adding the USB device in the filter section. The problem still persisted. Relevant forum thread here and here.

Flashing SensorTag firmware

Note: Only required if SensorTag does not have the original firmware on it.

Option 1 - Via CCS

When you launch CCS you will be prompted to install a new component called TI RTOS. Accept and let the program restart. In addition, install the ARM compiler tools 5.2.6 (found under Help, Install new software, then untick Show only latest versions).

Now import the projects (Project --> Import CCS Projects...) from the locations listed below. Ensure you check boxes labeled Automatically import and Copy projects into workspace.

C:/ti/simplelink/ble_sdk_2_02_01_18/examples/util/bim_extflash/cc2640/ccs
C:/ti/simplelink/ble_sdk_2_02_01_18/examples/cc2650stk/sensortag

There should now be three projects in the Project Explorer.

  1. bim_extflash
  2. sensortag_cc2650stk_stack
  3. sensortag_cc2650stk_app

Connect the SensorTag to the computer via the DevPack and now right click on Rebuild Project and Debug as for each project in the order given above. You may have to wait for Windows to install drivers and restart CCS.

Option 2 - Via SmartRF Flash Programmer

An alternative option to get the factory firmware is to flash a hex file with TI SmartRF Flash Programmer 2 which can be downloaded here. Once the BLE-STACK has been installed as explained in the previous section, the path of the required hex file is

ti/simplelink/ble_sdk_2_02_01_18/examples/hex/cc2650stk_sensortag_rel.hex

Acknowledgments

This project was supported by Phillip Stanley-Marbell during the 4B25 Embedded Systems course at the University of Cambridge.

sensortag-fpv's People

Contributors

mchughes288 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.