Skip to content

SPI Setup

Charlie Powell edited this page Nov 5, 2020 · 9 revisions

The plugin uses the Raspberry Pi's SPI interface to push data to the LED strip, rather than PWM since it doesn't need to be run as root to use SPI.

As a result of this, there are a couple of OS level configuration items that need to be handled. Luckily for you, the plugin makes this very easy for you to do by providing a UI to run the commands.

Initial Setup Wizard

Note: You may need to reload the web UI after installing the plugin, to get the wizard to show up. It will not display if all settings are correct.

  • Add the pi user to the gpio group. Already configured on newer images. Means the pi users can access the GPIO pins.

    • Runs sudo adduser pi gpio
  • Enable SPI. The plugin uses SPI to drive the LEDs, which is disabled by default and needs to be turned on.

    • Adds dtparam=spi=on to /boot/config.txt
  • Increase SPI buffer size. Whilst the plugin will work without this, it will only work well with a handful of LEDs.

    • Adds spidev.bufsize=32768 to the end of /boot/cmdline.txt
  • Set compatible clock frequency - Raspberry Pi 3 or earlier only, not required for a Pi 4 The Pi 3's default internal clock frequency is not compatible with SPI, so it needs to be set to 250 to be compatible.

    • Adds core_freq=250 to /boot/config.txt
  • Set a minimum clock frequency - Raspberry Pi 4 only On a Raspberry Pi 4, the clock frequency is dynamic and can change when the pi is 'idle' vs. 'working', which causes LEDs to flicker, change colour, or stop working completely. By setting a minimum the same as the max, we stop this dynamic clocking.

    • Adds core_freq_min=500 to /boot/config.txt

OS Configuration test

At any time, you can run a test of the above settings, using the configuration test dialog. New in 0.6.0, you can access this in the settings page under 'Utilities'. When you run the test, it will tell you if all of the above steps are filled in correctly, and if they are not, prompt you to fix it with a handy button.

This data is also logged to octoprint.log on startup, to help me with diagnosing issues reported to rule out this configuration.

Heads up! This documentation has migrated to Gitbook! Find it here: https://cp2004.gitbook.io/ws281x-led-status/

Clone this wiki locally