粉粉嫩嫩的18虎白女,白丝女仆猛 喷水爽自慰,欧美嫩小槡BBBB槡BBBB槡,午夜视频在线免费观看,国产一级a毛一级a看免费视频

當前位置(zhi) : 首頁 > 應用方案 > MCU應用及方案 > 智能電動牙(ya)刷方案

軟硬件全(quan)開源(yuan),航芯方案(an)(an)分享 | 智能(neng)電(dian)動牙刷方案(an)(an)


當代口(kou)(kou)腔問題(ti)(ti)頻(pin)發,讓人們越來越重視口(kou)(kou)腔衛生。傳統的(de)刷(shua)(shua)牙(ya)(ya)(ya)方式,由于(yu)個人習慣和(he)刷(shua)(shua)牙(ya)(ya)(ya)方式的(de)不(bu)(bu)同(tong)(tong),會不(bu)(bu)同(tong)(tong)程度(du)地導致牙(ya)(ya)(ya)齦受損,牙(ya)(ya)(ya)菌斑去除(chu)不(bu)(bu)徹底等問題(ti)(ti)。而電動牙(ya)(ya)(ya)刷(shua)(shua)設備,基于(yu)其相對程序化(hua)的(de)刷(shua)(shua)牙(ya)(ya)(ya)方式,可根據(ju)個人口(kou)(kou)腔特性支(zhi)持自主選擇(ze),調節刷(shua)(shua)牙(ya)(ya)(ya)力度(du)。而且在刷(shua)(shua)牙(ya)(ya)(ya)過程中,不(bu)(bu)需(xu)要過多的(de)手部動作,僅(jin)需(xu)要調節刷(shua)(shua)牙(ya)(ya)(ya)的(de)角度(du),更(geng)多的(de)清(qing)潔工作交付由牙(ya)(ya)(ya)刷(shua)(shua)本(ben)身(shen)的(de)特性來完成。方便人們的(de)同(tong)(tong)時也更(geng)能有效(xiao)的(de)減少口(kou)(kou)腔問題(ti)(ti)。


電動牙(ya)刷類型


現在市面上電(dian)動(dong)牙刷品類(lei)繁多(duo),從刷頭的方式可將其(qi)分為兩(liang)大類(lei)型:旋轉式和振(zhen)動(dong)式(也叫聲波式)。參考



圖1. 電動牙刷工作方式對比圖


旋轉(zhuan)式電(dian)動(dong)(dong)牙(ya)(ya)(ya)刷(shua)是由電(dian)機帶動(dong)(dong)刷(shua)頭旋轉(zhuan),牙(ya)(ya)(ya)面(mian)清潔(jie)度高,但牙(ya)(ya)(ya)縫清潔(jie)能力薄弱且相較(jiao)于振動(dong)(dong)式,更(geng)易損傷(shang)牙(ya)(ya)(ya)釉質。而振動(dong)(dong)式,由電(dian)機帶動(dong)(dong)刷(shua)頭進行上(shang)下(xia)的(de)高頻(pin)振動(dong)(dong),高頻(pin)擺動(dong)(dong)的(de)刷(shua)頭能高效完成洗刷(shua)牙(ya)(ya)(ya)齒的(de)動(dong)(dong)作,可以讓牙(ya)(ya)(ya)膏與水的(de)混合物產(chan)生大量微(wei)小的(de)氣泡(pao),氣泡(pao)爆裂時產(chan)生的(de)壓力可以更(geng)深入牙(ya)(ya)(ya)縫達到(dao)深度的(de)清潔(jie)效果。


振(zhen)(zhen)動(dong)(dong)式(shi)的實(shi)現(xian)(xian)有兩種(zhong)方(fang)式(shi),一(yi)種(zhong)由偏心振(zhen)(zhen)動(dong)(dong)電(dian)(dian)機實(shi)現(xian)(xian),多(duo)用于中低(di)檔的電(dian)(dian)動(dong)(dong)牙刷方(fang)案。該(gai)種(zhong)方(fang)式(shi)的電(dian)(dian)動(dong)(dong)牙刷振(zhen)(zhen)動(dong)(dong)感強,振(zhen)(zhen)動(dong)(dong)無序。另一(yi)種(zhong)則(ze)是采用線性電(dian)(dian)機,業內也稱之為磁懸浮電(dian)(dian)機。



圖2. 磁懸(xuan)浮電機示意圖


