Skip to content

fragaria/karmen-led-octoprint-plugin

Repository files navigation

OctoPrint-Awesome-Karmen-LED

Control APA102 LEDs attached to Raspberry Pi.

Requirements

  • Raspberry pi with octoprint
  • APA102 LED attached to rpi

Wiring

  • rpi is 3.3v and APA102 is 5v device. Correct solution would be usage of level shifter as described here. But from our experience it works just fine without level shifting.

Connect

  • LED 5v <-> rpi 5v (in case of just one or two leds; longer strip needs separate power source or it may end up with demaged rpi)
  • LED ground <-> rpi ground
  • LED data <-> rpi SPI MOSI
  • LED clock <-> rpi SPI SCLK

Installation

Usage

Plugin has two modes of operation - API and automatic. Modes can be switched in plugin's settings.

API mode

To turn LEDs on send POST request to /api/plugin/awesome_karmen_led with json body {"command": "set_led", "color":[<R>, <G>, <B>]} where <R>,<G> and <B> are numbers from 0 to 255.

Example:

curl http://<rpi_hostname_or_ip>/api/plugin/awesome_karmen_led --header "X-Api-Key: <YOURAPIKEY>" -X POST -d '{"command": "set_led", "color":[255, 255, 255]}' -H "Content-Type: application/json"

Auto mode

Colors are changed automaticaly by connection and print events.