聚豐項(xiàng)目 > 無線充電卡通鬧鐘

無線充電卡通鬧鐘

將普通的指針式卡通鬧鐘,改造成電子LED矩陣顯示無線充電的卡通鬧鐘。因?yàn)榫仃囀絃ED顯示屏耗電較大需要經(jīng)常充電,用普通充電器充要經(jīng)常插拔電源線很麻煩,用了IDT的15W無線充電套件就不用這么麻煩了,鬧鐘沒電了只要將它放在無線充電底座上就可以方便的充電了,隨放隨充相當(dāng)方便,非常便利。這個(gè)鬧鐘還有改進(jìn)的地方,后續(xù)可以將無線充電狀態(tài)從I2C總線讀取并顯示在顯示屏上,這樣就可以直觀的了解充電情況。(本項(xiàng)目采用的是IDT 15W無線充電開發(fā)套件)

expertss expertss

分享
2 喜歡這個(gè)項(xiàng)目
團(tuán)隊(duì)介紹

expertss expertss

團(tuán)隊(duì)成員

羅鵬 硬件工程師

分享
項(xiàng)目簡(jiǎn)介
將普通的指針式卡通鬧鐘,改造成電子LED矩陣顯示無線充電的卡通鬧鐘。因?yàn)榫仃囀絃ED顯示屏耗電較大需要經(jīng)常充電,用普通充電器充要經(jīng)常插拔電源線很麻煩,用了IDT的15W無線充電套件就不用這么麻煩了,鬧鐘沒電了只要將它放在無線充電底座上就可以方便的充電了,隨放隨充相當(dāng)方便,非常便利。這個(gè)鬧鐘還有改進(jìn)的地方,后續(xù)可以將無線充電狀態(tài)從I2C總線讀取并顯示在顯示屏上,這樣就可以直觀的了解充電情況。(本項(xiàng)目采用的是IDT 15W無線充電開發(fā)套件)
硬件說明


 

硬件組成:

  1. IDT 15W  無線充電套件

  2. AVR單片機(jī)控制LED顯示屏,后續(xù)讀取15W套件接收板I2C總線數(shù)據(jù),并顯示。

  3. TI的電源管理芯片,負(fù)責(zé)鋰電池充電,電池和無線電源供電的切換。

軟件說明

軟件部分:

開發(fā)平臺(tái):ICCAVR  AVRSTUDIO

部分顯示代碼:

 

void initia_gram(unsigned char *ledgram)
{
 unsigned char i;
 
 for(i = 0;i < 64;i++)
   {
    *ledgram = 0xff;
    ledgram++;
   }
}


void refresh_timeonled(unsigned char *datedata,unsigned char *ledgram,const unsigned char *BufferPoint)
{
  const unsigned char *zikubuffertemp;
  unsigned char *ledgramtemp;
  unsigned char i,j;
 
  zikubuffertemp = BufferPoint;
  ledgramtemp = ledgram + 4;
  // 顯示在第二行開始 +4
 
  datedata += 5;
  //指向小時(shí)  5   指向分鐘 3
 
  for(i = 0;i < 4;i++)
    {
  zikubuffertemp += *datedata * 8;
  ledgramtemp += i;
 
  for(j = 0;j < 8;j++)
    {
     switch(i)
    {
     case 0:
       if(*datedata == 0)
      *(ledgramtemp + j * 4) = 0xFF;
    else
         *(ledgramtemp + j * 4) = (*zikubuffertemp >> 1) | 0x80;
          zikubuffertemp++;
     break;
     case 1:
       if(j == 1)
         *(ledgramtemp + j * 4) = *zikubuffertemp & 0xFE;
    else if(j == 5) 
      *(ledgramtemp + j * 4) = *zikubuffertemp & 0xFE;
    else
      *(ledgramtemp + j * 4) = *zikubuffertemp;
          zikubuffertemp++;
     break;
     case 2:
       if(j == 1)
         *(ledgramtemp + j * 4) = ((*zikubuffertemp >> 2) | 0xC0) & 0x7F;
    else if(j == 5)
      *(ledgramtemp + j * 4) = ((*zikubuffertemp >> 2) | 0xC0) & 0x7F;
    else
      *(ledgramtemp + j * 4) = (*zikubuffertemp >> 2) | 0xC0;
          zikubuffertemp++;
     break;
     case 3:
       *(ledgramtemp + j * 4) = (*zikubuffertemp >> 1) | 0x80;
          zikubuffertemp++;
     break;
     default:
     break;
    }
    }
  --datedata;
  zikubuffertemp = BufferPoint;
     ledgramtemp = ledgram + 4;
 }
}

 


//------------------------------------------------------------------------------
//
//  將顯示緩沖區(qū)內(nèi)的數(shù)據(jù)發(fā)送到LED點(diǎn)陣上 點(diǎn)陣32 * 16
//  輸入: 指向顯示緩沖區(qū)的指針
//  輸出: 無
void ShowPicONLED(unsigned char *BufferPoint,unsigned char x_wide,unsigned char y_high,unsigned char x_pos,unsigned char y_pos,unsigned char roll_switch)
{
   unsigned char i = 8;
   unsigned int j = 0;
   unsigned long cycleposition = 0x80000000;
   unsigned char *BufferPointbuffer;
   BufferPointbuffer  = BufferPoint;
  
   while(j < 16)
     {
   HC595_DataOut(0xFFFFFFFF,cycleposition);
      PORTA =  i;
      HC595_DataOutPut(BufferPoint,cycleposition);
      delayofftimeonus();
      i++;
      BufferPoint += 4;
   if(BufferPoint == BufferPointbuffer + 64)//64
     BufferPoint = BufferPointbuffer;
      if(i == 16)
      i = 0;//8
   j++;
   if(j == 16)
     {
   HC595_DataOut(0xFFFFFFFF,cycleposition);
      //cycleposition >>= 1;
   //if(cycleposition == 0)
   //  cycleposition = 0x80000000;
   //j = 0;
  }
  }
}


//
//  輸出32位的數(shù)據(jù)到4片74HC595上
//  輸入:要輸出的32位數(shù)據(jù)
//  輸出:無
void HC595_DataOutPut(unsigned char *GRAMPoint,unsigned long Position)
{
  unsigned long cycle = Position;
  unsigned long databuffer = 0;
  unsigned char i = 0,j = 0;
 
  databuffer |= (unsigned long)*GRAMPoint;
  GRAMPoint++;
  databuffer <<= 8;
  databuffer |= (unsigned long)*GRAMPoint;
  GRAMPoint++;
  databuffer <<= 8;
  databuffer |= (unsigned long)*GRAMPoint;
  GRAMPoint++;
  databuffer <<= 8;
  databuffer |= (unsigned long)*GRAMPoint;
 
  LED_MRH;
  LED_OEH;
  LED_STCPL;
  LED_SHCPL;
  for(i = 1;i <= 32;i++)
    {
  if(cycle & databuffer)
    LED_MOSIH;
  else
    LED_MOSIL;
  LED_SHCPH;
  cycle >>= 1;
  if(cycle == 0)
    cycle = 0x80000000;
  LED_SHCPL;
 }
  LED_STCPH;
  LED_OEL;
  LED_STCPL;
  LED_SHCPL;
}

 

演示效果

expertss1f.jpg


expertss1g.jpg

 

評(píng)論區(qū)(1 )
  • wenhua2020: 可否提供一下原理圖參考參考下呢

    回復(fù)