磁(ci)懸浮(fu)電(dian)機的優點在于其(qi)在工作(zuo)運(yun)行(xing)噪聲小,機身振感低,振動能量集(ji)中,清潔(jie)效果佳(jia)。因(yin)此,本(ben)文采用ACM32F030作(zuo)為主控(kong)芯片,基于磁(ci)懸浮(fu)電(dian)機提出一款電(dian)動牙(ya)刷的設計方案。


設計方案


本文描(miao)述的(de)電動牙(ya)刷(shua)方案,是基于(yu)上海航(hang)芯ACM32F030系列(lie)的(de)MCU進行設(she)計,整體的(de)方案框(kuang)圖如(ru)下(xia)所示:



圖3. 基(ji)于ACM32F030/070電動牙(ya)刷設計(ji)方案框圖


ACM32F0X0 系(xi)列(lie)(lie)是一款支持(chi)多種低(di)(di)功(gong)耗模(mo)式(shi)(shi)的(de)通用MCU。集成12位(wei)1.6 Msps高精(jing)度(du)ADC以及比較器、運放、觸控按鍵控制器、段式(shi)(shi)LCD控制器,內置高性(xing)能定時(shi)器、多路(lu)UART、LPUART、SPI、I2C等豐富的(de)通訊外設,內建AES、TRNG等信(xin)息(xi)安(an)全模(mo)塊,支持(chi)多種低(di)(di)功(gong)耗模(mo)式(shi)(shi),具有高整合度(du)、高抗干擾、高可靠性(xing)的(de)特點。本產品采用ARM Cortex-M0系(xi)列(lie)(lie)內核,最(zui)高工(gong)作(zuo)頻率(lv)64MHz。足以滿足一般的(de)電動牙刷方案的(de)需求。



掃碼即可立即購買ACM32F070KBU7
備注:ACM32F030和070軟硬件兼容



掃碼即可立即購買開發板


軟硬件下(xia)載(zai)鏈接如下(xia):


? 人機交(jiao)互系統


本文論述的(de)(de)(de)(de)設計方(fang)(fang)案中(zhong)的(de)(de)(de)(de)人機(ji)交互功(gong)能是(shi)采用(yong)簡(jian)單的(de)(de)(de)(de)LED和(he)按鍵(jian)的(de)(de)(de)(de)方(fang)(fang)式(shi)(shi)(shi)進行實現(xian)。共有1個(ge)按鍵(jian)和(he)6個(ge)LED。按鍵(jian)需(xu)實現(xian)設備的(de)(de)(de)(de)開(kai)(kai)關(guan)機(ji)以及(ji)模(mo)式(shi)(shi)(shi)切換(huan)功(gong)能。設備會根據按鍵(jian)按下時間的(de)(de)(de)(de)長(chang)短來(lai)判(pan)定當前的(de)(de)(de)(de)動作(zuo)(zuo)是(shi)需(xu)要(yao)切換(huan)模(mo)式(shi)(shi)(shi)或是(shi)開(kai)(kai)關(guan)機(ji)操作(zuo)(zuo)。6個(ge)LED中(zhong)有3個(ge)用(yong)于工(gong)作(zuo)(zuo)模(mo)式(shi)(shi)(shi)指(zhi)示(shi),最(zui)大(da)可支持7種(zhong)工(gong)作(zuo)(zuo)模(mo)式(shi)(shi)(shi)(23-1),本設計方(fang)(fang)案中(zhong)僅提供了三(san)種(zhong)模(mo)式(shi)(shi)(shi)。另外3個(ge)LED用(yong)于系統(tong)狀態(tai)指(zhi)示(shi),包括正常,欠壓,充(chong)電,充(chong)滿4種(zhong)電壓狀態(tai)。


長(chang)短按(an)識(shi)別程序:


void keyPressHandler(void)
{
  key.isPressed = Key_GetPressValue();
  switch(key.pressState)
  {
    case 0:
      if(key.isPressed)
      {
        key.pressTime = 0;
        key.pressState = 1;
      }
      break;
    case 1:    /*  eliminate jitter  */
      if(key.isPressed)
      {
        if(++key.pressTime > 10)
          key.pressState = 2;
      }
      else
        key.pressState = 0;
      break;
    case 2:    /*  whether long press is existed  */
      if(key.isPressed)
      {
        if(++key.pressTime > LONG_PRESS_TIME)
          key.pressState = 3;
      }
      else
      {
        if(key.shortPressHandler != NULL)
          key.shortPressHandler();
        else
          DEBUG_KEY("have no short press handler!!\r\n");
        key.pressState = 0;
      }
      break;
    case 3:
      if(key.longPressHandler != NULL)
        key.longPressHandler();
      else
        DEBUG_KEY("have no long press handler!!\r\n");
      key.pressState = 4;
      break;
    case 4:    /*  wait for releasing key  */
      if(key.isPressed == 0)
        key.pressState = 0;
      break;
  }
}


工作指示程序:


void appMotorModeLedControl(void)
{
  static uint8_t state = 0xFF;
       
  if(sys.status == SYSTEM_RUNMODE)
  {
    if(state != sys.motorStatus)
    {
      state = sys.motorStatus;
      if(sys.motorStatus == 0)
      {
        ModeLed_Select(MODE_LED_1, MODE_LED_ON);
      }
      else if(sys.motorStatus == 1)
      {
        ModeLed_Select(MODE_LED_2, MODE_LED_ON);
      }
      else if(sys.motorStatus == 2)
      {
        ModeLed_Select(MODE_LED_3, MODE_LED_ON);
      }
    }
  }
  else
  {
    state = 0xFF;
    ModeLed_Select(MODE_LED_UNKNOWN, MODE_LED_OFF);
  }
}


系(xi)統指示程序(xu):


void appSysLedController(void)
{
  static uint8_t led_state = 0xFF;
       
  if(led_state != led.state)
  {
    led_state = led.state;
    if(led.state == LED_OFF)
    {
      led.duty = 0;
      PowerLed_Select(PWR_LED_UNKNOWN, PWR_LED_OFF);
      PWM_dutySet(PWM_LED, led.duty);
    }
    else if(led.state == LED_TWINKLE)    // low power warning
    {
      led.duty = 0;
      PowerLed_Select(PWR_LED_R, PWR_LED_ON);
      PWM_dutySet(PWM_LED, led.duty);
    }
    else if(led.state == LED_ON)
    {
      led.duty = 0;
      PowerLed_Select(PWR_LED_R, PWR_LED_OFF);
      PWM_dutySet(PWM_LED, led.duty);
    }
    else if(led.state == LED_BREATHE)
    {
      if(led.duty == PWM_DUTY_MAX)
        led.dir = LED_FADE;
      else
        led.dir = LED_BRIGHTER;
    }
    else
      led.state = LED_OFF;
  }
  else{
    if(led.state == LED_BREATHE)
    {
      PowerLed_Select(PWR_LED_UNKNOWN, PWR_LED_OFF);
      if(led.dir == LED_BRIGHTER)
      {
        if(led.duty < PWM_DUTY_MAX)
          led.duty += BREATHE_INTERVAL;
        else
        {
          if(++led.cnt > BREATHE_HOLD_TIME)
          {
            led.dir = LED_FADE;
            led.cnt = 0;
          }
        }
      }
      else
      {
        if(led.duty > BREATHE_INTERVAL)
          led.duty -= BREATHE_INTERVAL;
        else
        {
          led.duty = 0;
          if(++led.cnt > BREATHE_HOLD_TIME)
          {
            led.dir = LED_BRIGHTER;
            led.cnt = 0;
          }
        }
      }
      PWM_dutySet(PWM_LED, led.duty);
    }
  }
}


? 電源及功耗管理


電(dian)動(dong)牙刷產品的(de)續航能(neng)力(li)也是一直備(bei)受(shou)人們(men)關(guan)注(zhu)。本設計方(fang)案在(zai)低功耗的(de)處理(li),摒(bing)棄(qi)了(le)一般(ban)的(de)休眠方(fang)式,直接采用(yong)關(guan)閉(bi)電(dian)源來(lai)避免設備(bei)在(zai)不(bu)工作狀態(tai)下的(de)設備(bei)功耗。整個(ge)設備(bei)的(de)供電(dian)線(xian)路共有(you)三種,如下圖所示。



圖(tu)4. 基于ACM32F030的(de)電(dian)動牙(ya)刷供電(dian)電(dian)路(lu)(部分)


