|
| 1 | +## Circadian Rhythm Clock (CRS Clock) for Bangle.js 2 |
| 2 | + |
| 3 | +### **Overview** |
| 4 | + |
| 5 | +**Circadian Rhythm Clock** is an advanced wellness clock for Bangle.js 2 that estimates and visualizes your body’s internal circadian time and alignment. It calculates a personalized **Circadian Rhythm Score (CRS)** using your recent sleep timing, physical activity patterns, and (optionally) heart rate data. The app helps users monitor their biological rhythms, optimize their sleep, and maintain healthy light/activity habits—even on a device with limited sensors. |
| 6 | + |
| 7 | +### **Core Features** |
| 8 | + |
| 9 | +#### **1. Real-Time CRS Calculation** |
| 10 | + |
| 11 | +* **CRS** is computed as a composite index using: |
| 12 | + |
| 13 | + * **Sleep Timing** (from sleep/wake detection or manual window) |
| 14 | + * **Activity Stability** (based on step data over the last 24 hours) |
| 15 | + * **Heart Rate Stability** (if HR sensor is enabled) |
| 16 | + * **Light Exposure Proxy** (counts “light hours” based on daytime activity if no light sensor is present) |
| 17 | +* **CRS** is shown directly on the main clock face, updated every minute. |
| 18 | + |
| 19 | +#### **2. Biological Time Display** |
| 20 | + |
| 21 | +* Shows the current **estimated biological time (“BioTime”)** in large, clear digits. |
| 22 | +* BioTime is adjusted using the user’s sleep phase offset and a configurable reference point (e.g., DLMO or CBTmin). |
| 23 | + |
| 24 | +#### **3. Health and Circadian Stats** |
| 25 | + |
| 26 | +* The main screen presents: |
| 27 | + |
| 28 | + * **CRS:** Current circadian rhythm score (0–100) |
| 29 | + * **Steps:** Total steps in the last 24 hours |
| 30 | + * **Mood:** Detected from heart rate variability (HRV proxy) |
| 31 | + * **Light:** Estimated hours of daytime activity (“light exposure”) |
| 32 | +* All stats update automatically. |
| 33 | + |
| 34 | +#### **4. Trend Visualization** |
| 35 | + |
| 36 | +* **CRS Trend Chart:** Shows CRS for each hour over the past 8–12 hours in a bar graph (visually displays circadian stability). |
| 37 | +* Helps users see the rhythm and recent disruptions. |
| 38 | + |
| 39 | +#### **5. Automatic Sleep & Wake Detection** |
| 40 | + |
| 41 | +* Uses step activity and (optionally) movement detection to infer sleep start/end times. |
| 42 | +* Triggers friendly alerts when sleep or wake is detected. |
| 43 | + |
| 44 | +#### **6. Hydration and Wellness Reminders** |
| 45 | + |
| 46 | +* Optional periodic reminders to hydrate, based on a user-configurable interval. |
| 47 | + |
| 48 | +#### **7. Simple Settings Menu** |
| 49 | + |
| 50 | +* Configure: |
| 51 | + |
| 52 | + * Sleep window (manual entry) |
| 53 | + * Hydration reminder interval |
| 54 | + * Theme/color scheme |
| 55 | + * Circadian reference (DLMO/CBTmin) |
| 56 | + * Heart rate and sleep detection settings |
| 57 | + |
| 58 | +#### **8. Data Export & Reset** |
| 59 | + |
| 60 | +* Exports historical step, heart rate, and light proxy data as JSON for external analysis. |
| 61 | +* Full app data reset available from the menu. |
| 62 | + |
| 63 | +#### **9. Efficient and Stable Operation** |
| 64 | + |
| 65 | +* Aggressively trims stored history to a set maximum (e.g., 200 entries) to ensure stability and prevent memory overflows. |
| 66 | +* All heavy computations (like trend chart) are run only on-demand. |
| 67 | + |
| 68 | +### **Sensor/Hardware Adaptation** |
| 69 | + |
| 70 | +* If the **heart rate sensor** is unavailable or disabled, the app uses step/activity stability only. |
| 71 | +* If **no light sensor** is present (default for Bangle.js 2), the app estimates “light exposure” as the number of hours the user is active during daytime, outside their sleep window. |
| 72 | +* The app is robust to missing or partial data. |
| 73 | + |
| 74 | +### **User Experience** |
| 75 | + |
| 76 | +* **Always-on Clock:** Appears as the default watch face, with tap, button, or swipe to access stats and menu. |
| 77 | +* **Vivid, readable interface** with color themes and a clean, minimal design. |
| 78 | +* **Alerts** for hydration and sleep transitions are gentle and non-intrusive. |
| 79 | + |
| 80 | + |
| 81 | +### **Intended Users** |
| 82 | + |
| 83 | +* Anyone interested in **improving sleep, productivity, or circadian health**. |
| 84 | +* Shift workers, travelers, or students seeking to track and align their biological clocks. |
| 85 | +* Users who want more than a step counter—actionable, science-based feedback on internal time. |
| 86 | + |
| 87 | +### **How It Works** |
| 88 | + |
| 89 | +1. **Collects step and (optionally) heart rate data** in real-time. |
| 90 | +2. **Calculates CRS** using the variability and timing of steps, sleep, and HR (if available). |
| 91 | +3. **Estimates light exposure** hours using step data during daytime. |
| 92 | +4. **Presents key circadian health metrics** on the main watch face. |
| 93 | +5. **Offers friendly reminders** and data export for deeper analysis. |
| 94 | + |
| 95 | +### **Technical Details** |
| 96 | + |
| 97 | +* **Code:** JavaScript (Espruino), optimized for Bangle.js 2 |
| 98 | +* **Persistent storage:** Steps, heart rate, and light/“light hour” proxies saved locally, aggressively pruned for memory safety. |
| 99 | +* **User interface:** Button/touch/swipe navigation, E.showMenu/E.showAlert for dialogs, custom clock face rendering. |
| 100 | +* **No dependencies:** Runs entirely on the watch—no phone, no cloud required. |
| 101 | + |
| 102 | +## Author |
| 103 | + |
| 104 | +Jakub Tencl, Ph.D. |
| 105 | +[https://ihypnosis.org.uk](https://ihypnosis.org.uk) |
| 106 | + |
| 107 | +## Patent and Licensing |
| 108 | + |
| 109 | +This app is based on methods described in UK Patent Application GB2509149.7: |
| 110 | +**"Wearable Circadian Rhythm Score (CRS) System for Estimating Biological Time"** |
| 111 | + |
| 112 | +Unless otherwise stated, this project is released under the MIT license. |
| 113 | +Use of the patented method may be subject to licensing or permission. |
| 114 | +For inquiries, contact the author. |
| 115 | + |
| 116 | +### **Summary** |
| 117 | + |
| 118 | +The Circadian Rhythm Clock transforms the Bangle.js 2 into a **bio-aware, personalized circadian dashboard**, guiding users toward better alignment with their biological clock and modern life. |
| 119 | +It is ideal for anyone who wants to visualize and optimize their internal rhythms using open, transparent algorithms—right on their wrist. |
0 commit comments