another ESP8266 controller for neopixels strip, with (ugly but functional) WEB interface and some cool features (own SPI transfer method) THIS IS NOT COMPLETED... Tested with ESP01 and ESP12. SPI method, works stable (300leds 17ms update time).
big mess in source, but yet usable ;-)
Select library in file helpers.cpp. With Adafruit NeoPixel library, pin, quantity and color type of leds are changable at runtime via WEB.
With SPI_transfer or I2S_transfer, type and quantity of leds are changable either.
SPI transfer uses small HSPI fifo buffer (60 from 64bytes) to buffer data for 5 leds. HSPI speed is calculated for 160MHZ CPU (80MHz works too), there is compiller message with SPI speed. WS signal is created by simulate WS timing in 4bit SPI data (1 led in 3 x uint32) and is generated via MOSI pin. Just connect it to WS281x DIN pin.
This implementation takes over SPI (MOSI pin) and is not usable as proper SPI bus, but... To use SPI with another device, AND gate is needed. To simulate CS (active high) connect to A, B to MOSI-this could be TTL level shifter either.
I use simple transistor voltage level shifter.
Standard SPI.writebytes does not work at all. Only SPI.write32 works. Just set SPI freq around 3.2MHz and send wspacket prepared by prepareSPIpacket() function. I wanted to use https://github.com/MetalPhreak/ESP8266_SPI_Driver but finally had to write own method to transfer without waiting for ends. Thanks to His library I wrote my SPI method to send data with HSPI buffer.
I2S_transfer uses large RAM buffer for DMA transfer. This method is copied from NeoPixelBus library (https://github.com/Makuna/NeoPixelBus) and little changed. I borrowed it because of need to change the type and number of leds during runtime.
Every method has cons and pros.
Choose wisely.
Watch out, i2s share pin with UART0 RX -GPIO3 (which is used also to upload firmware) strip will lights without control. I use OTA programming (fast and reliable).
Firmware update via httpupdate from configtree page (at the bottom). See credentials data from helpers.cpp (admin,admin). Take firmware.BIN after compling in VSC (.pio\build\esp12e\ ).
Works in all aspects (sending parameters, led data) but... When sending data has low speed just interferes with other functions (mostly on preview leds). There are some glitches then, even WDT resets. Works best with i2s method. There is feature when cycle is to long (4xPERIOD_TASK_WIFI) twice , resets ESP.
I tested this on MCU v2 clone with key marked Flash which is connected to GPIO0. Changable in helpers.cpp (USE_KEY_GPIO). Enabled INPUT_PULLUP.
I use VSS with platformio and when it is enabled, I get compiller error. Tested in Arduino IDE, works.
Works.
Use led connected to pin GPIO02. Led build in ESP12's pcb.
To run this project in Arduino IDE, just copy /src folder to Arduino's sketches folder. Rename it to esptree and rename file main.cpp to esptree.ino. Download needed libraries.
- ESP01 module -need to disable OTA, no need to use SPIFF (all pages in flash);
- ESP12e -all features
TODO (some ideas):
-change the way WS works when sending data (multiple leds at once, but with timing correction)
-clean code mess
-fully implement different types of leds (color type) in string (id could be used)
-implement SPIFF webpages
-implement SPIFF graphics and animations
-system cfg on SPIFF ()
-implement some sound depending effects (VU meter, brightness, etc)
-effects playlist (SPIFF file)
firmware.bin - compiled for ESP12, use SPI method.