正(zheng)常情況(kuang)下,設(she)備不在(zai)充電(dian)(dian)時(shi)(shi),VCHARG電(dian)(dian)壓(ya)(ya)為0,需要(yao)關(guan)(guan)機(ji)時(shi)(shi),按(an)(an)鍵(jian)(jian)彈開(kai),PWR_KEY為低(di)電(dian)(dian)平,芯片內部程(cheng)序也將(jiang)PWR_LOCK拉(la)低(di),此時(shi)(shi)Q2關(guan)(guan)斷,Q2的(de)D極電(dian)(dian)壓(ya)(ya)同(tong)VBAT,從(cong)而引起Q1斷開(kai),VCCIN斷電(dian)(dian),系統(tong)關(guan)(guan)機(ji)。而開(kai)機(ji)時(shi)(shi),按(an)(an)鍵(jian)(jian)按(an)(an)下,PWR_KEY先(xian)被拉(la)至(zhi)高電(dian)(dian)平,Q2導通,Q2的(de)D極拉(la)低(di),則(ze)Q1導通,設(she)備供(gong)(gong)電(dian)(dian),程(cheng)序檢測到開(kai)機(ji),拉(la)高PWR_LOCK,此時(shi)(shi),盡管按(an)(an)鍵(jian)(jian)彈開(kai),PWR_LOCK仍然會(hui)提(ti)供(gong)(gong)Q2的(de)導通電(dian)(dian)壓(ya)(ya),系統(tong)正(zheng)常工作。充電(dian)(dian)時(shi)(shi),Q2的(de)導通電(dian)(dian)壓(ya)(ya)會(hui)由VCHARG提(ti)供(gong)(gong),系統(tong)保(bao)持在(zai)工作狀(zhuang)態,此時(shi)(shi)會(hui)程(cheng)序會(hui)檢測系統(tong)的(de)運行(xing)狀(zhuang)態,在(zai)不需要(yao)啟動時(shi)(shi),進(jin)入休眠狀(zhuang)態。


電(dian)源管理部分,則通(tong)過(guo)鋰電(dian)池(chi)(chi)充(chong)(chong)電(dian)芯(xin)片(pian)檢(jian)測(ce)是(shi)否進(jin)行充(chong)(chong)電(dian),同時通(tong)過(guo)一路ADC監測(ce)電(dian)池(chi)(chi)電(dian)壓。為減(jian)少芯(xin)片(pian)工作負擔,電(dian)池(chi)(chi)電(dian)壓的欠壓和滿電(dian)通(tong)過(guo)ADC門限(xian)電(dian)壓功能來(lai)實現。ADC的門限(xian)電(dian)壓初始化程序(xu)如(ru)下:


// ADC Watchdog config
  ADC_WDT_Handle.ITMode      = ENABLE;
  ADC_WDT_Handle.WatchdogMode  = ADC_ANALOGWATCHDOG_RCH_ALL;
  ADC_WDT_Handle.Channel      = channel;
  ADC_WDT_Handle.HighThreshold  = (HIGH_POWER_THS * 0x0FFF) / VREF ;
  ADC_WDT_Handle.LowThreshold  = (LOW_POWER_THS * 0x0FFF) / VREF ;


? 智能管理系統


智能(neng)管理(li)系統(tong)分(fen)為兩個部(bu)分(fen),一(yi)部(bu)分(fen)為上位機(ji)的數(shu)(shu)(shu)據(ju)處理(li),由云(yun)端處理(li),另(ling)一(yi)部(bu)分(fen)是電動(dong)牙(ya)刷(shua)數(shu)(shu)(shu)據(ju)記錄(lu)和傳輸(shu)(shu)。整(zheng)個的實現過(guo)程可簡述(shu)為,電動(dong)牙(ya)刷(shua)通過(guo)慣性(xing)測量儀QMI8658C記錄(lu)電動(dong)牙(ya)刷(shua)在使用過(guo)程中的運動(dong)軌跡,并實時(shi)將該(gai)部(bu)分(fen)數(shu)(shu)(shu)據(ju)以及整(zheng)個系統(tong)的工(gong)作(zuo)參(can)數(shu)(shu)(shu)通過(guo)BLE發送到(dao)手(shou)機(ji),手(shou)機(ji)連接云(yun)端,并將數(shu)(shu)(shu)據(ju)傳輸(shu)(shu)至(zhi)云(yun)平臺進行數(shu)(shu)(shu)據(ju)解析(xi)(xi),分(fen)析(xi)(xi)用戶刷(shua)牙(ya)的健(jian)康(kang)指(zhi)數(shu)(shu)(shu),并將相關建議反饋至(zhi)手(shou)機(ji)。電動(dong)牙(ya)刷(shua)作(zuo)為數(shu)(shu)(shu)據(ju)采(cai)集設備,需上報實時(shi)數(shu)(shu)(shu)據(ju),結構如下:


typedef __packed struct{
  uint32_t time;          // This shows the relative time of each activity
  uint16_t location[3];        // This shows the acceleration of brush when using
  uint16_t pressure;        // This is the force between tooth and brush
  uint16_t angle[3];        // This shows the angle between brush
       
}BLE_RealTimeDataDef;        // This define the data structure about brushing tooth in real time


其中,location為(wei)三軸的(de)加速度,angle為(wei)三軸的(de)角度。定時(shi)(shi)上傳(chuan)電(dian)動(dong)牙刷的(de)相關實時(shi)(shi)數據。上位機根據一(yi)系列點位數據進(jin)行建(jian)模(mo)計算可得到(dao)整個(ge)牙刷的(de)運動(dong)軌跡。


? 電機驅動系統


電動(dong)(dong)牙刷的驅動(dong)(dong)系統是通過H橋芯片MX612E進(jin)行(xing)處理,MX612E的輸(shu)入(ru)端連接芯片的PWM互補輸(shu)出端口。如下圖所示:



圖5. 電動牙刷電機驅動電路


本設計(ji)中的電(dian)動牙刷(shua)(shua)采用磁懸浮電(dian)機(ji)(ji),內部構造(zao)(zao)和直流(liu)無刷(shua)(shua)電(dian)機(ji)(ji)相(xiang)似,但相(xiang)比(bi)于直流(liu)無刷(shua)(shua)電(dian)機(ji)(ji),其僅有兩相(xiang)輸(shu)入端。這也(ye)就造(zao)(zao)成該電(dian)機(ji)(ji)在通電(dian)后(hou),正(zheng)負極(ji)不變的情況(kuang)下,電(dian)機(ji)(ji)旋(xuan)(xuan)轉(zhuan)(zhuan)至(zhi)某一(yi)角度形(xing)成平衡(heng)(heng)后(hou)將(jiang)會(hui)停(ting)止旋(xuan)(xuan)轉(zhuan)(zhuan)。切換(huan)正(zheng)負極(ji)后(hou)則又(you)會(hui)在另(ling)一(yi)個(ge)方向(xiang)旋(xuan)(xuan)轉(zhuan)(zhuan)形(xing)成平衡(heng)(heng)。在電(dian)動牙刷(shua)(shua)的正(zheng)常工作中,是通過兩相(xiang)的正(zheng)負極(ji)切換(huan)來使電(dian)機(ji)(ji)正(zheng)反旋(xuan)(xuan)轉(zhuan)(zhuan)從而帶(dai)動刷(shua)(shua)頭做高頻運(yun)動的。因此,其電(dian)機(ji)(ji)速度的控制依靠于輸(shu)出PWM的輸(shu)出頻率而非占空比(bi)。控制代碼如下:


void PWM_freqSet(uint8_t PWMx, uint16_t freq)
{
  uint32_t arr;
  if(IS_PWM_INSTANCE(PWMx) == 0)  return;
  if(freq == 0)
  {
    TIM15->ARR = 0;
    return;
  }
  if(freq > PWM_FREQ_MAX)  freq = PWM_FREQ_MAX;
  if(freq < PWM_FREQ_MIN) freq = PWM_FREQ_MIN;
  arr = (PWM_TIMER_FRE / freq);
  if(PWMx == PWM_MOTOR)
  {
    TIM15->ARR = arr-1;
    TIM15->CCR1 = arr / 2;
  }
}


上例中,PWM的占(zhan)空比(bi)為50%,使(shi)得在一個(ge)PWM周期內,電機可完成(cheng)一次往返運動。


本文提出的(de)(de)(de)設計方案的(de)(de)(de)主旨是將電(dian)動(dong)(dong)牙(ya)刷智(zhi)能(neng)化,在提高(gao)人(ren)們刷牙(ya)效率的(de)(de)(de)同時,也(ye)能(neng)達到進一步(bu)保(bao)證人(ren)們刷牙(ya)質量(liang)的(de)(de)(de)目(mu)的(de)(de)(de)。通過(guo)電(dian)動(dong)(dong)牙(ya)刷對(dui)慣性的(de)(de)(de)數據采集,實時上傳至(zhi)云端,并對(dui)數據進行處理,恢(hui)復用戶的(de)(de)(de)刷牙(ya)軌跡,給出合理建議,糾正用戶不良的(de)(de)(de)刷牙(ya)習慣。磁懸浮電(dian)機的(de)(de)(de)高(gao)頻振動(dong)(dong)也(ye)能(neng)有效清除口腔(qiang)污漬。歲月恒久遠,牙(ya)齒永(yong)相隨(sui) ^-^。


上(shang)海(hai)航(hang)芯(xin) · 原廠直(zhi)連: