Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Vojacek committed Sep 20, 2022
1 parent 6a81dcf commit 4669f54
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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":[<R>, <G>, <B>]}` where `<R>`,`<G>` and `<B>` are numbers from 0 to 255.

Example:

``` bash
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"
```

## Configuration
### Auto mode

**TODO:** Describe your plugin's configuration options (if any).
Colors are changed automaticaly by connection and print events.

0 comments on commit 4669f54

Please sign in to comment.