彩色LED模块:修訂版本之間的差異

出自YFRobotwiki
跳轉到: 導覽搜尋
 
(由2名用戶作出的11個中途修訂版本未被顯示)
第 1 行: 第 1 行:
  
[[Image:Sensor Shield.jpg|400px|thumb| 扩展板]]
+
[[Image:LED模块.jpg|400px|thumb|LED模块]]
 +
 
 +
 
  
 
=== 产品简介 ===
 
=== 产品简介 ===
 +
<br>
 +
彩色LED模块采用4颗 WS2812(RGB全彩高亮LED)设计制作完成。WS2812是一个集控制电路与发光电路于一体的智能外控LED光源,内置信号整形电路,任何一个像素点收到信号后经过波形整形再输出,保证线路波形畸变不会累加,且每个像素点的三基色颜色可实现256级亮度显示,完成16777216种颜色的全真色彩显示,扫描频率不低于400Hz/s,内置上电复位和掉电复位电路。串行级联接口,能通过一根信号线完成数据的接收与解码。可以用于彩色提示灯等。
  
彩色LED模块采用4颗WS2812 RGB彩灯
 
  
  
 
=== 规格参数 ===
 
=== 规格参数 ===
 
+
<br>
*供电电压 :DC4~30V
+
*供电电压 :DC3.3 - 5V
* 灵敏 :10mV/
+
* 色彩显示:16777216种颜色的全真色彩显示
* 精度:0.5℃ (在+25℃时)
+
*亮 调节:256级亮度调节
* 测量温度范围:0℃ ~ 100℃
+
*扫描频率:>=400Hz/s
 +
* 数据传输速率:800Kbps
 +
* 串行级联:<5M时,不需要外接电路 / 刷新速率30帧/秒时,低速模式下 >=512个,高速模式下 >=1024个
 
*安装孔径:3MM
 
