This document describes the necessary steps from setting up the development environment to uploading the compiled software to the esp8266.
ESP32 currently got experimental support.
- esp8266 and esp32 libs have to be installed via board manager
- alle other libs need to be installed via library manager
Name | Version | Type | Comment |
---|---|---|---|
esp8266 | 2.7.4 | required | esp8266 Core Library if ESP8266 board is used |
esp32 | 1.0.4 | required | esp32 Core Library if ESP32 board is used |
FastLED | 3.4.0 | required | LED animation library |
WiFiManager | 2.0.3-alpha | required | easy WiFi setup integration |
Espalexa | 2.5.0 | optional | library for Alexa integration |
PubSubClient | 2.8.0 | optional | for MQTT/Homeassistant support |
ArduinoJson | 6.17.2 | optional | for MQTT/Homeassistant support |
ArduinoOTA | 1.0.5 | optional | library and Python 2.7 for wireless firmware updating |
Homeyduino | 1.0.2 | optional | for Homey Integration support |
Recommended if desired
IoT-Audio-Visualization-Center, Windows Application to sync the LEDs with music
The software can be found on GitHub.
For beginners I would recommend watching this setup tutorial below.
The video wasn't updated for the new update, so the library versions are incorrect and the config area looks different.
-
The code requires a recent version of the Arduino IDE, which can be downloaded here.
-
The ESP8266 / ESP32 boards need to be added to the Arduino IDE:
Click on File >> Preferences and paste the following URL into the Additional Boards Manager URLs field:http://arduino.esp8266.com/stable/package_esp8266com_index.json
In case you you want to use a ESP32 base board you need to add following URL as well (comma separated)https://dl.espressif.com/dl/package_esp32_index.json
-
Install the CH340/341 USB Driver (only needed if your computer doesn't recognize your board by default)
- Download and install the driver from e.g. Arduined
-
The Boards need be installed in the Arduino IDE
Click on Tools >> Board >> Boards Manager and install esp8266 or esp32 for ESP32 boards -
The LED Library FastLED is also required
Click on Sketch >> Include Library >> Manage Libraries and install FastLED -
Install the WiFiManager by tzapu Click on Sketch >> Include Library >> Manage Libraries and install WiFiManager by tzapu
-
Install the ESP8266FS or ESP32 Sketch Data Upload Tool:
-
Download the tool:
-
In your Arduino sketchbook directory, create
tools
directory if it doesn't exist yet -
Unpack the tool into
tools
directory (the path will look like/Arduino/tools/ESP8266FS/tool/esp8266fs.jar
or/Arduino/tools/ESP32FS/tool/esp32fs.jar
) -
Restart Arduino IDE
-
-
(Optional) Install Espalexa for Amazon Alexa Support Click on Sketch >> Include Library >> Manage Libraries and install Espalexa
-
(Optional) Install ArduinoOTA for flashing the ESP8266 via WiFi (requires Python 2.7) Click on Sketch >> Include Library >> Manage Libraries and install ArduinoOTA
-
(Optional) Install Python for OTA and add it to Path, afterwards restart your PC
- (Optional) Install PubSubClient and ArduinoJson for MQTT/Homeassistant support
Click on Sketch >> Include Library >> Manage Libraries and install PubSubClient and ArduinoJson
-
Download the Project from the Releases on Github and extract the archive
-
Open the .ino file inside the folder in the Arduino IDE
-
Secrets.h was replaced by WiFiManager
-
Configure the main parameters In the esp8266-fastled-iot-webserver.ino file there are many parameters to change and tweak the essential settings are:
LED_TYPE
: The type of LED strip that is used (WS2812B, APA102, ...)DATA_PIN
: The pin where the LED-Strip is connectedCLK_PIN
: Additional clock pin when using LED-Strips with 4 pins. Note: If you are using another controller such as a clone or a NodeMCU board, you may need to configure the pin assignment for FastLED, See also this entry in the FastLED Wiki)CORRECTION
: Affects color calibration, if colors appear weird, you might want to useTypicalLEDStrip
COLOR_ORDER
: Ordering of the colors sent, depends on the LED-Strip, if colors are swapped, then swap the Letters (RGB, RBG, GRB, GBR, BRG, BGR)MILLI_AMPS
: How much current your power supply can handle in mAVOLTS
: How much voltage your power supply delivers in Volts- Important:
LED_DEVICE_TYPE
defines what device you are using, see the list below the code and choose the number
Use this type when it is used as a regular LED strip, or if it used as an DIY-Ambilight.
Parameters:
NUM_LEDS
: The amount of LEDs on the LED-StripBAND_GROUPING
: The size of an LED group that received a packet,- The number of LEDs must be divisible by the specified value without remainder!
- Choose a value that results in a group size between 15 and 40
- Use this when using 50 LEDs+
- Example: 120 LEDs / 6 Grouping = 20
This type is created for LED-matrices that have LEDs arranged in alternating directions after every column.
Parameters:
LENGTH
: Amount of columnsHEIGHT
: Amount of rowsAddLogoVisualizers
: Adds special patterns with the HBz Logo
This type is used for the small or large 7-segment clock. It uses an additional NTP time server to get an accurate time.
Parameters:
NTP_REFRESH_INTERVAL_SECONDS
: Interval for re-syncing the time with the NTP serverntpServerName
: Address of the NTP-Servert_offset
: additional offset that is added to the timeNUM_LEDS
: The total amount of LEDs usedDigitX:
Starting position of each segment
This type is used for the twisted or round desk lamp. The animation were adapted to appear correct on the lamp due to the alternating directions.
Parameters:
LINE_COUNT
: Amount of the LED strip lines, (with the provided cores it's 8)LEDS_PER_LINE
: Amount of the LEDs inside one triangle
This type is used for the 3D-Printed Nanoleafs. The animation were adapted to appear correct on the triangles.
Parameters:
LEAFCOUNT
: Amount of the LED strip lines, (with the provided cores it's 8)PIXELS_PER_LEAF
: Amount of the LEDs per strip
This type is used for the Twenty-One-Pilots or the Thingiverse animated RGB-Logo.
Remove the "//" in front of the defines to choose the logo.
Look for ANIMATED RGB LOGO CONFIG further down the code for configuration.
- ENABLE_OTA_SUPPORT: Enables the user to update the firmware wireless
- ENABLE_MULTICAST_DNS: allows to access the UI via "http://.local/"
- RANDOM_AUTOPLAY_PATTERN: plays patterns at random in autoplay mode
- AUTOPLAY_IGNORE_UDP_PATTERNS: removes patterns that rely on incoming data
- ENABLE_ALEXA_SUPPORT: Allows to control the LEDs via Amazon Alexa
- SOUND_SENSOR_SUPPORT: (LEGACY!) Allows to control the LEDs via a physical sound sensor
- ENABLE_SERIAL_AMBILIGHT: Allows to be connected to a Lightpack (Windows, free) or Ambient light Application for Android (Android Smart TVs, 2,79€)
- ENABLE_MQTT_SUPPORT: allows integration in homeassistant, requires MQTT server
- ENABLE_UDP_VISUALIZATION: Enables patters used for visualization via IoT-Audio-Visualization-Center
- ENABLE_HOMEY_SUPPORT: enables support for integration with a Homey hub
- Requires the ArduinoOTA library and a Python 2.7 installation
- Read this article for further information
- When the OTA button on the UI or the desktop app is clicked it should show up in the ports menu
- Requires the Espalexa library
-
Configuration of addition Devices
- In order to control more parameters, the code allows to create additional devices that control, for instance a specific pattern or the autoplay functionality
- The specific pattern refers to the zero-based index of the patterns array, just count up to your desired pattern, ignore patterns that are commented out or aren't affected by the
LED_DEVICE_TYPE
- To make use of these features remove the
//
in front of the#define ...
- Installation of "PubSubClient" and "ArduinoJson" libraries required
- Requires
ENABLE_MQTT_SUPPORT
- It's preconfigured for Home Assistant Mosquitto MQTT service
- Enables sync with home assistant and from there to Google Assistant
- Installation of "Homeyduino" library required
- Requires
ENABLE_HOMEY_SUPPORT
- Enables integration with homey pod
- Configure the upload settings in Tools menu, there are 3 essential settings
- Board: LOLIN(WEMOS) D1 R2 & mini: when using the recommended Wemos D1 Mini
- Flash Size: "4MB (FS:1MB OTA:~1019KB)"
- Port: COMxx, if there are multiple ports, then replug your esp8266 to find the correct port. (Note: COM1 is usually your PCs internal parallel port and not the esp8266)
- Hit the Upload button to upload the code
This step is essential, it uploads the files for the UI (Html, JS, CSS, Icons), if it is skipped the server will just show "not found :/" Click on Tools >> ESP8266 Sketch Data Upload
-
The ESP should open an access point with the hostname, connect to it
-
Open 192.168.4.1 in your browser of choice
-
Connect to your WiFi
- Connect to the UI in your selected network by opening
http://<IP-ADDRESS>/
in your browser of choice. If mDNS was enabled, you should be able to access the UI viahttp://<Hostname>.local/
The connect your esp8266, the "Pairing-Mode" mode must be activated to add it to your Smart-Home devices in the alexa app.
Open http://ip_of_the_esp8266/alexa in your browser, the window should tell you that it is ready to be discovered by your alexa device.
Important: The esp8266 and you Amazon Echo device must be in the same network.
Just say to your echo, "Alexa, discover devices". This phrase can be spoken out in English on any echo device independent of the device's language.
After around 30 seconds, Alexa should respond with the devices that were found. These should show up in the Alexa app.