8806浏览
查看: 8806|回复: 41

[项目] 【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)

[复制链接]
偶然心血来潮,想要做一个音乐可视化的系列专题。这个专题的难度有点高,涉及面也比较广泛,相关的FFT和FHT等算法也相当复杂,不过还是打算从最简单的开始,实际动手做做试验,耐心尝试一下各种方案,逐步积累些有用的音乐频谱可视化的资料,也会争取成型一些实用好玩的音乐可视器项目。

LED无限魔方的英文是LED Infinity Cube,还有一种称呼,叫做超级立方体,大概说的都是一种三维或多维镜像LED灯。正好手头有六片有机玻璃板,这里准备从小规格的开始尝试,先做一款10X10厘米的特别迷你型,感觉有点难度,试试看。

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

驴友花雕  中级技神
 楼主|

发表于 2022-9-18 17:53:30

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之六:一个用 FastLED 编程的LED无限魔方体


  1. /*
  2.   【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  3.   项目程序之六:一个用 FastLED 编程的LED无限魔方体
  4. */
  5. #include <FastLED.h>
  6. #define LED_PIN               6
  7. #define LEDS_PER_SEGMENT      5
  8. #define SEGMENTS              12
  9. #define BRIGHTNESS            200
  10. #define NUM_LEDS              LEDS_PER_SEGMENT * SEGMENTS
  11. #define NUM_LEDS_WITH_SAFETY  NUM_LEDS + 1
  12. CRGB source1[NUM_LEDS_WITH_SAFETY];
  13. CRGB source2[NUM_LEDS_WITH_SAFETY];
  14. CRGB output[NUM_LEDS_WITH_SAFETY];
  15. uint8_t blendAmount = 0;
  16. uint8_t patternCounter = 0;
  17. uint8_t source1Pattern = 0;
  18. uint8_t source2Pattern = 1;
  19. bool useSource1 = false;
  20. void setup() {
  21.   FastLED.addLeds<WS2812B, LED_PIN, GRB>(output, NUM_LEDS_WITH_SAFETY);
  22.   FastLED.setBrightness(BRIGHTNESS);
  23.   Serial.begin(57600);
  24. }
  25. void loop() {
  26.   EVERY_N_MILLISECONDS(10) {
  27.     blend(source1, source2, output, NUM_LEDS, blendAmount);   //在两个源之间混合
  28.     if (useSource1) {
  29.       if (blendAmount < 255) blendAmount++;                   //混合“向上”到源 2
  30.     } else {
  31.       if (blendAmount > 0) blendAmount--;                     //将“向下”混合到源 1
  32.     }
  33.   }
  34.   EVERY_N_SECONDS(8) {
  35.     nextPattern();
  36.   }
  37.   runPattern(source1Pattern, source1);                  //同时运行两种模式
  38.   runPattern(source2Pattern, source2);
  39.   
  40.   FastLED.show();
  41. }
  42. void nextPattern() {
  43.   patternCounter = (patternCounter + 1) % 5;
  44.   if (useSource1) source1Pattern = patternCounter;
  45.   else source2Pattern = patternCounter;
  46.   useSource1 = !useSource1;
  47. }
  48. void runPattern(uint8_t pattern, CRGB *LEDarray) {
  49.   switch (pattern) {
  50.     case 0:
  51.       rainbowComet(LEDarray);//彩虹彗星
  52.       break;
  53.     case 1:
  54.       prettyNoise(LEDarray);//漂亮噪声
  55.       break;
  56.     case 2:
  57.       randomStar(LEDarray);//随机星
  58.       break;
  59.     case 3:
  60.       fillRainbow(LEDarray);//填充彩虹
  61.       break;
  62.     case 4:
  63.       pixels(LEDarray);// 像素
  64.       break;
  65.   }
  66. }
  67. uint8_t xyz(uint8_t x, uint8_t y, uint8_t z) {
  68. /*边缘的坐标从 0 到 5。每条边缘只有 5 个“真实”像素,
  69.    * 所以只有 1 - 5 个 LED。缺少顶点(角)。
  70.    * 如果请求这些顶点之一,则返回一个不显示的安全像素。
  71.    * 我们对立方体内部的坐标也做同样的事情,即不在边缘上。
  72.    */
  73.   uint8_t lps = LEDS_PER_SEGMENT;
  74.   uint8_t safePx = NUM_LEDS;
  75.   if ((x == 0 || x == lps + 1) && (y == 0 || y == lps + 1) && (z == 0 || z == lps + 1)) return safePx;
  76.   // z 方向边缘
  77.   if (x == 0        && y == 0)        return (8 * lps)  - z;      // Seg 7
  78.   if (x == 0        && y == lps + 1)  return (12 * lps) - z;      // Seg 11
  79.   if (x == lps + 1  && y == 0)        return (3 * lps)  + z - 1;  // Seg 3
  80.   if (x == lps + 1  && y == lps + 1)  return (9 * lps)  + z - 1;  // Seg 9
  81.   // y 方向边
  82.   if (x == 0        && z == 0)        return y - 1;               // Seg 0
  83.   if (x == 0        && z == lps + 1)  return (7 * lps)  - y;      // Seg 6
  84.   if (x == lps + 1  && z == 0)        return (3 * lps)  - y;      // Seg 2
  85.   if (x == lps + 1  && z == lps + 1)  return (4 * lps)  + y - 1;  // Seg 4
  86.   // x 方向边
  87.   if (y == 0        && z == 0)        return (8 * lps)  + x - 1;  // Seg 8
  88.   if (y == 0        && z == lps + 1)  return (11 * lps) - x;      // Seg 10
  89.   if (y == lps + 1  && z == 0)        return lps        + x - 1;  // Seg 1
  90.   if (y == lps + 1  && z == lps + 1)  return (6 * lps)  - x;      // Seg 5
  91.   //如果以上都不是,我们的坐标无效
  92.   return safePx;
  93. }
  94. //------------ Patterns below ------------//
  95. void pixels(CRGB *LEDarray) {
  96.   static uint8_t pos = 0;
  97.   static uint8_t a = 0;
  98.   static uint8_t b = 0;
  99.   //填充所有像素并将它们混合在一起
  100.   for (int c = 0; c <= LEDS_PER_SEGMENT + 1; c++) {
  101.     LEDarray[xyz(a,b,c)] = blend(LEDarray[xyz(a,b,c)], CRGB::Orange, 128);
  102.     LEDarray[xyz(a,c,b)] = blend(LEDarray[xyz(a,c,b)], CRGB::Magenta, 128);
  103.     LEDarray[xyz(c,a,b)] = blend(LEDarray[xyz(c,a,b)], CRGB::Blue, 128);
  104.   }
  105.   EVERY_N_MILLISECONDS(33) {   
  106.     //围绕正方形移动的坐标
  107.     if(pos < 15) a++;
  108.     else if (pos <= (LEDS_PER_SEGMENT * 2) + 1) b++;
  109.     else if (pos <= (LEDS_PER_SEGMENT * 3) + 2) a--;
  110.     else b--;
  111.      //再次开始我们到达正方形的尽头
  112.     pos = (pos + 1) % ((LEDS_PER_SEGMENT + 1) * 4);
  113.   }
  114.   fadeToBlackBy(LEDarray, NUM_LEDS, 10);
  115.   
  116. }
  117. void fillRainbow(CRGB *LEDarray) {
  118.   static uint8_t pos = 0;
  119.   
  120.   uint8_t noise = inoise8(millis()/5);
  121.   fill_rainbow(LEDarray, LEDS_PER_SEGMENT, noise, 10);
  122.   //复制到其他段
  123.   for (int i = 0; i < SEGMENTS; i++) {
  124.     memmove8(&LEDarray[LEDS_PER_SEGMENT * i], &LEDarray[0], LEDS_PER_SEGMENT * sizeof(CRGB));
  125.   }
  126.    //垂直柱子上下移动的白点
  127.   LEDarray[xyz(0, 0, LEDS_PER_SEGMENT - pos)] = CRGB::White;
  128.   LEDarray[xyz(0, LEDS_PER_SEGMENT + 1, pos)] = CRGB::White;
  129.   LEDarray[xyz(LEDS_PER_SEGMENT + 1, LEDS_PER_SEGMENT + 1, LEDS_PER_SEGMENT - pos)] = CRGB::White;
  130.   LEDarray[xyz(LEDS_PER_SEGMENT + 1, 0, pos)] = CRGB::White;
  131.   EVERY_N_MILLISECONDS(20) {
  132.     pos = (pos + 1) % LEDS_PER_SEGMENT;
  133.   }
  134. }
  135. void rainbowComet(CRGB *LEDarray) {
  136.   static uint8_t easeOutVal = 0;
  137.   static uint8_t easeInVal  = 0;
  138.   //使图案出现在两个段上
  139.   uint8_t ledsPerSegment = LEDS_PER_SEGMENT * 2;
  140.   uint8_t segments = SEGMENTS / 2;
  141.   easeOutVal = ease8InOutQuad(easeInVal);
  142.   easeInVal++;
  143.   uint8_t pos = lerp8by8(0, ledsPerSegment, easeOutVal);
  144.   uint8_t hue =  map(pos, 0, ledsPerSegment, 0, 230);
  145.   
  146.   LEDarray[pos] = CHSV(hue, 255, 255);
  147.   fadeToBlackBy(LEDarray, ledsPerSegment, 20);
  148.   //复制到其他段
  149.   for (int i = 0; i < segments; i++) {
  150.     memmove8(&LEDarray[ledsPerSegment * i], &LEDarray[0], ledsPerSegment * sizeof(CRGB));
  151.   }
  152. }
  153. void randomStar(CRGB *LEDarray) {
  154.   EVERY_N_MILLISECONDS(75) {
  155.     LEDarray[random16(0, NUM_LEDS)] = CRGB::LightGrey;
  156.   }
  157.   for (int i = 0; i < NUM_LEDS; i++) {
  158.    
  159.     // 亮度
  160.     uint8_t bNoise = inoise8(i * 100, millis());
  161.     bNoise = constrain(bNoise, 50, 200);
  162.     bNoise = map(bNoise, 50, 200, 20, 80);
  163.     // 色调
  164.     uint8_t hNoise = inoise8(i * 20, millis() / 5);
  165.     hNoise = constrain(hNoise, 50, 200);
  166.     hNoise = map(hNoise, 50, 200, 160, 192);
  167.    
  168.     if (LEDarray[i].g == 0) {
  169.       LEDarray[i] = CHSV(hNoise, 255, bNoise);
  170.     }
  171.   }
  172.   
  173.   fadeToBlackBy(LEDarray, NUM_LEDS, 5);//淡入黑色(LED 阵列,NUM LEDS,5 个)
  174. }
  175. void prettyNoise(CRGB *LEDarray) {
  176.   fill_noise16 (LEDarray, NUM_LEDS, 1, 0, 100, 1, 1, 50, millis() / 3, 5);
  177. }
复制代码



回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-3 19:35:12

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之三:NeoPixel 测试程序

  1. /*
  2.   【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  3.   项目程序之三:NeoPixel 测试程序
  4. */
  5. #include <Adafruit_NeoPixel.h>
  6. #ifdef __AVR__
  7. #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
  8. #endif
  9. // Which pin on the Arduino is connected to the NeoPixels?
  10. // On a Trinket or Gemma we suggest changing this to 1:
  11. #define LED_PIN    6
  12. // How many NeoPixels are attached to the Arduino?
  13. #define LED_COUNT 60
  14. // Declare our NeoPixel strip object:
  15. Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
  16. // Argument 1 = Number of pixels in NeoPixel strip
  17. // Argument 2 = Arduino pin number (most are valid)
  18. // Argument 3 = Pixel type flags, add together as needed:
  19. //   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
  20. //   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
  21. //   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
  22. //   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
  23. //   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
  24. // setup() function -- runs once at startup --------------------------------
  25. void setup() {
  26.   // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  27.   // Any other board, you can remove this part (but no harm leaving it):
  28. #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  29.   clock_prescale_set(clock_div_1);
  30. #endif
  31.   // END of Trinket-specific code.
  32.   strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  33.   strip.show();            // Turn OFF all pixels ASAP
  34.   strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
  35. }
  36. // loop() function -- runs repeatedly as long as board is on ---------------
  37. void loop() {
  38.   // Fill along the length of the strip in various colors...
  39.   colorWipe(strip.Color(255,   0,   0), 50); // Red
  40.   colorWipe(strip.Color(  0, 255,   0), 50); // Green
  41.   colorWipe(strip.Color(  0,   0, 255), 50); // Blue
  42.   // Do a theater marquee effect in various colors...
  43.   theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
  44.   theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
  45.   theaterChase(strip.Color(  0,   0, 127), 50); // Blue, half brightness
  46.   rainbow(10);             // Flowing rainbow cycle along the whole strip
  47.   theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
  48. }
  49. // Some functions of our own for creating animated effects -----------------
  50. // Fill strip pixels one after another with a color. Strip is NOT cleared
  51. // first; anything there will be covered pixel by pixel. Pass in color
  52. // (as a single 'packed' 32-bit value, which you can get by calling
  53. // strip.Color(red, green, blue) as shown in the loop() function above),
  54. // and a delay time (in milliseconds) between pixels.
  55. void colorWipe(uint32_t color, int wait) {
  56.   for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
  57.     strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
  58.     strip.show();                          //  Update strip to match
  59.     delay(wait);                           //  Pause for a moment
  60.   }
  61. }
  62. // Theater-marquee-style chasing lights. Pass in a color (32-bit value,
  63. // a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
  64. // between frames.
  65. void theaterChase(uint32_t color, int wait) {
  66.   for (int a = 0; a < 10; a++) { // Repeat 10 times...
  67.     for (int b = 0; b < 3; b++) { //  'b' counts from 0 to 2...
  68.       strip.clear();         //   Set all pixels in RAM to 0 (off)
  69.       // 'c' counts up from 'b' to end of strip in steps of 3...
  70.       for (int c = b; c < strip.numPixels(); c += 3) {
  71.         strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
  72.       }
  73.       strip.show(); // Update strip with new contents
  74.       delay(wait);  // Pause for a moment
  75.     }
  76.   }
  77. }
  78. // Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
  79. void rainbow(int wait) {
  80.   // Hue of first pixel runs 5 complete loops through the color wheel.
  81.   // Color wheel has a range of 65536 but it's OK if we roll over, so
  82.   // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  83.   // means we'll make 5*65536/256 = 1280 passes through this outer loop:
  84.   for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
  85.     for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
  86.       // Offset pixel hue by an amount to make one full revolution of the
  87.       // color wheel (range of 65536) along the length of the strip
  88.       // (strip.numPixels() steps):
  89.       int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
  90.       // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
  91.       // optionally add saturation and value (brightness) (each 0 to 255).
  92.       // Here we're using just the single-argument hue variant. The result
  93.       // is passed through strip.gamma32() to provide 'truer' colors
  94.       // before assigning to each pixel:
  95.       strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
  96.     }
  97.     strip.show(); // Update strip with new contents
  98.     delay(wait);  // Pause for a moment
  99.   }
  100. }
  101. // Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
  102. void theaterChaseRainbow(int wait) {
  103.   int firstPixelHue = 0;     // First pixel starts at red (hue 0)
  104.   for (int a = 0; a < 30; a++) { // Repeat 30 times...
  105.     for (int b = 0; b < 3; b++) { //  'b' counts from 0 to 2...
  106.       strip.clear();         //   Set all pixels in RAM to 0 (off)
  107.       // 'c' counts up from 'b' to end of strip in increments of 3...
  108.       for (int c = b; c < strip.numPixels(); c += 3) {
  109.         // hue of pixel 'c' is offset by an amount to make one full
  110.         // revolution of the color wheel (range 65536) along the length
  111.         // of the strip (strip.numPixels() steps):
  112.         int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
  113.         uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
  114.         strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
  115.       }
  116.       strip.show();                // Update strip with new contents
  117.       delay(wait);                 // Pause for a moment
  118.       firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
  119.     }
  120.   }
  121. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-10-5 10:14:33

【花雕动手做】看见声音,基于Arduino系列音乐可视器(1)---LED节奏灯
https://mc.dfrobot.com.cn/thread-311167-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(2)---OLED频谱灯
https://mc.dfrobot.com.cn/thread-311174-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(3)---RGB律动灯
https://mc.dfrobot.com.cn/thread-311183-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(4)---WS2812条灯
https://mc.dfrobot.com.cn/thread-311190-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(5)---WS2812柱跳灯
https://mc.dfrobot.com.cn/thread-311192-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(6)---点阵频谱灯
https://mc.dfrobot.com.cn/thread-311201-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(7)---大方格频谱灯
https://mc.dfrobot.com.cn/thread-311364-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(8)---四位32段点阵屏
https://mc.dfrobot.com.cn/thread-311490-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(9)---X Music Spectrum
https://mc.dfrobot.com.cn/thread-311627-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(10)---WS2812硬板屏
https://mc.dfrobot.com.cn/thread-311641-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(11)---WS2812幻彩灯带
https://mc.dfrobot.com.cn/thread-313648-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(12)---米管快速节奏灯
https://mc.dfrobot.com.cn/thread-313708-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(13)---有机棒立柱灯
https://mc.dfrobot.com.cn/thread-313723-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(14)---水杯水瓶灯
https://mc.dfrobot.com.cn/thread-313803-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(15)--横排LED方管灯
https://mc.dfrobot.com.cn/thread-313811-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(16)--热干胶棒棒灯
https://mc.dfrobot.com.cn/thread-313844-1-1.html
【花雕动手做】有趣好玩音乐可视化系列(17)--光导纤维灯
https://mc.dfrobot.com.cn/thread-313867-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(18)--LED平面板灯
https://mc.dfrobot.com.cn/thread-313951-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(19)--通体光纤灯
https://mc.dfrobot.com.cn/thread-313962-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(20)--首饰盒镜子灯
https://mc.dfrobot.com.cn/thread-313969-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(21)--CD 光盘灯
https://mc.dfrobot.com.cn/thread-313984-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)--LED无限魔方
https://mc.dfrobot.com.cn/thread-313994-1-1.html
【花雕动手做】有趣好玩的音乐可视化(23)--3合1闪点光纤
https://mc.dfrobot.com.cn/thread-314168-1-1.html
【花雕动手做】有趣好玩的音乐可视化(24)--无限LED镜子灯
https://mc.dfrobot.com.cn/thread-314180-1-1.html
【花雕动手做】有趣好玩音乐可视化(25)--水龙卷旋涡灯
https://mc.dfrobot.com.cn/thread-314231-1-1.html
【花雕动手做】有趣好玩音乐可视化系列(26)--LED 超立方体
https://mc.dfrobot.com.cn/thread-314244-1-1.html
【花雕动手做】有趣好玩的音乐可视化(27)--磁搅LED水旋灯
https://mc.dfrobot.com.cn/thread-314273-1-1.html


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 11:18:39

找到一张软镜子贴纸

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 11:25:14

立方体的底面,使用这个

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 12:55:59

超薄的玻璃贴膜

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 12:59:41

其余五个面,使用这个银灰膜

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 13:02:24

贴膜手艺有所提高

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 13:05:18

立方体的六个面备好了

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:05:47

声音模块,使用性价比更高的MAX4466声音传感器。


【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:08:33

MAX4466
是微功率运算放大器,经过优化,可用作麦克风前置放大器。它们提供了优化的增益带宽产品与电源电流的理想组合,以及超小型封装中实现低电压工件环境。 MAX4466具有增益稳定特性,仅需24μA的电源电流即可提供200kHz的增益带宽。经过解压缩,可实现+5V/V的最小稳定增益,并提供600KHZ增益带宽。此外这些放大器具有轨到轨输出,高 AVOL ,以及出色的电源抑制和共模抑制比,适合在嘈杂环境中工作。广泛应用于蜂窝电话、数字复读装置、耳机、助听器、麦克风前置放大器、便携计算机和语音识别系统中。

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:17:46

MAX4466模块特点
电源电压:+2.4V至+5.5V(可直接接STM/ARDUNIO/树莓派等开发板)
电源抑制比:112dB
共模抑制比:126dB
AVOL:125dB(RL = 100kΩ) 轨到轨输出
静态电源电流:24μA
增益带宽:600kHz
尺寸:20.8mm x 13.8mm x 7.5mm/0.8 x 0.5 x 0.3inch

该模块在 Vcc 和接地引线上都包含铁氧体,以最大限度地减少电源噪声。如果与 MCU 一起使用,最好使用 2.4V – 5.5V 范围内可用的最安静的电源。在 Arduino 上,这通常是 3.3V 电源。输出是直流耦合的。当输出信号处于静止状态时,它将位于 Vcc/2。如果 Vcc 为 5V,则输出将为 2.5V。如果输出需要交流耦合,可以在输出引脚和它驱动的电路的输入之间增加一个100uF的电容。背面的小型单圈电位器可让您将增益从 25x 调整到 125x。逆时针旋转电位器会增加增益,而逆时针旋转会降低增益。

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:23:47

WS2812B灯带选用的是每米60灯黑底裸板
【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1



回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:27:26

WS2812B灯带电原理图

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:32:39

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图2

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 14:37:39

WS2812B是集控制电路和发光电路于一体的LED光源元件,其控制IC为WS2812B,发光元件是5050RGBLED,电压为5V,每个单位的峰值电流为60ma,灯带为三线制,VCC GND DIN分别为电源+、电源-、信号,当使用外部电源时,外部电源-需要与单片机的GND相连。
【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图2

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 17:38:12

定制的小木条到了,这活好像有点难度......


【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

小企鹅  初级技匠

发表于 2022-9-1 17:39:16

厉害厉害
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 17:41:37


谢谢鼓励
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-1 18:34:40

开始组装无限魔方

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-2 09:43:13

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之一:循环LED绿色LED快闪测试

  1. /*
  2.   【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  3.   项目程序之一:循环LED绿色LED快闪测试
  4. */
  5. #include <Adafruit_NeoPixel.h>
  6. #define PIN 6
  7. #define MAX_LED 35
  8. #define ADD true
  9. #define SUB false
  10. int val = 0;
  11. boolean stat = ADD;
  12. Adafruit_NeoPixel strip = Adafruit_NeoPixel( MAX_LED, PIN, NEO_RGB + NEO_KHZ800 );
  13. void setup() {
  14.   strip.begin();
  15.   strip.show();
  16. }
  17. void loop() {
  18.   uint8_t i, a = 0;
  19.   uint32_t color = strip.Color(255, 0, 0);
  20.   while (a < 36)
  21.   {
  22.     for (i = 0; i < 35; i++)
  23.     {
  24.       if (i == a) strip.setPixelColor(i, color);
  25.       else strip.setPixelColor(i, 0);
  26.     }
  27.     strip.show();
  28.     delay(100);
  29.     a++;
  30.   }
  31. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-2 09:51:48

测试已安装的一部分


【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-9-2 10:40:26

实验场景图  动态图

【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)图1

回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail