Part 1
요약·해설
공통 ground, thingy52 반전 출력, 갱신 주기와 console 출력을 보존합니다.
WS2812 · APA102 · LPD8806
보통 5V
74AHCT125
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
D212F0DB7CD95FE0240E31834BC1905322E7DD68A2FD1FB1159A24260289C115
.. zephyr:code-sample:: led-strip
:name: LED strip
:relevant-api: led_strip_interface
Control an LED strip example.
Overview
********
This sample application demonstrates basic usage of the LED strip.
Requirements
************
Zephyr supports various LED strip chips. For example,
- WS2812, such as the `NeoPixel(WS2812 compatible) LED Strip from AdaFruit`_.
- APA102, such as the `Dotstar(APA102 compatible) LED Strip from AdaFruit`_.
- LPD8806, such as the `LPD8806 LED Strip from AdaFruit`_.
- Power supply. These LED strips usually require a 5V supply.
- If the LED strip connects to the SPI bus, SPI communications usually use 5V
signaling, which may require a level translator, such as the
`74AHCT125 datasheet`_.
.. _NeoPixel(WS2812 compatible) LED Strip from AdaFruit: https://www.adafruit.com/product/3919
.. _Dotstar(APA102 compatible) LED Strip from AdaFruit: https://www.adafruit.com/product/2242
.. _LPD8806 LED Strip from AdaFruit: https://www.adafruit.com/product/1948
.. _74AHCT125 datasheet: https://cdn-shop.adafruit.com/datasheets/74AHC125.pdf
Wiring
******
APA020 and LPD880x
==================
#. Ensure your Zephyr board, the 5V power supply, and the LED strip
share a common ground.
#. Connect the MOSI pin of your board's SPI master to the data input
pin of the first IC in the strip.
#. Connect the SCLK pin of your board's SPI master to the clock input
pin of the first IC in the strip.
#. Connect the 5V power supply pin to the 5V input of the LED strip.
WS2812
======
#. Ensure your Zephyr board, and the LED strip share a common ground.
#. Connect the LED strip control pin (either I2S SDOUT, SPI MOSI or GPIO) from
your board to the data input pin of the first WS2812 IC in the strip.
#. Power the LED strip at an I/O level compatible with the control pin signals.
Note about thingy52
-------------------
The thingy52 has integrated NMOS transistors, that can be used instead of a level shifter.
The I2S driver supports inverting the output to suit this scheme, using the ``out-active-low`` dts
property. See the overlay file
:zephyr_file:`samples/drivers/led_strip/boards/thingy52_nrf52832.overlay` for more detail.
Building and Running
********************
The sample updates the LED strip periodically. The update frequency can be
modified by changing the :kconfig:option:`CONFIG_SAMPLE_LED_UPDATE_DELAY`.
Then build and flash the application:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/led_strip
:board: <board>
:goals: flash
:compact:
When you connect to your board's serial console, you should see the
following output:
.. code-block:: none
***** Booting Zephyr OS build v2.1.0-rc1-191-gd2466cdaf045 *****
[00:00:00.005,920] <inf> main: Found LED strip device WS2812
[00:00:00.005,950] <inf> main: Displaying pattern on strip
References
**********
- `WS2812 datasheet`_
- `LPD8806 datasheet`_
- `APA102C datasheet`_
- `74AHCT125 datasheet`_
- `RGB LED strips: an overview`_
- An excellent `blog post on WS2812 timing`_.
.. _WS2812 datasheet: https://cdn-shop.adafruit.com/datasheets/WS2812.pdf
.. _LPD8806 datasheet: https://cdn-shop.adafruit.com/datasheets/lpd8806+english.pdf
.. _APA102C datasheet: https://cdn-shop.adafruit.com/product-files/2477/APA102C-iPixelLED.pdf
.. _blog post on WS2812 timing: https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/
.. _RGB LED strips\: an overview: http://nut-bolt.nl/2012/rgb-led-strips/
Part 3
한국어 전문 번역
개요
이 sample application은 LED strip의 기본 사용법을 보여줍니다.
요구 사항
Zephyr는 여러 LED strip chip을 지원합니다. 예를 들면 다음과 같습니다.
- WS2812: AdaFruit NeoPixel(WS2812 compatible) LED Strip 등
- APA102: AdaFruit Dotstar(APA102 compatible) LED Strip 등
- LPD8806: AdaFruit LPD8806 LED Strip 등
- 전원 공급 장치가 필요합니다. 이러한 LED strip은 보통 5V 전원을 요구합니다.
- LED strip을 SPI bus에 연결할 경우 SPI 통신은 보통 5V signaling을 사용하므로 74AHCT125 datasheet의 device 같은 level translator가 필요할 수 있습니다.
배선
APA020과 LPD880x
- Zephyr board, 5V 전원 공급 장치와 LED strip이 공통 ground를 사용하게 합니다.
- Board SPI master의 MOSI pin을 strip 첫 번째 IC의 data input pin에 연결합니다.
- Board SPI master의 SCLK pin을 strip 첫 번째 IC의 clock input pin에 연결합니다.
- 5V 전원 공급 pin을 LED strip의 5V input에 연결합니다.
WS2812
- Zephyr board와 LED strip이 공통 ground를 사용하게 합니다.
- Board의 LED strip control pin(I2S SDOUT, SPI MOSI 또는 GPIO)을 strip 첫 번째 WS2812 IC의 data input pin에 연결합니다.
- Control pin signal과 호환되는 I/O level로 LED strip에 전원을 공급합니다.
thingy52 참고 사항
thingy52에는 level shifter 대신 사용할 수 있는 NMOS transistor가 내장되어 있습니다. I2S driver는 out-active-low DTS property를 사용하여 이 회로에 맞게 출력을 반전할 수 있습니다. 자세한 내용은 samples/drivers/led_strip/boards/thingy52_nrf52832.overlay overlay file을 참조하십시오.
Build와 실행
Sample은 LED strip을 주기적으로 갱신합니다. CONFIG_SAMPLE_LED_UPDATE_DELAY를 변경하면 갱신 주기를 조정할 수 있습니다.
그런 다음 application을 build하고 flash합니다.
west build -b <board> samples/drivers/led_strip
west flash
Board의 serial console에 연결하면 다음 출력이 나타납니다.
***** Booting Zephyr OS build v2.1.0-rc1-191-gd2466cdaf045 *****
[00:00:00.005,920] <inf> main: Found LED strip device WS2812
[00:00:00.005,950] <inf> main: Displaying pattern on strip
참고 자료
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.