Skip to content

Commit 0862859

Browse files
authored
New usermod: Support for RGB Rotary Encoder Board (wled#2068)
* Added RGB Rotary Encoder usermod v1 * RGB rotary encoder UM: Readme; Added example video * RGB rotary encoder UM: Readme; Added example video * RGB rotary encoder UM: Fixed getJsonValue usage * RGB rotary encoder UM: Removed spaces in JSON keys * RGB rotary encoder UM: Cleanup readFromConfig * RGB rotary encoder UM: Cleaned up type usages * RGB rotary encoder UM: Fixed crash on re-enable
1 parent 3ad336a commit 0862859

File tree

3 files changed

+438
-0
lines changed

3 files changed

+438
-0
lines changed

usermods/rgb-rotary-encoder/readme.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# RGB Encoder Board
2+
3+
This usermod-v2 adds support for the awesome RGB Rotary Encoder Board by Adam Zeloof / "Isotope Engineering" to control the overall brightness of your WLED instance: https://github.com/isotope-engineering/RGB-Encoder-Board. A great DIY rotary encoder with 20 tiny SK6805 / "NeoPixel Nano" LEDs.
4+
5+
https://user-images.githubusercontent.com/3090131/124680599-0180ab80-dec7-11eb-9065-a6d08ebe0287.mp4
6+
7+
## Credits
8+
The actual / original code that does the different LED modes is from Adam Zeloof. So I don't take credit for these. But I ported it to WLED, which involved replacing the LED library he used (because, guess what, WLED already has one; so no need to add another one, but use whatever WLED uses), plus the rotary encoder library, because that one was not compatible with ESP, only Arduino.
9+
So it was quite more work than I hoped, but I got there eventually :)
10+
11+
## Requirements
12+
* "ESP Rotary" by Lennart Hennigs, v1.5.0 or higher: https://github.com/LennartHennigs/ESPRotary
13+
14+
## Usermod installation
15+
Simply copy the below block (build task) to your `platformio_override.ini` and compile WLED using this new build task. Or use an existing one and add the buildflag `-D RGB_ROTARY_ENCODER`.
16+
17+
ESP32:
18+
```
19+
[env:custom_esp32dev_usermod_rgb_encoder_board]
20+
extends = env:esp32dev
21+
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 -D RGB_ROTARY_ENCODER
22+
lib_deps = ${esp32.lib_deps}
23+
lennarthennigs/ESP Rotary@^1.5.0
24+
```
25+
26+
ESP8266 / D1 Mini:
27+
```
28+
[env:custom_d1_mini_usermod_rgb_encoder_board]
29+
extends = env:d1_mini
30+
build_flags = ${common.build_flags_esp8266} -D RGB_ROTARY_ENCODER
31+
lib_deps = ${esp8266.lib_deps}
32+
lennarthennigs/ESP Rotary@^1.5.0
33+
```
34+
35+
## How to connect the board to your ESP
36+
We gonna need (minimum) three or (maximum) four GPIOs for the board:
37+
* "ea": Basically tells if the encoder goes into one or the other direction
38+
* "eb": Same thing, but the other direction
39+
* "di": LED data in. To actually control the LEDs
40+
* *(optional)* "sw": The integrated switch in the rotary encoder. Can be omitted for the bare functionality of just controlling the brightness
41+
42+
We also gonna need some power, so:
43+
44+
* "vdd": Needs to be connected to **+5V**.
45+
* "gnd": Well, it's GND.
46+
47+
You can freely pick the GPIOs, it doesn't matter. Those will be configured in the "Usermods" section in the WLED web panel:
48+
49+
## Configuration
50+
Navigate to the "Config" and then to the "Usermods" section. If you compiled WLED with `-D RGB_ROTARY_ENCODER`, you will see the config for it there. The settings there are the GPIOs we mentioned before (*Note: The switch pin is not there, as this can just be configured the "normal" button on the "LED Preferences" page*), plus a few more:
51+
* LED pin:
52+
* Possible values: Any valid and available GPIO
53+
* Default: 3
54+
* What it does: Pin to control the LED ring
55+
* ea pin:
56+
* Possible values: Any valid and available GPIO
57+
* Default: 15
58+
* What it does: First of the two rotary encoder pins
59+
* eb pin:
60+
* Possible values: Any valid and available GPIO
61+
* Default: 32
62+
* What it does: Second of the two rotary encoder pins
63+
* LED Mode:
64+
* Possible values: 1-3
65+
* Default: 3
66+
* What it does: The usermod provides three different modes of how the LEDs can look like. Here's an example: https://github.com/isotope-engineering/RGB-Encoder-Board/blob/master/images/rgb-encoder-animations.gif
67+
* Up left is "1"
68+
* Up right is not supported / doesn't make sense for brightness control
69+
* Bottom left is "2"
70+
* Bottom right is "3"
71+
* LED Brightness:
72+
* Possible values: 1-255
73+
* Default: 64
74+
* What it does: Brightness of the LED ring
75+
* Steps per click:
76+
* Possible values: Any positive number
77+
* Default: 4
78+
* What it does: With each "click", a rotary encoder actually increments it's "steps". Most rotary encoder do four "steps" per "click". I know this sounds super weird, so just leave this the default value, unless your rotary encoder behaves weirdly, like with one click, it makes two LEDs light up, or you sometimes need two click for one LED. Then you should play around with this value or write a small sketch using the same "ESP Rotary" library and read out the steps it does.
79+
* Increment per click:
80+
* Possible values: Any positive number
81+
* Default: 5
82+
* What it does: Most rotary encoder have 20 "clicks", so basically 20 positions. This value should be set to 100 / `number of clicks`
83+
84+
## Change log
85+
2021-07
86+
* First implementation.

0 commit comments

Comments
 (0)