forked from Aircoookie/WLED
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into solidRgbwLedStrips
- Loading branch information
Showing
58 changed files
with
5,139 additions
and
5,330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,14 @@ | |
A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812, APA102) LEDs! | ||
|
||
### Features: | ||
- WS2812FX library integrated for 80 special effects | ||
- WS2812FX library integrated for almost 90 special effects | ||
- FastLED noise effects and palettes | ||
- Customizable Mobile and desktop UI with color and effect controls | ||
- Modern UI with color, effect and segment controls | ||
- Segments to set different effects and colors to parts of the LEDs | ||
- Settings page - configuration over network | ||
- Access Point and station mode - automatic failsafe AP | ||
- Support for RGBW strips | ||
- 25 user presets to save and load colors/effects easily, supports cycling through them. | ||
- 16 user presets to save and load colors/effects easily, supports cycling through them. | ||
- Macro functions to automatically execute API calls | ||
- Nightlight function (gradually dims down) | ||
- Full OTA software updatability (HTTP + ArduinoOTA), password protectable | ||
|
@@ -42,6 +43,12 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control | |
|
||
See the [wiki](https://github.com/Aircoookie/WLED/wiki)! | ||
|
||
DrZzs has made some excellent video guides: | ||
[Introduction, hardware and installation](https://www.youtube.com/watch?v=tXvtxwK3jRk) | ||
[Settings, tips and tricks](https://www.youtube.com/watch?v=6eCE2BpLaUQ) | ||
|
||
If you'd rather read, here is a very [detailed step-by-step beginner tutorial](https://tynick.com/blog/11-03-2019/getting-started-with-wled-on-esp8266/) by tynick! | ||
|
||
### Other | ||
|
||
Licensed under the MIT license | ||
|
@@ -52,3 +59,9 @@ Uses Linearicons by Perxis! | |
Join the Discord [server](https://discord.gg/KuqP7NE) to discuss everything about WLED! | ||
You can also send me mails to [[email protected]](mailto:[email protected]). | ||
If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) | ||
|
||
*Disclaimer:* | ||
If you are sensitive to photoeleptic seizures it is not recommended that you use this software. | ||
In case you still want to try, don't use strobe, lighting or noise modes or high effect speed settings. | ||
As per the MIT license, i assume no liability for any damage to you or any other person or equipment. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
These files allow WLED 0.8.6 to report the temp sensor on the Quinled board to MQTT. I use it to report the board temp to Home Assistant via MQTT, so it will send notifications if something happens and the board start to heat up. | ||
|
||
This code uses Aircookie's WLED software. It has a premade file for user modifications. I use it to publish the temperature from the dallas temperature sensor on the Quinled board. The entries for the top of the WLED00 file, initializes the required libraries, and variables for the sensor. The .ino file waits for 60 seconds, and checks to see if the MQTT server is connected (thanks Aircoookie). It then poles the sensor, and published it using the MQTT service already running, using the main topic programmed in the WLED UI. | ||
|
||
To install: | ||
|
||
Add the enties in the WLED00 file to the top of the same file from Aircoookies WLED. | ||
Replace the WLED06_usermod.ino file in Aircoookies WLED folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//Intiating code for QuinLED Dig-Uno temp sensor | ||
//Uncomment Celsius if that is your prefered temperature scale | ||
#include <DallasTemperature.h> | ||
OneWire oneWire(14); | ||
DallasTemperature sensors(&oneWire); | ||
long temptimer = millis(); | ||
long lastMeasure = 0; | ||
//#define Celsius |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//starts Dallas Temp service on boot | ||
void userSetup() | ||
{ | ||
// Start the DS18B20 sensor | ||
sensors.begin(); | ||
} | ||
|
||
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here | ||
void userConnected() | ||
{ | ||
|
||
} | ||
|
||
void userLoop() | ||
{ | ||
temptimer = millis(); | ||
|
||
// Timer to publishe new temperature every 60 seconds | ||
if (temptimer - lastMeasure > 60000) { | ||
lastMeasure = temptimer; | ||
|
||
//Check if MQTT Connected, otherwise it will crash the 8266 | ||
if (mqtt != nullptr){ | ||
sensors.requestTemperatures(); | ||
|
||
//Gets prefered temperature scale based on selection in definitions section | ||
#ifdef Celsius | ||
float board_temperature = sensors.getTempCByIndex(0); | ||
#else | ||
float board_temperature = sensors.getTempFByIndex(0); | ||
#endif | ||
|
||
//Create character string populated with user defined device topic from the UI, and the read temperature. Then publish to MQTT server. | ||
char subuf[38]; | ||
strcpy(subuf, mqttDeviceTopic); | ||
strcat(subuf, "/temperature"); | ||
mqtt->publish(subuf, 0, true, String(board_temperature).c_str()); | ||
return;} | ||
return;} | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
### Usermods | ||
|
||
This folder serves as a repository for usermods (custom `wled06_usermod.ino` files)! | ||
|
||
If you have created an usermod that you believe is useful (for example to support a particular sensor, display, feature...), feel free to contribute by opening a pull request! | ||
|
||
In order for other people to be able to have fun with your usermod, please keep these points in mind: | ||
|
||
- Create a folder in this folder with a descriptive name (for example `usermod_ds18b20_temp_sensor_mqtt`) | ||
- Include your custom `wled06_usermod.ino` file | ||
- If your usermod requieres changes to other WLED files, please write a `readme.md` outlining the steps one has to take to use the usermod | ||
- Create a pull request! | ||
- If your feature is useful for the majority of WLED users, I will consider adding it to the base code! | ||
|
||
While I do my best to not break too much, keep in mind that as WLED is being updated, usermods might break. | ||
I am not actively maintaining any usermod in this directory, that is your responsibility as the creator of the usermod. | ||
|
||
Thank you for your help :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) | ||
|
||
long lastTime = 0; | ||
int delayMs = 10; | ||
const int pinA = D6; //data | ||
const int pinB = D7; //clk | ||
int oldA = LOW; | ||
|
||
//gets called once at boot. Do all initialization that doesn't depend on network here | ||
void userSetup() { | ||
pinMode(pinA, INPUT_PULLUP); | ||
pinMode(pinB, INPUT_PULLUP); | ||
} | ||
|
||
//gets called every time WiFi is (re-)connected. Initialize own network interfaces here | ||
void userConnected() { | ||
} | ||
|
||
//loop. You can use "if (WLED_CONNECTED)" to check for successful connection | ||
void userLoop() { | ||
if (millis()-lastTime > delayMs) { | ||
int A = digitalRead(pinA); | ||
int B = digitalRead(pinB); | ||
|
||
if (oldA == LOW && A == HIGH) { | ||
if (oldB == HIGH) { | ||
// bri += 10; | ||
// if (bri > 250) bri = 10; | ||
effectCurrent += 1; | ||
if (effectCurrent >= MODE_COUNT) effectCurrent = 0; | ||
} | ||
else { | ||
// bri -= 10; | ||
// if (bri < 10) bri = 250; | ||
effectCurrent -= 1; | ||
if (effectCurrent < 0) effectCurrent = (MODE_COUNT-1); | ||
} | ||
oldA = A; | ||
|
||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) | ||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa | ||
colorUpdated(6); | ||
lastTime = millis(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SSD1306 128x32 OLED via I2C with u8g2 | ||
This usermod allows to connect 128x32 Oled display to WLED controlled and show | ||
the next information: | ||
- Current SSID | ||
- IP address if obtained | ||
* in AP mode and turned off lightning AP password is shown | ||
- Current effect | ||
- Current palette | ||
- On/Off icon (sun/moon) | ||
|
||
## Hardware | ||
![Hardware connection](assets/hw_connection.png) | ||
|
||
## Requirements | ||
Functionality checked with: | ||
- commit 095429a7df4f9e2b34dd464f7bbfd068df6558eb | ||
- Wemos d1 mini | ||
- PlatformIO | ||
- Generic SSD1306 128x32 I2C OLED display from aliexpress | ||
|
||
### Platformio | ||
Add `U8g2@~2.27.2` dependency to `lib_deps_external` under `[common]` section in `platformio.ini`: | ||
```ini | ||
# platformio.ini | ||
... | ||
[common] | ||
... | ||
lib_deps_external = | ||
... | ||
U8g2@~2.27.2 | ||
... | ||
``` | ||
|
||
### Arduino IDE | ||
Install library `U8g2 by oliver` in `Tools | Include Library | Manage libraries` menu. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/ | ||
|
||
// If display does not work or looks corrupted check the | ||
// constructor reference: | ||
// https://github.com/olikraus/u8g2/wiki/u8x8setupcpp | ||
// or check the gallery: | ||
// https://github.com/olikraus/u8g2/wiki/gallery | ||
U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, 5, | ||
4); // Pins are Reset, SCL, SDA | ||
|
||
// gets called once at boot. Do all initialization that doesn't depend on | ||
// network here | ||
void userSetup() { | ||
u8x8.begin(); | ||
u8x8.setPowerSave(0); | ||
u8x8.setFont(u8x8_font_chroma48medium8_r); | ||
u8x8.drawString(0, 0, "Loading..."); | ||
} | ||
|
||
// gets called every time WiFi is (re-)connected. Initialize own network | ||
// interfaces here | ||
void userConnected() {} | ||
|
||
// needRedraw marks if redraw is required to prevent often redrawing. | ||
bool needRedraw = true; | ||
|
||
// Next variables hold the previous known values to determine if redraw is | ||
// required. | ||
String knownSsid = ""; | ||
IPAddress knownIp; | ||
uint8_t knownBrightness = 0; | ||
uint8_t knownMode = 0; | ||
uint8_t knownPalette = 0; | ||
|
||
long lastUpdate = 0; | ||
// How often we are redrawing screen | ||
#define USER_LOOP_REFRESH_RATE_MS 5000 | ||
|
||
void userLoop() { | ||
|
||
// Check if we time interval for redrawing passes. | ||
if (millis() - lastUpdate < USER_LOOP_REFRESH_RATE_MS) { | ||
return; | ||
} | ||
lastUpdate = millis(); | ||
|
||
// Check if values which are shown on display changed from the last tiem. | ||
if ((apActive == true ? String(apSSID) : WiFi.SSID()) != knownSsid) { | ||
needRedraw = true; | ||
} else if (knownIp != (apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP())) { | ||
needRedraw = true; | ||
} else if (knownBrightness != bri) { | ||
needRedraw = true; | ||
} else if (knownMode != strip.getMode()) { | ||
needRedraw = true; | ||
} else if (knownPalette != strip.getSegment(0).palette) { | ||
needRedraw = true; | ||
} | ||
|
||
if (!needRedraw) { | ||
return; | ||
} | ||
needRedraw = false; | ||
|
||
// Update last known values. | ||
knownSsid = apActive ? WiFi.softAPSSID() : WiFi.SSID(); | ||
knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); | ||
knownBrightness = bri; | ||
knownMode = strip.getMode(); | ||
knownPalette = strip.getSegment(0).palette; | ||
|
||
u8x8.clear(); | ||
u8x8.setFont(u8x8_font_chroma48medium8_r); | ||
|
||
// First row with Wifi name | ||
u8x8.setCursor(1, 0); | ||
u8x8.print(ssid.substring(0, u8x8.getCols() > 1 ? u8x8.getCols() - 2 : 0)); | ||
// Print `~` char to indicate that SSID is longer, than owr dicplay | ||
if (ssid.length() > u8x8.getCols()) | ||
u8x8.print("~"); | ||
|
||
// Second row with IP or Psssword | ||
u8x8.setCursor(1, 1); | ||
// Print password in AP mode and if led is OFF. | ||
if (apActive && bri == 0) | ||
u8x8.print(apPass); | ||
else | ||
u8x8.print(ip); | ||
|
||
// Third row with mode name | ||
u8x8.setCursor(2, 2); | ||
uint8_t qComma = 0; | ||
bool insideQuotes = false; | ||
uint8_t printedChars = 0; | ||
char singleJsonSymbol; | ||
// Find the mode name in JSON | ||
for (size_t i = 0; i < strlen_P(JSON_mode_names); i++) { | ||
singleJsonSymbol = pgm_read_byte_near(JSON_mode_names + i); | ||
switch (singleJsonSymbol) { | ||
case '"': | ||
insideQuotes = !insideQuotes; | ||
break; | ||
case '[': | ||
case ']': | ||
break; | ||
case ',': | ||
qComma++; | ||
default: | ||
if (!insideQuotes || (qComma != knownMode)) | ||
break; | ||
u8x8.print(singleJsonSymbol); | ||
printedChars++; | ||
} | ||
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2)) | ||
break; | ||
} | ||
// Fourth row with palette name | ||
u8x8.setCursor(2, 3); | ||
qComma = 0; | ||
insideQuotes = false; | ||
printedChars = 0; | ||
// Looking for palette name in JSON. | ||
for (size_t i = 0; i < strlen_P(JSON_palette_names); i++) { | ||
singleJsonSymbol = pgm_read_byte_near(JSON_palette_names + i); | ||
switch (singleJsonSymbol) { | ||
case '"': | ||
insideQuotes = !insideQuotes; | ||
break; | ||
case '[': | ||
case ']': | ||
break; | ||
case ',': | ||
qComma++; | ||
default: | ||
if (!insideQuotes || (qComma != knownPalette)) | ||
break; | ||
u8x8.print(singleJsonSymbol); | ||
printedChars++; | ||
} | ||
if ((qComma > knownMode) || (printedChars > u8x8.getCols() - 2)) | ||
break; | ||
} | ||
|
||
u8x8.setFont(u8x8_font_open_iconic_embedded_1x1); | ||
u8x8.drawGlyph(0, 0, 80); // wifi icon | ||
u8x8.drawGlyph(0, 1, 68); // home icon | ||
u8x8.setFont(u8x8_font_open_iconic_weather_2x2); | ||
u8x8.drawGlyph(0, 2, 66 + (bri > 0 ? 3 : 0)); // sun/moon icon | ||
} |
Oops, something went wrong.