From 4669f54682b2204d539d56832e283a290d0cb448 Mon Sep 17 00:00:00 2001 From: Pavel Vojacek Date: Tue, 20 Sep 2022 14:28:04 +0200 Subject: [PATCH] Add readme --- README.md | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 38fb7e5..a896e5e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,49 @@ # OctoPrint-Awesome-Karmen-LED -**TODO:** Describe what your plugin does. +Control APA102 LEDs attached to Raspberry Pi. -## Setup +## Requirements -Install via the bundled [Plugin Manager](https://docs.octoprint.org/en/master/bundledplugins/pluginmanager.html) +- 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](https://github.com/tinue/apa102-pi#wiring). 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 + +- Install via the bundled [Plugin Manager](https://docs.octoprint.org/en/master/bundledplugins/pluginmanager.html) or manually using this URL: https://github.com/fragaria/karmen-led-octoprint-plugin/archive/master.zip -**TODO:** Describe how to install your plugin, if more needs to be done than just installing it via pip or through -the plugin manager. +- Enable SPI interface on RPI [(official documentation)](https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/) + - On desktop use "Raspberry Pi Configuration" dialog *or* + - From terminal run `sudo raspi-config` and in `Interfacing options` enable `P4 SPI` *or* + - Edit `sudo nano /boot/config.txt` and uncomment `dtparam=spi=on` line. + +## 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":[, , ]}` where ``,`` and `` are numbers from 0 to 255. + +Example: + +``` bash +curl http:///api/plugin/awesome_karmen_led --header "X-Api-Key: " -X POST -d '{"command": "set_led", "color":[255, 255, 255]}' -H "Content-Type: application/json" +``` -## Configuration +### Auto mode -**TODO:** Describe your plugin's configuration options (if any). +Colors are changed automaticaly by connection and print events.