Skip to content

iOS companion application for FaceBit, a platform for smart face masks

License

Notifications You must be signed in to change notification settings

ka-moamoa/facebit-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

MacOS App

Running macOS Application (No XCode- Release)

  • Download the latest version from the Releases section of this repository.
    • May require security permission. System Preferences->Security & Privacy->General->Allow Applications

Running MacOS or iOS Application (XCode - Development)

  1. On macOS 11+, download the latest version of XCode from the AppStore
  2. Clone this repository
  3. Open app/FaceBit Companion.xcode.proj in XCode
  4. Update the app signing to your Apple Id
  5. Select My Mac or iOS device from the device drop down in XCode's tool bar.
  6. Run using Cmd+r or run button in the top left. xcode-signing

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.

xcode-iphone-select

App Functionality

Homepage

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.

Connect FaceBit Sensor

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. facebit-connected

Data Collection

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. settings

Event Recording

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. event-recoding normal-breathing

Data Exploration

SQLite was selected as the datastore for easy access to any programming language or tool for data exploration.

Python

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
  • Open the jupyter notebook:
    • With Visual Studio Code
    • With Jupyter server: run jupyter notebook from the data-exploration directory.
  • Update database path in the first cell of the notebook
    • Note: if using macOS just update the username.

Troubleshooting

MacOS Version

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.

MacOS Running

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. xcode-app-running-error activty-monitor-facebit

Barometer Initialization

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.

About

iOS companion application for FaceBit, a platform for smart face masks

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages