Close
0%
0%

Hacking Wearables for Mental Health and More

Presenting the "Tingle" wearable for compulsive behaviors and a hacked fitness tracker wearable device prototyping platform.

Public Chat
Similar projects worth following
I hack generic fitness trackers and use them as a platform for prototyping wearables such as the "Tingle" at the Child Mind Institute MATTER Lab. The Tingle is used to monitor and alleviate body-focused repetitive behaviors (BFRBs). The Tingle has completed a pilot study to establish basic functionality and is now in active use as part of a feasibility study. I'm open sourcing the Tingle prototype and my use of hacked fitness trackers as a prototyping platform. Although the fitness trackers I hack are wrist-based, I've built all sorts of devices with them. In addition to basic tutorials, I've built three demo projects to publicize and open source this platform: a stomach acid-powered smartpill, an intraoral respiration monitor and an EEG headset. I've made everything completely Arduino compatible for your convenience. Full fitness tracker hacking documentation + tutorials and code for gesture recognition, neural network training, and Web Bluetooth.

The "Tingle" is a wearable device designed to combat body-focused repetitive behaviors (BFRBs), especially trichotillomania (compulsive hair pulling) and excoriation (compulsive skin picking).


Prevalence of body-focused repetitive behaviors (BFRBs) 

 Body-focused repetitive behaviors (BFRBs), symptoms of Obsessive Compulsive Disorder (OCD) and other conditions involving compulsions (e.g., Autism Spectrum Disorder) involve compulsively causing physical injury and/or damaging one’s physical appearance. These are among the most poorly understood symptoms; they are often misdiagnosed and undertreated. BFRBs include hitting oneself, biting, pulling out hair, skin picking and cutting, as well less severe but damaging behaviors such as nail biting, thumb sucking, and nose picking. These symptoms affect at least 5% of the population; hair pulling alone affects 1%, or about 3 million people in the US. BRFBs are highly comorbid. Studies have shown that as many as 70% of those with one BRFB will have another co-occurring BRFB. While often impairing, affecting medical health and/or disfiguring, these symptoms are frequently reported but often not observed in clinical settings. This makes diagnosis, as well as treatment planning and monitoring, exceedingly difficult. To avoid pain and disfigurement, it is imperative to identify a reliable means to automatically identify and monitor BFRBs, especially outside the clinic setting. Clinicians need data on BFRB frequency and timing for the purposes of diagnosis, treatment planning and monitoring while patients need immediate, real-time feedback to make behavioral therapies more effective.

The “Tingle” device

To address this previously unmet clinical need, I have created a wrist-worn device called the “Tingle” that can monitor and record BFRBs while also providing real-time (haptic) feedback (on the wrist) to the individual with BFRBs when they occur. The Tingle is well-positioned to address the tremendous unmet need in the care of individuals with BFRBs and other damaging and impairing compulsive behaviors. The Tingle will revolutionize the diagnosis and treatment of at least 5% of the population affected by these severe symptoms by using a convenient, automated, unobtrusive, and inexpensive device that both records behaviors for clinical assessment and provides accurate, real-time feedback to the wearer in support of therapy.



Hack Fitness Tracker Wearable Device Prototyping Platform

Although the Tingle is my primary focus in the project, my reason for sharing it on Hackaday is to open source my extensive use of hacked fitness trackers as a wearable device prototyping platform.

All are Arduino IDE compatible, completely hackable, use a fast ARM Cortex MCU and cost $20-40. For more information scroll to the bottom of this details section, see the related project log, view my other projects and check out the Hacked Fitness Tracker Wearable Device Prototyping Platform GitHub repository: https://github.com/curtpw/nRF5x-device-reverse-engineering

Now back to Tingle.


Tingle Basic Operation

The fundamental operation of the Tingle is fairly intuitive: data is gathered from a variety of sensors, sensor data is applied to a statistical model to predict whether the device is in a targeted position relative to the body, and if the model determines a sufficient likelihood that the Tingle is on target a vibration motor is activated to alert the user. Although the user trained neural network feature is really cool and makes for an impressive demo, I have deactivated it for the feasibility study. This device is being developed for use by children, and the custom model...

Read more »

trich_N68_cap_2_1_18.stl

3D Model for 3D printing the Tingle sensor cap

Standard Tesselated Geometry - 279.77 kB - 10/22/2018 at 12:55

Download

nrf52_X9Project_BLE_CHAT.ino

Example demonstrating text communication between the X9 activity tracker and an Android phone application including automated reply and text color changes

ino - 14.91 kB - 05/24/2018 at 15:11

Download

nrf52_X9Project_ALPHABET.ino

Example for displaying text on the OLED display using a lightweight font

ino - 10.73 kB - 05/24/2018 at 15:09

Download

nrf52_X9Project_BLINK.ino

This sketch makes the green heart rate sensor LED blink

- 1.21 kB - 04/18/2018 at 23:15

Download

nrf52_X9Project_BUTTON.ino

This sketch uses the touch sense button to control the heart rate sensor LED and the vibration motor.

ino - 1.88 kB - 04/18/2018 at 23:47

Download

View all 9 files

View all 12 components

  • Tingle Research Paper Published

    Curt White05/30/2019 at 20:22 1 comment

    The Child Mind Institute Matter Lab has published a paper based on data gathered from the Tingle gesture recognition device (the primary prototype presented in this Hackaday project).

    Check it out:

    https://www.nature.com/articles/s41746-019-0092-2

    Thermal sensors improve wrist-worn position tracking

    Jake J. SonJon C. ClucasCurt WhiteAnirudh KrishnakumarJoshua T. VogelsteinMichael P. Milham & Arno Klein 

    npj Digital Medicine 2, Article number: 15 (2019) 

  • Building the Tingle

    Curt White10/19/2018 at 19:27 0 comments

    1: Unboxing and Dissembling the N68 Fitness Tracker

    This is the fitness tracker used as a foundation for current Tingle prototypes. It can be had for $30-40 from China ( Link1 , Link2 , Link3 , Link4 ) or $63 on Amazon Prime if you are in a hurry. The primary reason I chose the N68 it its cast metal enclosure and magnetic power adapter. The appearance of Tingle prototypes is extremely important. We will be asking parents of vulnerable children to put these devices on their child's wrist. A finished, off the shelf appearance is important to gaining their trust. In addition, these prototypes are handled by decision makers at CMI and potential funders, both of whom appreciate a polished product. The N68 as a color OLED screen, KX126 accelerometer, 8MB GigaDevice FLASH memory IC, vibration motor and simple LED/Photo-receptor heart rate sensor. 

    NOTE: As I'm documenting build steps I will be showing pictures of four devices being fabricated. Building these prototypes one at a time is very tedious. Also, multiple prototypes means you get to see multiple examples of each build step.

    The strap and glass cover are both removed. The cover is attached with glue. I use a hobby knife to cut around the edges of the cover, thereby loosening in.

    A small screw driver is used to pry up the cover.

    Here you can see the cover removed and placed upside down. The bottom section of the cover has a contact for the touch sensor affixed, and the top has an extension of the Bluetooth antenna. There is also a PCB antenna embedded in the circuit board itself so this isn't strictly necessary.

    Here are all four N68s with covers removed. 

    The electronics have been removed from the enclosure. The battery and heart rate (HR) sensor are lightly glued to the bottom of the enclosure but can easily be lifted out with a small prying tool.

    Here you can see the green LED for the HR sensor lit up. The HR sensor is not currently used in the Tingle prototype but this is just a matter of programming, these sensor is readily available for use. During a clinical study we hope to monitor HR during detected compulsive behavior events. The HR sensor might even offer additional filtering of false positive detections since elevated HR is correlated with the anxiety that underpins compulsive behaviors.

    N68 Fitness Tracker Components

    Closeup of N68 PCB ICs. External flash and HR sensor are not currently used in the Tingle but could be implements by simply writing additional code.


    2: Removing the OLED Display

    The Tingle does not use the N68's display. It uses up power and space which I would rather devote to sensors and sensor data processing. The display is easily removed with a soldering iron by gently pulling on the display as the soldering iron is played across the display contact area.

    With the display removed.

    Display removed from all four prototypes.


    3: Wiring Up the N68 PCB

    The N68 PCB will have to be connected to the sensor cap, an external programmer and power supply. Conveniently, there are factory test pads which I can solder wires to.

    Fluxing the PCB test pads I will be soldering wires to.

    Pre-soldering the test pads to make soldering easier +...

    Read more »

  • Programming the Tingle

    Curt White10/19/2018 at 19:06 0 comments

    All Tingle related code is stored in this GitHub repository: https://github.com/curtpw/tingle-open

    Firmware, Mobile App, Web Interface and MLX90615 Thermal Sensor Programming

    The Tingle project consists of four applications: 

    1. Firmware running on the Tingle written in Arduino C for the Nordic nRF5x ArduinoCore (see programming instructions in wearable device hacking section of this project and the platform GitHub repository).
    2. Hybrid mobile app written in JavaScript using the Cordova hybrid app framework ( link to Android version on Google Play ).
    3. Web interface written in pure front-end JavaScript. This can run from a simple file server (or GitHub repository as a GitHub page). No server side code necessary ( link to live interface ).
    4. A small Arduino sketch to program the I2C addresses (2A, 2B, 2C, 2D) of the MLX90615 thermopile sensors.

    MLX90615 I2C Address Programming Setup

    This is my setup for programming MLX90615 thermal sensors. Any Arduino compatible microcontroller will work as long as it supports I2C (pretty much all of them do).

    N68 Fitness Tracker PCB Microscope GPIO Diagram

    Note: there are both red and blue versions of the N68 PCB. The only difference between them is the presence of a test pad for CS on the OLED display SPI bus. High resolution images available in the GitHub repository.

  • Wearable Device Prototyping Platform

    Curt White10/19/2018 at 19:05 0 comments

    Open Source

    When I think open hardware I think Arduino and Raspberry Pi. When I think open software I think Linux, Python, JavaScript and countless libraries/modules thereof. These are tools and more importantly, community driven platforms. I use hacked fitness trackers to prototype wearable devices because nothing else works - nothing else is small, inexpensive and polished enough. They have become my go-to wearable device prototyping platform for both work and personal projects. This platform has the potential to be a successful community driven open source project - and the Hackaday Prize competition is where I decided to launch it. 

    I have had a lot of help along the way. Especially members of the smartwatch hacking slack group!  Hackaday is a good place to document projects, but GitHub is necessary for a full fledged open source project with multiple contributors. The primary GitHub repository for the "Hacking Wearables for Mental Health and More" Hackaday project is becoming exactly that. I have spent so much time building projects for Hackaday (I decided to build a significant project for each of the 5 challenges!) that I've been a little neglectful of the GitHub repository over the last couple months, but things will get humming again in no time. 

    44 stars and 7 forks is a great start. More of a "fledgling" open source project than a "full fledged" open source project but it is definitely legit, especially considering how niche it is. Personal first. The repositories for various tutorial examples and demonstration projects have gotten some GitHub love as well.

    Platform Demonstration Projects

    I created three demonstration sub-projects specifically to showcase hacked fitness trackers as a wearable device platform and entered them into the Hackaday Prize: Intraoral Respiration Monitor and Overdose Detector, Stomach Acid Powered Smartpill and EEG Headset. Two of those ended up as finalists despite being created as tutorials for this project. My hope is that the positive reaction these projects have garnered will add additional momentum to making the hacked fitness tracker prototyping platform a successful open source project.



    Stomach Acid Powered Smartpill

    Heard of using lemons, potatoes or salt water to create a simple battery? Stomach acid (dilute hydrochloric acid) can be used in the exact same way and is significantly more powerful. I use an array of zinc (anode) and copper strips (cathode) immersed in stomach acid (electrolyte) to turn my stomach into a galvanic cell battery. The stomach battery powers a hacked activity tracker small enough to swallow and reconfigured as a body monitoring 'smart pill'. The user's stomach is the smart pill's battery. By incorporating a $25 hacked activity tracker into existing research I am trying to make stomach acid powered smart pills inexpensive and open source. [LINK TO PROJECT]

    (Down camera feed is on an off frame screen so use your imagination when I refer to closeups of the smartpill)



    Intraoral Respiration Monitor and Overdose Detector

    A wireless full waveform respiration monitor worn entirely inside user's mouths (intra-oral) that streams data to a Web Bluetooth enabled web application. 

    The device measures the air pressure, humidity and skin temperature inside the user's airway. In short, BME280 air pressure sensor + MLX90615 thermopile thermometer + hacked miniature nRF51822 based activity tracker mounted on an ultra-thin custom dental retainer. 

    My primary goal is to detect opiate overdose. Depressed respiration is the best way to detect overdose and the only approved indicator for the administration of Narcan (Naloxone). Full waveform respiration data is surprisingly difficult to obtain. Spirometers, chest-straps and pulse oximetry (including photoplethysmogram) are relatively inaccurate - particularly when respiration becomes depressed. There are many...

    Read more »

  • Adding Bioimpedance (ECG, EEG, EMG) to The Platform with ADS1292 ECG Activity Trackers

    Curt White08/27/2018 at 05:27 0 comments

    Their are a number of nRF52832 activity trackers which contain the Texas Instruments ADS1292 ECG front-end IC, for example the B20 (links 1 2 3 4 5 6 7 ), the CK12 (links 1 2 3 4 5 ), the G20 (links 1 2 3 4 5 ), and the B9 (links 1 2 3 4 5 ). Although the ADS1292 is marketed for ECG, it is part of a family of chips focused on an array of bioimpedence applications and there is no particular reason it can't be used for simple experimental EEG and EMG projects.

    I have provided an in depth tutorial on hacking the B20 activity tracker and applying FIR (Frequency Impulse Response) and FFT (Fast Fourier Transform) analysis to the devices ADS1292 data in this project: https://hackaday.io/project/160618-hacking-a-35-ecg-nrf52-fitness-tracker-into-eeg.

    I have added an Arduino Core variant file to the project GitHub repository for the B20 as well as code examples for EEG with FIR filters, EEG with FFT and ECG with Protocentral's Processing application.

    B20 ECG Fitness Tracker Specs:

    • Texas Instruments ADS1292 two channel (only one is used) ECG front end 
    • Nordic nRF52832 ARM Cortex M4 SoC/MCU
    • Bosch BMA253 Accelerometer
    • Gigadevice GD25Q16C 16MB Flash Memory IC
    • PPG Heart Rate Sensor
    • 0.95" 64*128 pixel monochrome SD1306 OLED display
    • Vibration motor
    • 80mAh LiPo battery and battery charger

    B20 nRF52832 MCU Pinout

    • P19: Button
    • P3: Vibration Motor
    • P5: SSD1306 OLED Display
    • P6: SSD1306 OLED Display
    • P7: SSD1306 OLED Display
    • P11: GD25Q16C 16MB Gigadevice Flash Memory
    • P12: GD25Q16C 16MB Gigadevice Flash Memory
    • P13: GD25Q16C 16MB Gigadevice Flash Memory
    • P14: GD25Q16C 16MB Gigadevice Flash Memory
    • P15: ADS1292 CS
    • P16: ADS1292 DIN
    • P17: ADS1292 SCK
    • P20: ADS1292 START
    • P22: ADS1292 RESET
    • P23: ADS1292 DOUT
    • P25: HR I2C SDA
    • P26: HR I2C SCL
    • P28: BMA253 Accelerometer CS
    • P29: BMA253 Accelerometer SDI
    • P30: BMA253 Accelerometer SDO
    • P31: BMA253 Accelerometer SCL

  • Text Communication over Bluetooth Serial Example

    Curt White05/24/2018 at 07:52 0 comments

    I have created a simple font for the X9 OLED display and used it to demonstrate text communication over serial Bluetooth using my Android phone. The BLE_CHAT example will display input from the Nordic phone app on the X9 display. If "red", "blue", "green", "yellow", or "purple" is sent, the message will be displayed in the corresponding color and a custom reply will be sent from the X9 activity tracker to the phone app.

    I have also included a simple sketch demonstrating the super simple font.

    All files for examples can be found in the GitHub repository, including required libraries and application hex files which I compiled myself. If you have a hacked X9 you can immediately load my compiled application to quickly check out the demo. I am adding the actual example sketches to the hackaday.io project files as well.

    GitHub repository file directory:

    nRF5x-device-reverse-engineering --> X9-nrf52832-activity-tracker --> Firmware --> examples --> nrf52_X9Project_BLE_CHAT
    nRF5x-device-reverse-engineering --> X9-nrf52832-activity-tracker --> Firmware --> examples --> nrf52_X9Project_ALPHABET

    Nordic UART Bluetooth Serial app: https://play.google.com/store/apps/details?id=com.nordicsemi.nrfUARTv2

  • Intraoral Respiration Monitor - A Computer Inside Your Mouth!

    Curt White04/23/2018 at 19:06 0 comments

    A wireless full waveform respiration monitor worn entirely inside user's mouth (intra-oral) that streams data to a Web Bluetooth enabled web application. We built this by hacking the tiniest ARM based activity tracker we could find! 

    The device measures the air pressure, humidity and skin temperature inside the user's airway. In short, BME280 air pressure sensor + MLX90615 thermopile thermometer + hacked miniature nRF51822 based activity tracker mounted on an ultra-thin custom dental retainer. 

    We also spun this off into a separate Hackaday project with more detail, check it out.

  • The "Tingle" Gesture Recognition and Biofeedback Device For Compulsive Behaviors

    Curt White04/20/2018 at 03:31 0 comments

    The "Tingle" Gesture Recognition and Biofeedback Device is a project I'm working on at the Child Mind Institute. To put it very bluntly, it is designed to help kids stop compulsively tearing out their hair, a disorder called trichotillomania which is surprisingly prevalent. I built the prototype using the X9 activity tracker presented in this project.

    From the MATTER Lab website:

    As you are about to compulsively pull out your hair, bite your nails, or engage in some other body-focused repetitive behavior, you feel a tingle on your wrist. Then a notification is sent to an online dashboard. This information helps you to be mindful of your behavior as part of a behavior modification therapy, and helps your therapist monitor your progress. This is the rationale behind building the Tingle and applying for a patent. We have just run a pilot study and are preparing for a clinical trial.

    Prevalence of body-focused repetitive behaviors (BFRBs)

    Body-focused repetitive behaviors (BFRBs), symptoms of Obsessive Compulsive Disorder (OCD) and other conditions involving compulsions (e.g., Autism Spectrum Disorder) involve compulsively causing physical injury and/or damaging one’s physical appearance. These are among the most poorly understood symptoms; they are often misdiagnosed and undertreated. BFRBs include hitting oneself, biting, pulling out hair, skin picking and cutting, as well less severe but damaging behaviors such as nail biting, thumb sucking, and nose picking (Families & Health). These symptoms affect at least 5% of the population (Families & Health); hair pulling alone affects 1%, or about 3 million people in the US (Diefenbach, Reitman & Williamson 2002). BRFBs are highly comorbid. Studies have shown that as many as 70% of those with one BRFB will have another co-occurring BRFB (Conelea, Frank & Walther, 2017). While often impairing, affecting medical health and/or disfiguring, these symptoms are frequently reported but often not observed in clinical settings. This makes diagnosis, as well as treatment planning and monitoring, exceedingly difficult. To avoid pain and disfigurement, it is imperative to identify a reliable means to automatically identify and monitor BFRBs, especially outside the clinic setting. Clinicians need data on BFRB frequency and timing for the purposes of diagnosis, treatment planning and monitoring while patients need immediate, real-time feedback to make behavioral therapies more effective.

    The “Tingle” device

    To address this previously unmet clinical need, we have created a prototype for a wrist-worn device called the “Tingle” that can monitor and record BFRBs while also providing real-time (haptic) feedback (on the wrist) to the individual with BFRBs when they occur. The Tingle is the subject of U.S. Patent Application #15/816,706 filed January 26, 2018.

    Testing the accuracy of the Tingle device for detecting different simulated BRFBs.

    In a pilot study to establish the accuracy with which the Tingle can detect BFRBs in a controlled setting, we recruited 50 healthy, adult volunteers to wear the Tingle and repeatedly simulate 9 different behaviors (eating, smoking, thumb sucking, nail biting, nose picking, skin picking, and hair pulling from three locations). We just gathered the data and are analyzing the data now!

    Testing the clinical efficacy of feedback via the Tingle in therapy.

    This proof of concept leads to the critical next step of applying the Tingle to the clinical setting in which we will confirm the Tingle’s effectiveness in preparation for an FDA New Device Application and plan for commercialization. This will open the way for broad distribution in clinical practice as a diagnostic tool and to support the evaluation and implementation of pharmacological and behavior therapies for BFRBs.

    Conclusion

    The Tingle is well-positioned to address the tremendous unmet need in the care of individuals with BFRBs...

    Read more »

  • Get More GPIO The Easy Way

    Curt White04/20/2018 at 00:28 0 comments

    If I couldn't add additional sensors to the X9 Activity Tracker it would be useless to me. To be perfectly honest, I don't even particularly like activity trackers. Unlike an Arduino, Teensy, ESP32 or ARM Cortex breakout board, hacked activity trackers don't provide convenient access to additional MCU GPIO for adding sensors etc. There is a simple solution: cannibalize GPIO from existing components.  I always remove the OLED for my own projects. I'd rather interact with devices using a mobile app or web application over Bluetooth. Bluetooth is the whole reason I find Nordic chips so appealing. Take a look at the below example of how I desolder the X9's OLED display to gain additional GPIO for sensors:

    The primary OLED GPIO (P14, P13, P12, P11) are really easy to access because there are nice big test pads to solder underneath the OLED ribbon cable. P15 is a little bit harder because you have to solder the place where the ribbon connected, but still no biggy. But what if you need more GPIO or want to keep the OLED? You can access P29 (heart rate detector photosensor) and P30 (touch sensor) by scraping off the solder mask from the appropriate traces and directly soldering a wire to the trace. You will want to isolate your connection to the MCU from supporting circuitry related to the original use of those GPIO. In order to do this, solder to the trace in a place where there is nothing connected between your solder point and the MCU (nRF52832), then cut the trace above your solder point.

    You can use this annotated, highly detailed composite microscope image of the X9 PCB (high resolution version in project files) and list of component pin connections to figure out traces you might want to solder into:

    • HR_LED_PIN            4
    • HR_DETECTOR       29
    • TOUCH_BUTTON    30
    • VIBRATE_PIN           8
    • BATTERY_PIN          28
    • OLED_CS                 15
    • OLED_RES               14
    • OLED_DC                13
    • OLED_SCL               12
    • OLED_SDA               11
    • OLED_LED_POW     16
    • OLED_IC_POW        17
    • KX126_CS                 24
    • KX126_SDI               19
    • KX126_SDO             20
    • KX126_SCL              18
    • KX126_INT               23
    • FLASH_CS                22
    • FLASH_SDI               19
    • FLASH_SDO             20
    • FLASH_SCL              18

  • "Thermo" Position Tracking Wearable Device

    Curt White04/19/2018 at 23:29 0 comments

    The "Thermo" position tracking device is a controller for VR/AR or any other situation where tracking a user's hand in 3D coordinate space might be useful. The Oculus Rift and HTC Vive virtual reality headsets both have 6DoF (Six degrees of freedom) position tracking controllers. They also depend on a camera or some other external device to achieve 6DoF hand position tracking. At the Child Mind Institute MATTER Lab we applied machine learning techniques to vast amounts of thermal imaging data and leveraged the results using a device worn on the wrist with a fairly sparse sensor configuration. We are attempting to achieve the capabilities of the Oculus and Vive controllers without any external reference point. This device was prototyped using the X9 Pro activity tracker - the exact activity tracker presented in this project.

View all 10 project logs

  • 1
    Get a X9 Pro Activity Tracker

    Aliexpress, Banggood, and Ebay are your best bet. Pricing will vary widely so it pays to look around.

    LINK1   LINK2   LINK3   LINK4   LINK5   LINK6

    NOTE: I have purchased many X9 Pro activity trackers. Some of them have a green PCB and some have a blue one. It doesn't make a difference for the purposes of this tutorial. The traces on the PCB are arranged a little differently but all the components are the same.

  • 2
    Cut Glue Between Translucent Plastic Cap and Metal Enclosure Body

    Use a hobby knife ("X-Acto" knife) to cut as much of the glue bonding the plastic cap to the metal body as possible. Getting a thin blade between the plastic and metal will gradually wedge the two apart. Take your time (I would budget at least 5 minutes) and work your knife all the way around the cap.

  • 3
    Lift Plastic Cap Off the Metal Enclosure

    Use a small screw driver or prying tool to carefully lift the plastic cap off the metal enclosure body. Take your time and work thy prying tool around the cap.

    Separate the cap and put it aside for now.

View all 12 instructions

Enjoy this project?

Share

Discussions

Youlian Troyanov wrote 10/21/2018 at 22:15 point

any special reason as to why you chose n68 besides appearance as it's on the expensive side... to me "appearance" is absolutely not worth the premium price...

i ordered zenblaze arch plus, which is on the cheap side. here in toronto receiving stuff is a problem though, i could get as little as 1/3 of my orders, and the problems is systemic...

btw i am a "mental health" activist myself and by educational background an automation engineer from the times of mc68000 and 6502. very much interested in "mental health" wearables, even before i found about your work. actually i dissasembled my first chinese wearble for the purpose of hacking it more than 2 years ago, but i am far from being as good as you in hardware hacking, pcb tracing, etc, plus my own mental health got worse at that time... i wonder if i could serve as an "extension" of your work here in toronto, one way or another.

  Are you sure? yes | no

Curt White wrote 10/21/2018 at 23:04 point

You can definitely contribute! Once the Hackaday Prize wraps up I plan on spending more time on the GitHub repository for this project ( https://github.com/curtpw/nRF5x-device-reverse-engineering ), that is definitely a good place to start. As far as the N68 goes, it is all about the enclosure and battery charger. This is all for work so I'm not paying for it. I also like the simple HR sensor on the N68 and X9. Just reading a photoreceptor with the nRF52 ADC can free up an I2C and/or SPI interface. As far as mental health is concerned, my blind advice to everyone is to maintain a strong support network. Its really important to have a couple people you can lean on who are already familiar with your issues - even if that just means people you can talk to. 

  Are you sure? yes | no

Youlian Troyanov wrote 08/19/2018 at 17:19 point

curt, what do you think, does amazefit a1607 have nordic inside? according to the following it does, but afaik amazfits stick to dialog...

https://www.smartwatchspecifications.com/Device/amazfit-health-band/

  Are you sure? yes | no

Curt White wrote 08/26/2018 at 00:47 point

I have one of those and I haven't opened it yet! I kind of want to wait until I have a chance to open it on video. I have a TON of projects going right now. I'm pretty sure it has a Nordic chip but we will see soon enough. Is this something you are planning on using for a project? If you have plans let me know and I'll prioritize hacking this thing.

  Are you sure? yes | no

Curt White wrote 08/26/2018 at 01:01 point

By the way, I believe the device you inquired about has an ADS1292 ECG/Bioimpedance IC in it. I just put together a big project focused on hacking nRF5x based activity trackers that use the ADS1292, pretty much everything is directly applicable to the Amazefit a1607, you just have to switch up the ADS1292 pins in the code: https://hackaday.io/project/160618-hacking-a-35-ecg-nrf52-fitness-tracker-into-eeg

  Are you sure? yes | no

Youlian Troyanov wrote 10/21/2018 at 22:05 point

yes, ads1292 is exactly why i inquired :)

  Are you sure? yes | no

arthur_jordan05 wrote 07/19/2018 at 06:57 point

Came across another nrf52832 tracker that is even cooler maybe: it's the SMA Q2 or SMA-TIME

https://wiki.hackerspace.pl/projects:sma-q2

  Are you sure? yes | no

Curt White wrote 07/19/2018 at 14:36 point

That is cool, especially the OTA bootloader. Thanks for the heads up!

  Are you sure? yes | no

flashcactus wrote 06/15/2018 at 10:03 point

Well, dude, this definitely makes my currently-abandoned project obsolete.
Great hack, congrats! Will probably be picking one up any time soon

  Are you sure? yes | no

Roger Clark wrote 06/07/2018 at 02:02 point
I word of warning to anyone thinking of buying a X9 Pro. I ordered 2 "X9 Pro"s from AliExpress, but they turned out to be "X9 Plus" versions, which look identical until I noticed that the display was not showing any colours except light blue. When I double checked the box, I realised they were not what I thought they were The X9 Plus does not have the Nordic nRF52 MCU, its got the old TI CC2541 MCU in it which is an 8 bit MCU not a 32 bit ARM processor like the nRF52 I've opened a dispute through AliExpress and I'm hoping they will give me a refund, but I had already accepted the order as visually it seemed OK, and I didnt realise there were more than one type of X9, (which look very similar)

  Are you sure? yes | no

pelrun wrote 06/03/2018 at 05:47 point

I've successfully reprogrammed the X9 over bluetooth using the nRF Connect app on a phone. 

Note: it's *really* easy to flash something and have no way to get back to the DFU mode. So I absolutely recommend having an opened watch connected to a debugger to do primary development. When DFU is working on that, then you can try sending it to an unopened unit.

The firmware on my X9 is built using SDK 11.0.0, the S132 2.0.0 softdevice (FWID 0x81) and the legacy bootloader. This last part is why DFU is possible without needing the private key (you can replace it with the SDK 12+ secure bootloader if desired later.)

So here's the trick: build a distribution packet using nrfutil (use the legacy 0.5.3 version), then *unzip* it to get the application .hex and .dat files. Send them to the phone, and flash the .hex file using nRF Connect. When it asks for the init packet, give it the .dat file. This works where just giving the .zip file fails, even though the contents are identical.

Edit: ugh, spoke a little too soon. I *have* had it work, but it looks like massive luck. The bootloader jumps to the application almost instantly, making it a race to get the DFU happening in time. Will keep poking at it.

  Are you sure? yes | no

prestegaard9 wrote 05/31/2018 at 06:57 point

Do you have a suggestion on a cheap SWD capable programmer: J-Link, Black Magic Probe etc.

  Are you sure? yes | no

Curt White wrote 06/17/2018 at 07:48 point

You can create your own Black Magic Probe using an STM32 'Blue Pill' board which can be had on Ebay for $4 (see project GitHub repository README). Generic/clone J-Link programmers can be had on Ebay for $12. 

  Are you sure? yes | no

Danin wrote 05/17/2018 at 21:32 point

Fantastic project, as soon as I saw it I picked up a pair and a programmer. I've question and I'm sorry if you have addressed it but I'm on mobile and don't want to forget to ask - would there be any interest in this platform being ported to the PlatformIO suite? I think it would benefit greatly from that, and would love to see it there.

  Are you sure? yes | no

Curt White wrote 05/17/2018 at 23:07 point

In terms of PlatformIO, anything that supports Nordic nRF52832 and nRF51822 will work. There are already people using Sandeep Mistry's Nordic ArduinoCore on PlatformIO, so in that sense PlatformIO already supports these hacked activity trackers. You can use ARM Mbed as well, and then there is always the Nordic SDK. 

  Are you sure? yes | no

arthur_jordan05 wrote 05/10/2018 at 16:19 point

Very interesting project, thank you very much for sharing. I wanted to get started with nRF52832 in the Arduino enviroment for some months now and this got me going. This X9 pro thing is made surprisingly well.

One question: where can we get the KX126_SPI.h and ssd1331 library? I assume the latter is by lexus2k on github, but I think it needs some mods to run on NRF52...

  Are you sure? yes | no

Curt White wrote 05/10/2018 at 20:36 point

The KX126 library is in the Web Bluetooth X9 example on GitHub ( https://github.com/curtpw/nRF5x-device-reverse-engineering ).

X9 --> Firmware --> examples --> nrf52_X9Project_WEBBLUETOOTH

As you say, I use lexus2k's library for the SSD1331 OLED driver. I have been using the primitive line drawing feature - this works more or less out of the box with the nRF52/nRF51. I can get the first/top memory page working with the actual graphics library, but I haven't been able to get the rest of it working. I tried vertical addressing mode but that just gives me garbage. Making any of the Arduino SSD1306/SSD1331 OLED libraries work with the nRF52 is going to require some time and effort. I used the line drawing function to draw a rough bitmap in the OLED example by iterating across it pixel by pixel. I'm going to create a simple text writing library and example for the X9 using the same technique. If you want to take a crack at porting lexus2k's library to the nRF52 that would be great.

Note: I just collected all the libraries used by the X9 examples and nRF52 based Hackaday projects in a single folder: common --> libraries

  Are you sure? yes | no

arthur_jordan05 wrote 05/11/2018 at 07:03 point

Thank you for the quick reply and the great info! I just thought: can you get the Adafruit nRF52 Frather or official Arduino Primo core running on the device? Sure, they seem to work via bootloader upload but maybe one can get hold of the hex file somehow. I'm also wondering whether either of those cores has an upload function via J-Link programmer through the Arduino IDE. At least for burning the bootloader this seems to be the case with the Adafruit core.

In case you're interested in additional physiological parameters: I've also hacked a cheap blood pressure monitor and pulse oximeter in the past. https://github.com/BigCorvus/Physio

Throughout the past year the U80 "Smartwatch" was my wearable dev platform of choice. I was intrigued by the cap touch screen and designd a custom ATSAMD21-based board with HM-11/Simblee-based bluetooth, MPU9250 and BME680 to fit into the enclosure. At the moment I'm working on the option that  the developer can choose between different screens like for example Sharp MemLCD or a 1.3'' IPS tft. Modifying graphics libraries can be quite time-consuming as I'm learning at the moment. As soon as the newest version is working, the design will be published.

  Are you sure? yes | no

Curt White wrote 05/11/2018 at 18:40 point

Adafruit's core is directly based off Sandeep's core (see "This core is based on Arduino-nRF5 by Sandeep Mistry, which in turn is based on the Arduino SAMD Core." at bottom of README for https://github.com/adafruit/Adafruit_nRF52_Arduino ).

My impression is that the Primo is more or less dead ( https://github.com/arduino-org/arduino-core-nrf52 ).  The Primo did support low power clock which would have been very handy. Apparently there are some licensing issues with the Nordic SDK that are complicating implementation of low power clock/RTC: https://github.com/sandeepmistry/arduino-nRF5/issues/168. In terms of supporting the Arduino IDE and Arduino style minimalist C there is also Red Bear. Although Adafruit has built some interesting tools to go along with their core, Sandeep's core is still ahead of the game in terms of supporting Nordic SDK features. 

You have been doing some excellent hacking. I am interested in learning more about your work with the U80. I would love to have a look.

  Are you sure? yes | no

arthur_jordan05 wrote 05/13/2018 at 15:53 point

The work on the U8 is a re-design of Dan Geiger's approach (https://www.youtube.com/watch?v=G1-fJkdh0o4). The amount of circulating U8 clones with significant differences is enormous. Many of them have the touch controller on the main PCB which is the unusable variant. The useful ones have it on a flex-rigid assembly and are usually sold as U80 (for examle by "NAIKU"). The touch controlles is a "BL6280" for which its I2C communication had to be reverse-engineered first, which I have done here:

https://github.com/BigCorvus/BL6280

Version 1.1 works (https://github.com/BigCorvus/ZeroWatch-v1.1) and 1.2 is coming soon.

The good Arduino core support was the reason I chose the ATSAMD21 as the main processor with bluetooth offloaded completely. A chip with USB bootloader is very very handy for a wearable made for hackers and developers. Its low power and RTC options are also easily accessible (I think a watch-like device needs to have those features.. The current board revision will have a simblee as a BT device which can be programmed via the ATSAMD chip...

  Are you sure? yes | no

Curt White wrote 05/14/2018 at 05:35 point

This is excellent! Anyone reading this thread who is interested in hacking wearables should check out those links. I ordered a couple of the $10 U80 smartwatches. Are you going to sell those ZeroWatch boards on Tindie or the like?

Given the opportunity, people should certainly take a crack at building your U80 replacement board so they can enjoy all of your work - but - if unable to get one of your boards it should be possible to wire up a hacked nRF51/nRF52 activity tracker inside a hacked U80 by just soldering a few wires between the two. That would provide the benefit of the 128x128 ST7735 TFT display and, with your code, the BL6280 touch interface for less than the price of a movie ticket.

The ATSAMD21 Arduino cores/wrappers has a definite advantage over nRF5x Arduino cores/wrappers when it comes to RTC. In some cases I've handled this with sensor interrupts (think pedometer) to wake up the MCU from low power sleep. This is useful for data logging but it won't keep the time. Fine grain power management requires direct use of the Nordic SDK.

  Are you sure? yes | no

arthur_jordan05 wrote 05/14/2018 at 10:44 point

 I'd certainly make and sell a couple of those boards on tindie if my time was not as constrained as it is. Maybe some day...There should be many people out there who enjoy SMT soldering. Luckily, nowadays it's quite easy with cheap PCB and stencil services. But you're right: for the software folks this would be a nice product. 

I've recently discoverd these screens: https://www.aliexpress.com/item/New-IPS-1-3-inch-3-3V-12PIN-SPI-HD-Full-Color-TFT-Display-Screen-ST7789/32859772356.html?spm=2114.search0204.3.30.61924176bkIWnm&ws_ab_test=searchweb0_0,searchweb201602_5_10320_10152_10321_10065_5722917_10151_10344_10068_10342_10547_10343_5722817_10322_10340_10341_10548_5722617_10193_10696_10194_10084_10083_10618_10304_10307_10302_5722717_10059_5711217_308_100031_10319_10103_5722517_10624_10623_10622_10621_10620_5711317-normal#cfs,searchweb201603_25,ppcSwitch_5_ppcChannel&algo_expid=3c49e8fc-94b3-4ea2-85f0-a0c4d1d26575-4&algo_pvid=3c49e8fc-94b3-4ea2-85f0-a0c4d1d26575&transAbTest=ae803_2&priceBeautifyAB=0

They're a bit smaller but the resolution, viewing angles and price are great! They should be a nice alternative to the ST7735...Back to the SSD1331 once again: so porting of the libraries to nRF52 is not simply done by porting the SPI writecommand() and writedata() functions? Haven't tried it myself yet.

  Are you sure? yes | no

Curt White wrote 05/14/2018 at 23:29 point

In terms of difficulty porting libraries.... only one way to find out ;) I'll be sure and spread the work about your project and I'll let you know if I come up with anything on the U80.

  Are you sure? yes | no

arthur_jordan05 wrote 05/18/2018 at 07:23 point

You`re right, I forgot :). Thank you. I'll definitely keep on hacking with the X9 and following your projects. The machine learning part will be very educational for me too.

  Are you sure? yes | no

Duke Circuit Co.,Ltd wrote 05/03/2018 at 01:28 point

It's uncomfortable to put a device in the mouth,any other way to replace it?

  Are you sure? yes | no

Curt White wrote 05/09/2018 at 18:42 point

The Intraoral Respiration Monitor is a product of low cost rapid prototyping so with more development time and resources the form factor should be significantly improved. There have been some interesting tooth mounted devices emerging recently (  https://now.tufts.edu/news-releases/scientists-develop-tiny-tooth-mounted-sensors-can-track-what-you-eat ). It is possible this device could be significantly miniaturized to the point where it could be tooth mounted. That would be an interesting project but not the kind of thing I imagine would hit the market and actually help real people anytime soon (which is what I'm most interested in). I think the combined use of skin temperature and air pressure sensors inside of the mouth is promising for fine grain respiration monitoring regardless of form factor. If I were to try and modify this project for an easy to manufacture and immediately comfortable form factor I would probably go with something along the lines of a mouth thermometer. I could also see integration into Tracheal intubation for surgery or intensive care.

  Are you sure? yes | no

Jim Shealy wrote 04/27/2018 at 01:30 point

Out of curiosity, do you know much about integrating apps/code with the x9 via bluetooth without modification? 

  Are you sure? yes | no

Curt White wrote 04/29/2018 at 01:18 point

What you are referring to is the FOTA (Firmware Over The Air) DFU (Device Firmware Update) service. This is indeed a capability that the Nordic Semiconductor nRF52832 and nRF51822 SoCs have: https://nordicsemiconductor.github.io/Nordic-Thingy52-FW/documentation/dfu_generating.html . I have not succeeded in getting DFU to work with any of the activity trackers I’ve hacked. To be perfectly honest, I haven’t tried that hard – all my applications require extensive modification. Roger Clark tried to get DFU working on a hacked nRF52832 activity tracker, his blog post contains information you might find useful: http://www.rogerclark.net/new-nrf52832-based-smart-watch-available/


Let me know if you get it working, that would be very interesting

  Are you sure? yes | no

pelrun wrote 05/30/2018 at 10:10 point

I've been reverse engineering the default firmware on my X9 for the past few days; I've confirmed it's using a lightly modified version of the dfu bootloader example from the 11.0.0 nRF SDK. Good news is that is before the secure bootloader was released! So theoretically uploading new firmware to an unopened watch should be possible, but I still need to do some work to figure out exactly what needs to be sent.

  Are you sure? yes | no

James Hall wrote 05/07/2018 at 12:24 point

I'm interested in this too Jim, let me know if you figure it out. I'm sure there are some uses these can be put toward without requiring hardware modifications.

  Are you sure? yes | no

Tom Meehan wrote 04/24/2018 at 21:49 point

Amazing work, very inspiring - so much so that I just ordered an X9 and can't wait to test it out.

  Are you sure? yes | no

Curt White wrote 04/25/2018 at 01:47 point

Thanks! I plan on posting more sample sketches for the X9. With any luck I'll have a demo for PPG heart rate detection by the time you get your X9.

  Are you sure? yes | no

Tom Meehan wrote 04/25/2018 at 23:18 point

That's great - the PPG heart-rate detection is what initially interested me. Quick question - would the SEGGER J-Link EDU Mini - JTAG/SWD Debugger that Adafruit sells work for programming?

  Are you sure? yes | no

Curt White wrote 05/21/2018 at 03:14 point

Yes, that will work just fine. 

  Are you sure? yes | no

Eric Morgan wrote 04/22/2018 at 19:05 point

This is great, just ordered one of the X9 watches. What kind of range do these get with Bluetooth?

  Are you sure? yes | no

Curt White wrote 04/22/2018 at 19:23 point

Bluetooth range is solid, comparable to a FitBit. Some models have very cramped PCB trace antennas but the X9 and N68 are fine. I did run into one situation where Bluetooth range became problematic. I built an intraoral respiration monitor using a small nRF51822 activity tracker wherein the entire device resides inside the user's mouth. I cut the trace antenna at the nub and soldered a little solid copper wire antenna that can stick out of the user's mouth when necessary. Works just fine.

  Are you sure? yes | no

Curt White wrote 04/20/2018 at 04:16 point

Thanks! 

  Are you sure? yes | no

gerardwknight wrote 04/20/2018 at 02:36 point

Brilliant work, this is inspiring stuff! I hope you win, its a great field of research you have chosen, it could help many many people in the future.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates