久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 10383|回復: 5
打印 上一主題 下一主題
收起左側

蘑菇外形小燈創意DIY Arduino源碼+APP+制作說明

[復制鏈接]
跳轉到指定樓層
樓主
尚未鏈接bluno進行測試,在UNO上測試的效果初步完成

詳細制作說明:
一款智能燈 是注重外形 的設計還是 操作上體 驗呢?而智 能蘑菇燈給 出的答案是 兩者兼具 才 更爽快!特有的無線充電功能讓它可以更方便的進行充電,萌萌的蘑菇機身使用 3DPLA 材 料打印出來,搭載體積小巧的 Bluno Beetle 控制器使它可以用手機 APP 來控制,此外!它的 外形小巧精 致可攜帶也 許是世界上 最小的可攜帶智能燈 了,相信制 作這樣一個 酷炫的蘑 菇 燈,是送給自己心儀女孩子最好的禮物~~話不多說,先看照片!








看到照片作為愛動手的你是不是早已饑渴難耐了呢,什么!你說光看照片不過癮?要看教程! 好吧,那就跟我來一起看看這盞酷炫的蘑菇燈是怎樣制作出來的哈哈~~~
首 先 準 備需要的材料






Bluno Beetle 控制器              3D 打印機(打印蘑菇燈) 無線充電模塊 5V/1A              磁環
RGBLED 模塊 220 歐電阻 電池 3.7V       發光二極管 自鎖開關       充電插口
強磁鐵              焊接導線 制作步驟
第一步 蘑菇燈本體制作。
1、將電池與接受線圈并聯焊接,并套上熱縮管絕緣。




2、焊接自鎖開關引線,焊接 RGB 模塊引線(紅色線焊接 VCC,藍色線焊接 GND,綠色線焊 接 DIN),電池電源正極和 Bluno Beetle 控制器的正極經自鎖開關串聯焊接,RGB 模塊綠色引
線接 Bluno Beetle 控制器數字口 3 引腳,上傳程序到 Bluno Beetle 板然后通電測試電路是否 正常。(程序源碼和需要的庫文件已經上傳至文章結尾,需要請自行下載。)









3、安裝控制電路部分,無線充電過程中線圈會發熱,這里用哥倆好膠水固定接收線圈, 同 時加入強磁鐵能更好的與充電發射線圈底座重合定位,考慮到充電過程中如果要控制燈光 , Bluno Beetle 的藍牙信號可能會受到無線充電線圈的電磁干擾,加入不銹鋼鐵片屏蔽電磁干 擾。







4、待無線接收線圈固定好后,依次放入自鎖開關、電池、Bluno Beetle 控制板、RGB 模塊、 并用熱熔膠將其固定粘接牢固。









5、用熱熔膠將蘑菇燈帽和蘑菇燈柱粘接起來,擠出的膠要均勻涂抹,動作干凈利落。























第二步              無線充電底座制作
1、將打印好的底座中框和上蓋組裝好,并用熱熔膠加固。


2、焊接充電插口與引線,將充電插口安裝在中框充電接口預留處,用熱熔膠固定。





3、在發光二極管的負極接上一個 220 歐的電子,并將二極管正負極與充電接口正負極并聯, 焊接正極時可以用熱縮管絕緣。




4、將無線充電發射線圈裝入,并用熱熔膠粘合,在發射線圈的中心點粘上強磁鐵,作用 是 與蘑菇燈充電時起到定位作用。



5、加入防干擾磁環,將輸入電源線穿入磁環纏繞兩圈,并將輸入線正負極與發射模塊正 負 極焊接,測量電壓是否正常后用熱熔膠固定。





6、準備好螺絲、旋具將充電底座下蓋安裝上,通電測試正常。





最后在手機上安裝 BLUNO APP 控制軟件,項目就算制作完成了。毫無疑問,制作這樣 的智能燈簡單易上手,趕緊造起來吧!一起分享造物的快樂,最后再來看看智能蘑菇燈的更 多照片~~



arduino源程序如下:

  1. #include <Adafruit_NeoPixel.h>
  2. #include "WS2812_Definitions.h"
  3. #include <avr/pgmspace.h>
  4. #include <Wire.h>
  5. #include "Arduino.h"
  6. #include "PlainProtocol.h"
  7. #include <Metro.h>
  8. #include <AudioAnalyzer.h>

  9. #define PIN 3             //Arduino Pin connect to the LED Strip
  10. #define LED_COUNT 220      //set the Amount of LED to 180 and this number depend on how many you really have

  11. PlainProtocol BLUNOPlainProtocol(Serial,115200);//set Serial baud rate to 115200   
  12. Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);// NEO_GRB means the type of your LED Strip
  13. Metro ledMetro = Metro(18);  // Metro for data receive in a regular time
  14. Analyzer Audio = Analyzer(4,5,0); // Strobe->4 RST->5 Analog->0

  15. int humid=0;
  16. int temper=0;          //  humid and temper means nothing in this program,just for the software in your phone
  17. int State01=2,State02=0;         //  the value will change when your press "BUZZER" in your phone   
  18. int Red=10,Green=0,Blue=10,Number_Position_RGB=100;//the value of RGB and the position of the LEDs
  19. int FreqVal[7];//the spectrum value
  20. int color[]={0xDC143C,0xFFA500,0xFFFF00, 0x32CD32,0x0000FF,0x2F4F4F,0x4B0082,0xDA70D6};

  21. int Num_Channel=0,Buff_Channel=0;
  22. int Num_Color[7],Buff_Num_Color[7];
  23. boolean Dis_En=false;
  24. int Num_First_Color=0,Buf_Max=0; //
  25. int Num_Shark02_High=0,Number_Shark02_LOW=0;

  26. void setup()
  27. {
  28.   Audio.Init();//Init module
  29.   leds.begin();  // Call this to start up the LED strip.
  30.   clearLEDs();   // This function, defined below, turns all LEDs off...
  31.   leds.show();   // ...but the LEDs don't actually update until you call this.
  32.   Serial.begin(115200);
  33.   TCCR1B &= ~((1<<CS12)|(1<<CS11)|(1<<CS10));        //Clock select: SYSCLK divde 8;
  34.   TCCR1B |= (1<<CS11);
  35.   TCCR2B &= ~((1<<CS12)|(1<<CS11)|(1<<CS10));        //Clock select: SYSCLK divde 8;
  36.   TCCR2B |= (1<<CS11);
  37. }

  38. void loop()
  39. {
  40.   temper=State01;
  41.   humid=State02;
  42.   if (BLUNOPlainProtocol.available())
  43.   {
  44.     if(BLUNOPlainProtocol.receivedCommand=="TEMP")          BLUNOPlainProtocol.write("TEMP", temper);  
  45.     else if(BLUNOPlainProtocol.receivedCommand=="HUMID")    BLUNOPlainProtocol.write("HUMID", humid);

  46.     if (BLUNOPlainProtocol.receivedCommand=="BUZZER")          //get command of "BUZZER"
  47.     {
  48.       if(BLUNOPlainProtocol.receivedContent[0]==1)  State01=1;
  49.       else                                          State01=2;
  50.     }
  51.     else if(BLUNOPlainProtocol.receivedCommand=="RGBLED")  //get command of  "RGB"
  52.     {
  53.       State01=3;
  54.       Red  = BLUNOPlainProtocol.receivedContent[0];
  55.       Green= BLUNOPlainProtocol.receivedContent[1];
  56.       Blue = BLUNOPlainProtocol.receivedContent[2];
  57.     }
  58.   }

  59.   if (ledMetro.check() == 1)//time for metro
  60.   {
  61.     if(State01==1)
  62.     {
  63.       clearLEDs();  // Turn off all LEDs
  64.       leds.show();
  65.     }
  66.     else if(State01==2)     
  67.     {   
  68.         Rock_With_Song();//leds.show();           
  69.     }
  70.     else if(State01==3)
  71.     {
  72.       for (int i=0;i<LED_COUNT;i++)
  73.       {
  74.         if(i%7==0)
  75.           leds.setPixelColor(i,Red, Green, 0);//change the color
  76.         else if(i%3==0)
  77.           leds.setPixelColor(i,0, Green, Blue);//change the color
  78.         else if(i%2==0)
  79.           leds.setPixelColor(i,Red, Green, Blue);//change the color
  80.         else     
  81.           leds.setPixelColor(i,Red,0, Blue);//change the color
  82.       }
  83.       leds.show();
  84.     }
  85.   }
  86. }


  87. void clearLEDs()
  88. {
  89.   for (int i=0; i<LED_COUNT; i++)  leds.setPixelColor(i, 0);
  90. }

  91. void rainbow(byte startPosition)
  92. {
  93.   int rainbowScale =  192/LED_COUNT;
  94.   leds.setPixelColor( startPosition, rainbowOrder((rainbowScale * ( startPosition + startPosition)) % 192));
  95.   leds.show();
  96. }
  97. uint32_t rainbowOrder(byte position)
  98. {
  99.   if (position < 31)  // Red -> Yellow (Red = FF, blue = 0, green goes 00-FF)
  100.   {
  101.     return leds.Color(0xFF, position * 8, 0);
  102.   }
  103.   else if (position < 63)  // Yellow -> Green (Green = FF, blue = 0, red goes FF->00)
  104.   {
  105.     position -= 31;
  106.     return leds.Color(0xFF - position * 8, 0xFF, 0);
  107.   }
  108.   else if (position < 95)  // Green->Aqua (Green = FF, red = 0, blue goes 00->FF)
  109.   {
  110.     position -= 63;
  111.     return leds.Color(0, 0xFF, position * 8);
  112.   }
  113.   else if (position < 127)  // Aqua->Blue (Blue = FF, red = 0, green goes FF->00)
  114.   {
  115.     position -= 95;
  116.     return leds.Color(0, 0xFF - position * 8, 0xFF);
  117.   }
  118.   else if (position < 159)  // Blue->Fuchsia (Blue = FF, green = 0, red goes 00->FF)
  119.   {
  120.     position -= 127;
  121.     return leds.Color(position * 8, 0, 0xFF);
  122.   }
  123.   else  //160 <position< 191   Fuchsia->Red (Red = FF, green = 0, blue goes FF->00)
  124.   {
  125.     position -= 159;
  126.     return leds.Color(0xFF, 0x00, 0xFF - position * 8);
  127.   }
  128. }


  129. void Rock_With_Song()
  130. {
  131.   Buff_Channel=Num_Channel;// Buff_Channnel can store the number of the channel which has the max spectrum value
  132.   Audio.ReadFreq(FreqVal);// get the spectrum value
  133.   for (int i=0;i<6;i++)
  134.   {
  135.     if(FreqVal[Num_Channel]<FreqVal[i])  Num_Channel=i;// get the number of the channel which has the max spectrum value
  136.     Buff_Num_Color[i]=Num_Color[i];                      //store the value for the using below
  137.   }
  138.   if(FreqVal[Num_Channel]<400)      {  
  139.     Number_Shark02_LOW++;
  140.   } //count if a low voice started
  141.   if(Buf_Max!=Num_Channel && FreqVal[Num_Channel]>300)    // judge if the sound changed
  142.   {
  143.     Num_First_Color++;
  144.     Dis_En=true;                                          //enable the display
  145.     if(FreqVal[Num_Channel]>400) Number_Shark02_LOW=0;    //reset the count of low voice
  146.     if (Num_First_Color==7) Num_First_Color=0;                              //for recycle
  147.     for(int i=0;i<7;i++)                                  //recycle the colour
  148.     {
  149.       int x=random(0,6);         
  150.       if(i==0)   Num_Color[i]=Num_First_Color;                  //recycle the value        
  151.       else       Num_Color[i]=Buff_Num_Color[x];       //change the color randomly
  152.     }
  153.   }

  154.   Buf_Max=Num_Channel;                                   //store the max_value_channel for next use

  155.   if( (Buf_Max==5 || Buf_Max==4 ) && FreqVal[Buf_Max]>700)  //count when the  High vlaue of the sound started
  156.   {
  157.     Num_Shark02_High++;
  158.   }
  159.   else Num_Shark02_High=0;                                  //reset the count of the High_value_count

  160.   if(Num_Shark02_High>22)                                  //time of High value voice reached
  161.   {
  162.     for(int i=0;i<LED_COUNT/2;i++)                         //these are effects of color changing
  163.     {
  164.       leds.setPixelColor(i,rainbowOrder(i));               //rising from two origin points
  165.       leds.setPixelColor(i+LED_COUNT/2,rainbowOrder(i));
  166.       leds.show();
  167.       if(i>LED_COUNT/4) delay(1);
  168.     }
  169.     for(int i=0;i<LED_COUNT/2;i++)                        
  170.     {
  171.       leds.setPixelColor(LED_COUNT-i,rainbowOrder(i));
  172.       leds.setPixelColor(i+LED_COUNT/2,rainbowOrder(i));
  173.       leds.show();
  174.     }
  175.     for (int i=0;i<LED_COUNT;i++)
  176.     {
  177.       leds.setPixelColor(i,GOLD);
  178.     }
  179.     leds.show();
  180.     Audio.ReadFreq(FreqVal);                                 
  181.     if(FreqVal[4]>800)                                         //if High sound value continues, take another effect out!
  182.     {
  183.       for(int x=0;x<6;x++)
  184.       {
  185.         if(FreqVal[x]>1000)   
  186.         {
  187.           for(int y=0;y<LED_COUNT/2;y++)    {
  188.             leds.setPixelColor(LED_COUNT-y,RED);
  189.             leds.setPixelColor(LED_COUNT/2-y,RED);
  190.             leds.show();
  191.           }
  192.           x=7;
  193.         }
  194.       }
  195.     }
  196.     Num_Shark02_High=0;                                  //reset the count when effect playing finished
  197.   }
  198.   if(Number_Shark02_LOW>40)                             //when the time of low value sound reached
  199.   {
  200.     for(int i=0;i<LED_COUNT/2;i++)                       //close the light from two point
  201.     {
  202.       leds.setPixelColor(i,0);
  203.       leds.setPixelColor(LED_COUNT-i,0);
  204.       leds.show();
  205.     }
  206.     Number_Shark02_LOW=0;
  207.     Dis_En=false;                                    //disable the function:Display() because the light should be closed
  208.   }
  209.   if(Dis_En==true)
  210.     Display();
  211. }

  212. void Display()                           
  213. {
  214.   for (int i=0;i<LED_COUNT;i++)
  215.   {
  216.     if(i<LED_COUNT/7)
  217.     {
  218.       leds.setPixelColor(i,color[Num_Color[0]]);  
  219.     }
  220.     else if(i<(LED_COUNT/7)*2)   {  
  221.       leds.setPixelColor(i,color[Num_Color[1]]);  
  222.     }
  223.     else if(i<(LED_COUNT/7)*3)   {  
  224.       leds.setPixelColor(i,color[Num_Color[2]]);  
  225.     }
  226.     else if(i<(LED_COUNT/7)*4)   {  
  227.       leds.setPixelColor(i,color[Num_Color[3]]);  
  228.     }
  229.     else if(i<(LED_COUNT/7)*5)   {  
  230.       leds.setPixelColor(i,color[Num_Color[4]]);  
  231.     }
  232.     else if(i<(LED_COUNT/7)*6)   {  
  233.       leds.setPixelColor(i,color[Num_Color[5]]);  
  234.     }
  235.     else if(i<LED_COUNT)         {  
  236.       leds.setPixelColor(i,color[Num_Color[6]]);  
  237.     }
  238.   }
  239.   leds.show();
  240. }


復制代碼



蘑菇外形小燈創意DIY所有相關資源資料51hei提供下載:
蘑菇燈.zip (6.88 MB, 下載次數: 40)



評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏2 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:231310 發表于 2017-9-8 14:43 | 只看該作者
厲害了
回復

使用道具 舉報

板凳
ID:266081 發表于 2017-12-24 19:04 | 只看該作者
好資料,51黑有你更精彩!!!
回復

使用道具 舉報

地板
ID:348109 發表于 2018-6-9 23:06 來自手機 | 只看該作者
厲害了
回復

使用道具 舉報

5#
ID:356463 發表于 2018-6-29 22:08 | 只看該作者
你好,請問你用這個app的時候有沒有連接上設備有跳出這個頁面,里面都是設備的信息,但是后退又斷開連接了?
回復

使用道具 舉報

6#
ID:396751 發表于 2020-5-22 11:53 | 只看該作者
51黑總是能帶來很多驚喜,感謝樓主
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 亚洲一区二区在线 | 欧美一级免费看 | 精品一区二区在线视频 | 在线免费观看a级片 | 91综合网| 日韩成人av在线 | 国产精品久久久久久久久久久免费看 | 日本在线网址 | 精品二区视频 | 国产高清视频在线 | 成人精品一区二区三区四区 | 日韩在线视频免费观看 | 无人区国产成人久久三区 | 久久91| 亚洲免费影院 | 国产乱肥老妇国产一区二 | 一区二区三区四区不卡视频 | 欧美激情综合网 | 精品91久久 | 亚洲国产精品一区二区三区 | 91精品国产高清一区二区三区 | 亚洲a视频 | а天堂中文最新一区二区三区 | 狠狠狠色丁香婷婷综合久久五月 | 欧美激情精品久久久久久免费 | 精品91久久 | 亚洲欧美视频 | 日韩欧美视频 | 国产精品一区久久久 | 91av免费看 | 久久久久久色 | 久久亚洲一区二区三区四区 | wwwsihu| 欧美一区二区久久 | 国产日韩欧美一区 | 日韩中文字幕久久 | 盗摄精品av一区二区三区 | 日本免费在线观看视频 | 国产精品久久久久无码av | aacc678成免费人电影网站 | 黄色片网站在线观看 |