*安装孔径:3MM
*模块尺寸:28*21*1.6MM ( 长*宽*高)
+
*模块尺寸:28*21*7.3MM ( 长*宽*高
 
*孔间距:15MM
 
*孔间距:15MM
*模块重量:2.2g
+
*模块重量:2.6g
 +
 
 +
 
  
 
=== 引脚说明 ===
 
=== 引脚说明 ===
 +
<br>
 +
*1. G  --  Gnd(地)
 +
*2. V  --  Vcc(电源+5V)
 +
*3. S  --  Sign(信号)
  
*1. Gnd
 
*2. Vcc
 
*3. Sign
 
  
  
 
=== 应用示例 ===
 
=== 应用示例 ===
 +
<br>
 +
:'''电路连接示意图'''
 +
<br>
 +
::'''LED模块'''的 G、V、S分别连接 '''Arduino UNO'''的GND、VCC(+5V)、D5引脚。
 +
 +
<img src="http://file.yfrobot.com/wiki/image/sensor_circuit/ws2812LED4.png"  alt="ws2812LED4" />
 +
 +
 +
 +
:'''示例代码'''
 +
<pre >
 +
#include <Adafruit_NeoPixel.h>
 +
 +
#define Red Color(255,0,0)
 +
#define Green Color(0,255,0)
 +
#define Blue Color(0,0,255)
 +
 +
#define PIN            5
 +
#define NUMPIXELS      4
 +
 +
// Parameter 1 = number of pixels in strip
 +
// Parameter 2 = pin number (most are valid)
 +
// Parameter 3 = pixel type flags, add together as needed:
 +
//  NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
 +
//  NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
 +
//  NEO_GRB    Pixels are wired for GRB bitstream (most NeoPixel products)
 +
//  NEO_RGB    Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
 +
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
 +
 +
int delayval = 500; // delay for half a second
  
 +
void setup() {
 +
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
 +
#if defined (__AVR_ATtiny85__)
 +
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
 +
#endif
 +
  // End of trinket special code
  
 +
  pixels.begin(); // This initializes the NeoPixel library.
 +
  pixels.show();
 +
}
  
 +
void loop() {
 +
  lightLED(pixels.Red);          //Order lit the red light
 +
  lightLED(pixels.Green);        //Order lit the green light
 +
  lightLED(pixels.Blue);        //Order lit the blue light
 +
}
  
 +
void lightLED(uint32_t c) {
 +
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
 +
  for (int i = 0; i < NUMPIXELS; i++) {
 +
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
 +
    pixels.setPixelColor(i, c); // Moderately bright green color.
 +
    pixels.show(); // This sends the updated pixel color to the hardware.
 +
    delay(delayval); // Delay for a period of time (in milliseconds).
 +
  }
 +
}
 +
</pre>
 +
程序下载地址:[https://eyun.baidu.com/s/3hr9Ipuc simpleExample_ColorLED]
  
 +
程序演示效果地址:[http://v.youku.com/v_show/id_XMTMyMTU3MTIwNA==.html LED模块演示视频]
  
  
  
 
===参考资料===
 
===参考资料===
 +
<br>
 +
* [http://www.yfrobot.com/wiki/images/5/53/WS2812_Specification_sheet.pdf WS2812说明书-英文] [https://eyun.baidu.com/s/3jHZxjam 备用地址]
 +
* [http://www.yfrobot.com/wiki/images/a/aa/WS2812%E8%A7%84%E6%A0%BC%E4%B9%A6.pdf WS2812说明书-中文] [https://eyun.baidu.com/s/3mi3LlqS 备用地址]
 +
* 规格表合集 - 5050LED/WS2801/WS2811/WS2812 下载:[https://eyun.baidu.com/s/3nv5e97b LED_Specification_sheets]
 +
* [https://eyun.baidu.com/s/3c1HXUm8 Arduino-WS2812库-FastLED]
 +
* [https://eyun.baidu.com/s/3o8jxLs2 Arduino-WS2812库-Adafruit_NeoPixel]
  
* [http://www.yfrobot.com/wiki/images/5/53/WS2812_Specification_sheet.pdf WS2812说明书-英文]
 
* [http://www.yfrobot.com/wiki/images/a/aa/WS2812%E8%A7%84%E6%A0%BC%E4%B9%A6.pdf WS2812说明书-中文]
 
* [http://pan.baidu.com/s/1hqizFmO Arduino-WS2812库-FastLED]
 
* [http://pan.baidu.com/s/1kT2CuqV Arduino-WS2812库-FastLED]
 
  
 
----
 
----

2021年9月3日 (五) 10:08的最新修訂版本

創建縮圖錯誤: 檔案似乎遺失:
LED模塊


產品簡介


彩色LED模塊採用4顆 WS2812(RGB全彩高亮LED)設計製作完成。WS2812是一個集控制電路與發光電路於一體的智能外控LED光源,內置信號整形電路,任何一個像素點收到信號後經過波形整形再輸出,保證線路波形畸變不會累加,且每個像素點的三基色顏色可實現256級亮度顯示,完成16777216種顏色的全真色彩顯示,掃描頻率不低於400Hz/s,內置上電複位和掉電複位電路。串行級聯接口,能通過一根信號線完成數據的接收與解碼。可以用於彩色提示燈等。


規格參數


  • 供電電壓:DC3.3 - 5V
  • 色彩顯示:16777216種顏色的全真色彩顯示
  • 亮度調節:256級亮度調節
  • 掃描頻率:>=400Hz/s
  • 數據傳輸速率:800Kbps
  • 串行級聯:<5M時,不需要外接電路 / 刷新速率30幀/秒時,低速模式下 >=512個,高速模式下 >=1024個
  • 安裝孔徑:3MM
  • 模塊尺寸:28*21*7.3MM (長*寬*高)
  • 孔間距:15MM
  • 模塊重量:2.6g


引腳說明


  • 1. G -- Gnd(地)
  • 2. V -- Vcc(電源+5V)
  • 3. S -- Sign(信號)


應用示例


電路連接示意圖


LED模塊的 G、V、S分別連接 Arduino UNO的GND、VCC(+5V)、D5引腳。

ws2812LED4


示例代碼
#include <Adafruit_NeoPixel.h>

#define Red Color(255,0,0)
#define Green Color(0,255,0)
#define Blue Color(0,0,255)

#define PIN            5
#define NUMPIXELS      4

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 500; // delay for half a second

void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  // End of trinket special code

  pixels.begin(); // This initializes the NeoPixel library.
  pixels.show();
}

void loop() {
  lightLED(pixels.Red);          //Order lit the red light
  lightLED(pixels.Green);        //Order lit the green light
  lightLED(pixels.Blue);         //Order lit the blue light
}

void lightLED(uint32_t c) {
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  for (int i = 0; i < NUMPIXELS; i++) {
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, c); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(delayval); // Delay for a period of time (in milliseconds).
  }
}

程序下載地址:simpleExample_ColorLED

程序演示效果地址:LED模塊演示視頻


參考資料





返回首頁

更多建議和問題歡迎反饋至 YFRobot論壇

購買方式:YFRobot 電子工作室