OSD_IconOpen Seizure Detector

Free, Open Source tools to Alert Carers if someone suffers an Epileptic Seizure

View the Project on GitHub

PineTime Watch Installation Instructions

PineTime is a low cost, Open Source smart watch which can be used as a data source to measure acceleration and heart rate for seizure detection.

We have developed a custom firmware for the PineTime watch which makes it compatible with OpenSeizureDetector.

This page describes how to set up a new PineTime watch for use with OpenSeizureDetector.

PineTime Image

Performance Notes

Requirements

Hardware

Software

Installation

There is a high level overview of the process below, followed by step-by-step instructions.

GadgetBridge

PineTimeSD Firmware

Step-By-Step Instructions

Step Description Image (Click on image for a larger version)
1 Set-Up Gadgetbridge  
1.1 Install the Bangle JS Gadgetbridge app on the phone. This can be installed from Google Play Store GB
1.2 Start Gadgetbridge and accept the various permissions that it needs. GB_start
1.3 Disable Permissions Reminders (for Android Go Phones). Android Go phones do not have all of the notification capabilities of the full Android System, so Gadgetbridge will keep asking for those missing permissions. Go into the Gadgetbridge settings and disable the ‘Check Permission Status’ option to prevent this. img
2 Connect PineTime to Phone  
2.1 Boot the Pinetime into the recovery firmware Hold button until pine cone bootloader image appears, and hold it until the cone turns red - it should boot into a single screen app that shows the InfiniTime logo as shown. Recovery Firmware
2.2 Add the Pinetime to Gadgetbridge. From the Gadgetbridge main screen, press the ‘+’ button to add a device. img
2.3 Turn on Bluetooth. Follow the prompts to turn on bluetooth on the phone if necessary img
2.4 Scan for Pinetime Device. The gadgetbridge device discovery page will start and you should see the PineTime listed (it will be sown as ‘InfiniTime’). If it does not appear, press the button on the watch to wake it up. img
2.5 Connect to the PineTime watch. Select the ‘InfiniTime’ entry from the list. Select ‘Do not Pair’ when prompted. (Although this seems counterintuitive, I have found that pairing does not work with some phones, but the connection still works ok without pairing) img
2.6 Check PineTime is connected. The Gadgetbridge main screen should now show the Pinetime watch (as ‘InfiniTime’) and say it is connected as shown in the image. img
3 Install PineTimeSD Firmware on Watch  
3.1 Download OpenSeizureDetector PineTimeSD Watch Firmware. Open the web browser on the phone and go to the OpenSeizureDetector Github repository at https://github.com/OpenSeizureDetector/PineTimeSD/releases and select the latest version of pinetime-mcuboot-app-dfu-.zip from the 'Asssets' section of the page. It should download into the phone 'Downloads' folder. img
3.2 Install new Firmware. When the firmware download completes, select ‘Open’ fromthe notification. This should open the Gadgetbridge FW/App Installer page. Press the ‘Install’ button to start installing the firmware on the watch. It could take a few minutes depending on the speed of the phone. The watch and the phone should both display a progress bar as the upload progresses. img img
3.3 Start Watch with New Firmware. When the download completes, the watch will re-boot automatically, showing a pinecone which fills with green. It will pause for several seconds once the green fill is complete, then the new firmware should start and display the time. img img
3.4 Check Firmware. Check that the new OpenSeizureDetector PineTimeSD firmware has been uploaded by swiping the screen from left to right (press the button to wake up the watch first if the screen has blanked). Select the cog settings icon to display the list of settings. Swipe the screen from bottom to top until the ‘About’ item is shown, and select ‘About’. The about screen should be titled ‘OSD_InfiniTime’ and the version number should be 230.x.y (where x and y are numbers). If so, you have successfully installed the OpenSeizureDetector firmware on the watch. img img img img
3.5 Validate Firmware. Press the button to go back to the settings list and select the ‘Firmware’ option - select ‘Validate’. (Validating the firmware confirms that it has been uploaded correctly, otherwise it will be deleted and the previous firmware used next time the watch re-starts). img
3.6 Disconnect Watch from Gadgetbridge. On the phone, open Gadgetbridge and use the menu to disconnect the phone from the Pinetime (InfiniTime) device. Ths can also be done directly from the Gadgetbridge notification at the top of the screen. This is necessary so that the OpenSeizureDetector app can detect the watch during the set-up in the following section. img
4 Install Compatible Version of OpenSeizureDetector Android App  
4.1 Install from Play Store. The default version of OpenSeizureDetector on Google Play Store is not compatible with PineTime at the moment - you need V4.2.x or higher, which is available to Beta testers. Register as a beta tester on Google Play store as follows: (1) Install OpenSeizureDetector from Google Play Store; (2) At the top right of the play store screen, tap your profile icon; (3) Tap Manage apps and devices, select ‘manage’ and then Installed; (4) Tap on OpenSeizureDetector to open its details page; (5) Under ‘Join the beta’, tap Join and then Join. (6) after this, an update to openseizuredetector to install V4.2.x should be available.  
4.2 Start OpenSeizureDetector. When the installation completes, you will be prompted to open OpenSeizureDetector - Select Open. A start-up screen should open and you will see a welcome message which can be closed, followed by a warning about battery optimisation. When that is closed, after a few seconds the start-up screen will close and display the main OpenSeizureDetector app screen. img
4.3 Configure OpenSeizureDetector  
4.3.1 Select Bluetooth Data Source Open the menu (three dots in top right of screen) and select ‘Settings’, then ‘General’. Click on ‘Select Data Source’, and select ‘Bluetooth Deice’. img
4.3.2 Select PineTime Watch. Go back to the General settings page and press the “Select BLE Device” button.
You may be prompted to allow OpenSeizureDetector to access the device’s location - this is necessary for Bluetooth Scanning to work correctly.

It is also important that you have location services ON (OSD does not currently check this and will happily scan for Bluetooth devices in vain if Location services aren’t on. Note that granting location service permissions is not the same as having location servies switched on on your android device)
A screen that shows all of the detected Bluetooth devices will then open - select InfiniTime.
The PineTime/InfiniTime watch will not appear on the list if it is already connected to something - make sure that the Gadgetbridge app is not connected to the watch if it does not appear. Also, press the watch button to switch on the screen and wake up the watch if it is not visible
img img img
4.4 Restart OpenSeizureDetector In the OpenSeizureDetector main screen, open the menu (three vertical dots) and select ‘Start/Stop Server’ to shutdown the system.
Press the watch button to wake it up, then re-start OpenSeizureDetector. It should go through its start-up sequence then open the main screen saying ‘OK’
img
4.5 Prevent Battery Optimisation. The Android system will often try to ‘optimise’ battery usage by switching off the bluetooth radio for apps running in the background - this will prevent OpenSeizureDetector operating. To prevent this go into the main phone settings Applications menu, and in the advanced features, select ‘Battery Optimisation’. Select OpenSeizureDetector NOT to be optimised.  
5 Configuration  
5.1 Check Heart Rate Monitor On the PineTime screen, swipe right, then press the cog icon to open the settings screens. Scroll to the ‘heartrate’ settings and open it. Check that the Heart Rate period is set to ‘cont’ for continuous monitoring.