The FaceBit Companion App is a iOS/macOS application that manages sensor data from a FaceBit device. The app collects, stores, and processes data into insights that can be presented to the user of FaceBit.
The application is built as a Catalyst application which allows the same code to run on both iOS and MacOS. All external packages are managed with Swift Package Manager.
- Download the latest version from the Releases section of this repository.
- May require security permission. System Preferences->Security & Privacy->General->Allow Applications
- On macOS 11+, download the latest version of XCode from the AppStore
- Clone this repository
- Open
app/FaceBit Companion.xcode.proj
in XCode - Update the app signing to your Apple Id
- Select My Mac or iOS device from the device drop down in XCode's tool bar.
- Run using Cmd+r or run button in the top left.
Note: Requires a active Apple Developer Account for iOS development Note: Bluetooth is not supported on iOS Simulators. The application will run on a simulator but you will not be able to interact with the FaceBit Sensor Board.
The homepage contains a demonstration of a consumer application, displaying high level information about the device and health metrics. More widget can be developed by exploring the code in Views/MyFaceBit/Metrics
.
Following instruction in the Embedded Firmware repository for setting up the FaceBit Sensor.
- Upon app start the device will search for the FaceBit device (broadcasted name
SMARTPPE
) - The home page will display
active
when connected and the status indication will be filled. - To reconnect, press the status indication to start the bluetooth search.
Data is stored in a local SQLite database. Raw readings on the device are stored in a transactional table. To explore the database open the settings tab and select Open SQL Database (macOS) or Share SQLite Database (iOS). SQLite DB Browser is a free cross-platform application for interfacing with SQLite Databases.
Event recording is used to tag data with events for data exploration. Access event recording from Settings->Record Events with the FaceBit Sensor Board connected. Enter event metadata and press Start Event. Perform the event (e.g. Deep Breathing) and then select Stop Event.
When a event is started a new event record is stored in the database. When Stopped, all transactional recording between the start and end time are updated (tagged) with the event. See the Python exploration below for accessing events and plotting.
SQLite was selected as the datastore for easy access to any programming language or tool for data exploration.
data-exploration/
contains a Jupyter Notebook for reading a SQLite Database and plotting temperature and pressure data of all event. To Run:
- Create a new Python environment
- e.g. from the
data-exploration
directory, run:conda env create -f env.yml
- e.g. from the
- Open the jupyter notebook:
- With Visual Studio Code
- With Jupyter server: run
jupyter notebook
from thedata-exploration
directory.
- Update database path in the first cell of the notebook
- Note: if using macOS just update the username.
Since the application is built using Catalyst which is a new feature of Apple ecosystem development, macOS Big Sur (11) or above is required to run the application on Mac.
Occasionally when developing on macOS, The application does not properly close when stopping the application in Xcode and the following error is displayed. To fix, open Activity Monitor and search facebit
and force quit the application.
Currently, there is a issue with the barometer initializing on the FaceBit Sensor Board. For the best results, run the device using J-Link and powered by battery. Once running, you can disconnect the device from the J-Link.