diff --git a/CHANGES.rst b/CHANGES.rst index 36b4878..ebf1585 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ ChangeLog +------------+----------------------------------------------------------------------+------------+ | Version | Description | Date | +============+======================================================================+============+ -| *Upcoming* | *TBC* | | +| *Upcoming* | * Add support for WS2812 NeoPixel strips/arrays | | +------------+----------------------------------------------------------------------+------------+ | **0.3.3** | * Fix for dot muncher: not handling full-stop at line end | 2017/01/21 | | | * Documentation updates | | diff --git a/doc/install.rst b/doc/install.rst index c03437d..879811d 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -69,11 +69,25 @@ Board Pin Name Remarks RPi Pin RPi Function WS2812 NeoPixels (DMA) ^^^^^^^^^^^^^^^^^^^^^^ -Pre-requisites -"""""""""""""" - GPIO pin-outs """"""""""""" +Typically, neopixels reqire VCC, VSS (GND) and DI pins connecting to the +Raspberry Pi, where the DI pin is usually connected to a PWM control pin +such as GPIO 18. + +============ ====== ============= ========= ==================== +Board Pin Name Remarks RPi Pin RPi Function +------------ ------ ------------- --------- -------------------- +1 DO Data Out - - +2 DI Data In 12 GPIO 18 (PWM0) +3 VCC +5V Power 2 5V0 +4 NC Not connected - - +5 VDD Not connected - - +6 VSS Ground 6 GND +============ ====== ============= ========= ==================== + +The DO pin should be connected to the DI pin on the next (daisy-chained) +neopixel, while the VCC and VSS are supplied in-parallel to all LED's. Installing from PyPi ^^^^^^^^^^^^^^^^^^^^ @@ -99,8 +113,8 @@ Raspbian .. code:: bash $ cd luma.led_matrix - $ sudo apt-get install python-dev python-pip - $ sudo pip install spidev + $ sudo usermod -a -G spi,gpio pi + $ sudo apt-get install python-dev python-pip libfreetype6-dev libjpeg8-dev libsdl1.2-dev $ sudo python setup.py install Arch Linux @@ -109,5 +123,4 @@ Arch Linux cd luma.led_matrix pacman -Sy base-devel python2 - pip install spidev python2 setup.py install diff --git a/doc/python-usage.rst b/doc/python-usage.rst index 9d5a863..4684fb3 100644 --- a/doc/python-usage.rst +++ b/doc/python-usage.rst @@ -260,16 +260,22 @@ initialize the device with ``width=N`` and ``height=N`` attributes instead: draw.line((6, 0, 6, device.height), fill="violet") draw.line((7, 0, 7, device.height), fill="white") +.. note:: + The neopixel driver uses the `ws2812 `_ + PyPi package to interface to the daisychained LEDs. It uses DMA (direct memory + access) via ``/dev/mem`` which means that it has to run in privileged mode + (via ``sudo`` root access). + Examples ^^^^^^^^ Ensure you have followed the installation instructions in the next section. Run the example code as follows:: - $ sudo python examples/matrix_demo.py + $ python examples/matrix_demo.py or:: - $ sudo python examples/sevensegment_demo.py + $ python examples/sevensegment_demo.py or::