BreathSync: Your Desk Soulmate
Introduction
In modern high-pressure academic and professional environments, the concept of "monitoring" often implies stress, while "productivity" is frequently linked to anxiety. This project aims to transform this negative pressure into a positive, interactive force of companionship.
BreathSync is an ambient breathing light device designed to address the issues of attention fatigue and psychological burnout during long working hours. The core objective is to leverage the principle of "Brainwave Entrainment." Research suggests that synchronized frequencies can relax or stimulate the brain; specific light rhythms can extend attention spans, alleviate stress, and enhance memory. By utilizing varying light colors and breathing frequencies, the device guides users into either a state of deep relaxation or high-focus concentration.
Key Functions
• Emotion-Rhythm Synchronization:
Manual Calibration Mode: Users can intuitively adjust the lighting to match their current state through physical knobs. This includes toggling between "Relaxation (Low Pulse)" for calmness and "High-Efficiency (High Pulse)" for focus, as well as fine-tuning color and brightness.
Active Sensing Mode: Integrated with an ultrasonic sensor to monitor the distance between the user and the desk. If the user is leaning too close—indicating potential fatigue or excessive tension—the device will automatically trigger a "Warning Alert Mode" to prompt a postural correction or a break.
Surprise Mode: Featuring a capacitive touch sensor. When the user interacts with the "Ice Cube," it responds with a randomly generated color in a breathing pattern, providing a sense of unexpected companionship and delight.
• Dynamic Breathing Visuals:
Chromatic Fluidity: Utilizing a high-resolution RGB LED ring to provide a seamless, non-fragmented full-spectrum display. The colors can be customized to resonate with the user’s specific emotional needs.
Biometric Pulse: The lighting logic is designed with a non-linear brightness curve (0% → 100% → 0%). This sophisticated dimming algorithm mimics the natural ebb and flow of human breathing, creating a more organic and soothing atmosphere.
Introduction:
在現代高壓的學習與工作環境中,「監控」往往意味著壓力,而「效率」則常伴隨著焦慮。本計畫旨在將這種負面壓力轉化為一種互動式的陪伴的正向驅動力。這是一款呼吸燈裝置,旨在解決使用者在長時間工作時注意力潰散與心理疲勞的問題。核心目標是透過「腦波同步(Brainwave Entrainment)」原理,利用不同頻率的燈光顏色與呼吸節奏,引導使用者進入放鬆或高專注的心理狀態。
腦波同步:有研究顯示腦波同步可以放鬆或刺激大腦;不同的頻率可以延長注意力持續時間、減輕壓力並幫助記憶。
Key Functions:
情緒節奏同步: 手動調整模式 - 讓使用者根據當下心情旋鈕式調整「放鬆 (低頻) 」或「高效 (高頻) 」,以及顏色、亮度等。主動感測模式 - 加入一個超音波感測器感測使用者與桌面的距離 (如果靠得太近,可能代表疲勞或過度緊繃),進而自動觸發提醒模式。驚喜模式 - 使用觸摸感測模塊,當使用者觸碰機器人時,會給予隨機顏色的呼吸回應。
動態呼吸視覺: 顏色 - 依使用者不同心情,使用可調整且不斷層的全彩燈環以對應顏色。律動 - 設計非線性的亮度變化(0% → 100% → 0%),模擬人類呼吸的起伏。
Supplies
- Arduino Uno R4 WiFi
- HC-SR04 超音波感測器
- TTP223 觸摸感測器模組
- 旋轉編碼器模塊 x3
- WS2812B RGB 全彩 16顆燈環 x1
Circuit Diagram
Device Functionality
- Manual Mode (Calibration):
- Adjust Color (0-360° Hue, ending in Pink), Breathing Frequency (Fast/Slow), and Brightness via triple rotary knobs.
- Users can customize their own "Relaxation (Low Pulse)" or "High-Efficiency (High Pulse)" modes according to their mood.
- Active Sensing (Proximity Alert):
- Trigger: When the ultrasonic sensor detects a distance $<$ 20 cm for over 2 seconds without knob interaction.
- Visual Feedback: The LED ring switches to a Steady Orange Light, prompting the user to correct their posture or take a break from fatigue.
- Surprise Mode:
- Activation: Triggered by tapping the capacitive touch sensor located on the robot's arm.
- Dynamic Effect: Automatically cycles to a new random color upon completing each breathing cycle.
- Deactivation: Toggle off by touching the arm again, or simply turn the "Color Knob" to instantly return to Manual Mode.
- Breathing Logic:
- Utilizes a non-linear brightness curve to simulate the natural ebb and flow of human respiration.
裝置功能統整
- 手動調頻模式:
- 透過頭部與兩側旋鈕,可即時調整顏色 (0-360° 色環,結束在粉紅)、呼吸頻率 (快/慢) 與顯示亮度。
- 使用者可依心情自行定義「放鬆低頻」或「高效高頻」模式。
- 主動感測提醒:
- 觸發條件: 當超音波偵測到使用者距離小於 20 公分,且超過 2 秒未操作旋鈕。
- 視覺反饋: 燈環切換為橘色恆亮,提醒使用者注意坐姿或過度疲勞。
- 隨機驚喜模式:
- 觸發方式: 輕觸機器人手臂的觸摸感測器。
- 動態效果: 每完成一個呼吸循環,即自動變換一種隨機顏色。
- 解除方式: 再次觸摸手臂,或直接轉動「顏色旋鈕」即可切換回手動模式。
- 動態呼吸視覺:
- 採用非線性亮度變化,模擬人類真實呼吸起伏。
Arduino Code
#include <Adafruit_NeoPixel.h>
// --- 1. 定義腳位 ---
#define PIN_NEOPIXEL 6 // LED燈環訊號線
#define NUM_LEDS 16 // 燈珠數量
#define TRIG_PIN 2 // 超音波接收訊號
#define ECHO_PIN 3 // 超音波接收回聲
#define PIN_HUE_POT A0 // 顏色旋鈕
#define PIN_SPEED_POT A2 // 頻率旋鈕
#define PIN_BRIGHT_POT A3 // 亮度旋鈕
#define PIN_ALARM_SWITCH 7 // 提醒功能開關
#define PIN_TOUCH 4 // 觸摸感測器
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
// --- 2. 變數紀錄 ---
int last_A0 = 0, last_A2 = 0, last_A3 = 0; // 紀錄上一次旋鈕的位置,用來比對是否有被轉動
unsigned long last_interaction_time = 0; // 紀錄最後一次有人摸機器的時間
const int sensitivity = 15; // 靈敏度,防止雜訊導致顏色亂跳
bool randomMode = false; // 目前是否處於「隨機模式」
uint32_t randomColor; // 儲存目前隨機抽到的顏色
bool lastTouchState = LOW; // 紀錄上一次觸摸狀態,用來判斷「剛按下」的那一刻
void setup() {
strip.begin();
strip.show();
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
pinMode(PIN_ALARM_SWITCH, INPUT_PULLUP);
pinMode(PIN_TOUCH, INPUT);
randomSeed(analogRead(A5)); // 利用未接線腳位的雜訊,讓每次開機的隨機序號都不同
randomColor = strip.Color(random(255), random(255), random(255));
Serial.begin(9600);
}
void loop() {
// --- A. 讀取當前所有感測器數值 ---
int cur_A0 = analogRead(PIN_HUE_POT);
int cur_A2 = analogRead(PIN_SPEED_POT);
int cur_A3 = analogRead(PIN_BRIGHT_POT);
long distance = checkDistance();
bool alarmEnabled = (digitalRead(PIN_ALARM_SWITCH) == LOW);
bool currentTouch = digitalRead(PIN_TOUCH);
// --- B. 觸摸邏輯:偵測到「按下」的那瞬間,切換模式 ---
if (currentTouch == HIGH && lastTouchState == LOW) {
randomMode = !randomMode; // 開關切換
if (randomMode) {
randomColor = strip.Color(random(255), random(255), random(255)); // 進入隨機時先抽一個色
}
delay(200); // 避開手指觸摸時的機械震盪(防彈跳
}
lastTouchState = currentTouch;
// --- C. 旋鈕優先邏輯:如果你動了「顏色旋鈕」,就取消隨機模式 ---
if (abs(cur_A0 - last_A0) > sensitivity) {
randomMode = false; // 強制切換回手動控制顏色
last_A0 = cur_A0;
}
// 更新互動計時 (這部分維持所有旋鈕都能更新,確保超音波提醒不會在你調整時誤觸)
if (abs(cur_A0 - last_A0) > sensitivity || abs(cur_A2 - last_A2) > sensitivity || abs(cur_A3 - last_A3) > sensitivity) {
last_interaction_time = millis();
last_A0 = cur_A0; last_A2 = cur_A2; last_A3 = cur_A3;
}
// --- D. 最終顯示判斷 ---
// 如果開啟了開關 + 距離太近 + 超過2秒沒人操作 -> 執行橘色警示
if (alarmEnabled && distance > 0 && distance < 20 && (millis() - last_interaction_time > 2000)) {
showSteadyOrange();
} else {
// 否則,執行呼吸燈模式
runBreathingCycle(alarmEnabled);
// 如果是隨機模式,每跑完一個呼吸循環,就自動換一個顏色
if (randomMode) {
randomColor = strip.Color(random(255), random(255), random(255));
}
}
}
// --- 【功能副程式】 ---
// 【橘色恆亮模式】::太靠近時觸發
void showSteadyOrange() {
strip.setBrightness(110);
for(int i=0; i<NUM_LEDS; i++) {
strip.setPixelColor(i, 255, 75, 0);
}
strip.show();
delay(50);
}
// 【呼吸燈循環】:控制亮度從 0 -> 255 -> 0 的變化
void runBreathingCycle(bool alarmOn) {
for (int b = 0; b <= 255; b += 5) {
if (updateAndCheck(b, alarmOn)) return; // 漸亮
}
for (int b = 255; b >= 0; b -= 5) {
if (updateAndCheck(b, alarmOn)) return; // 漸暗
}
}
// 【即時更新檢查】:在每一點點亮度變化時都重新讀取旋鈕,使調整時不會有延遲感
bool updateAndCheck(int current_b, bool alarmOn) {
int hue = analogRead(PIN_HUE_POT);
int spd = analogRead(PIN_SPEED_POT);
int brt = analogRead(PIN_BRIGHT_POT);
long dist = checkDistance();
if (abs(hue-last_A0)>sensitivity) { last_A0 = hue; }
if (abs(spd-last_A2)>sensitivity) { last_A2 = spd; }
if (abs(brt-last_A3)>sensitivity) { last_A3 = brt; }
// 決定顏色
uint32_t finalColor = randomMode ? randomColor : getHueColor(hue);
// 即時套用旋鈕調整的「速度」與「亮度」
int delayTime = map(spd, 0, 1023, 5, 80);
int max_b = map(brt, 0, 1023, 0, 255);
// 顯示當前亮度的顏色
applyColor(finalColor, map(current_b, 0, 255, 0, max_b));
delay(delayTime);
// 強制中斷檢查:如果發生以下情況,立刻跳出呼吸循環
if (alarmOn && dist > 0 && dist < 20 && (millis() - last_interaction_time > 2000)) return true;
if (digitalRead(PIN_TOUCH) == HIGH) return true; // 摸了感測器切換模式
if (abs(hue - last_A0) > sensitivity) return true; // 動了顏色旋鈕切換模式
return false;
}
// 【色彩計算機】:將 0~1023 轉成粉紅色截止的色輪
uint32_t getHueColor(int val) {
byte pos = map(val, 0, 1023, 0, 220); // 220 避開紅色回到起點,停在粉紅
pos = 255 - pos;
// 標準 RGB 色輪轉換邏輯
if(pos < 85) return strip.Color(255 - pos * 3, 0, pos * 3);
if(pos < 170) { pos -= 85; return strip.Color(0, pos * 3, 255 - pos * 3); }
pos -= 170; return strip.Color(pos * 3, 255 - pos * 3, 0);
}
// 【執行顯示】:把計算好的 RGB 送到 LED 燈珠上
void applyColor(uint32_t c, int brightness) {
strip.setBrightness(brightness);
for(int i=0; i<NUM_LEDS; i++) strip.setPixelColor(i, c);
strip.show();
}
// 【距離探測器】:計算超音波回傳的時間並換算成公分
long checkDistance() {
digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
long duration = pulseIn(ECHO_PIN, HIGH, 30000);
if (duration == 0) return 999;
return duration / 29 / 2;
}
Appearance
The device is housed in a custom 3D-printed desktop robot enclosure, where each hardware component is thoughtfully integrated into the character's narrative form:
- Rotary Controls: Three potentiometers are positioned on the top and sides of the head, providing an intuitive tactile experience for parameter adjustments.
- Tactile Interaction: A capacitive touch sensor is embedded within the robot's arm to detect physical engagement and user interaction.
- Sensory Goggles: An ultrasonic sensor is concealed within the flight goggles on the robot's head, allowing for discreet and non-intrusive proximity detection.
- Light Diffusion: A 16-bit RGB LED ring is housed inside the hollowed-out torso. The opening is covered with a translucent material to diffuse the light, creating a soft and organic "breathing" effect.
裝置採用專屬的 3D 列印桌上型機器人外殼,將各項硬體組件融入角色的造型結構中:
- 旋鈕控制:頭部上方與兩側配置了三個旋鈕,提供直覺的參數調整體驗。
- 觸覺互動:機器人的手臂內嵌了電容式觸摸感測器,用以偵測使用者的物理觸碰與互動。
- 感測護目鏡:頭部配戴的飛行眼鏡中隱藏了超音波感測器,能較不明顯的方式進行距離偵測。
- 燈光漫射:機器人腹部的簍空處內置了 16 顆 RGB LED 燈環。開口處覆蓋著半透明材料以擴散光線,營造出柔和的呼吸效果。
https://youtube.com/shorts/oBle1v5x9R0?si=zUYjbXIxBtSv1TPL