Melvanimate is a library for ESP8266 that lets you control your Neopixels over WLAN easily. It supports everything imaginable besides toasting your toast, e.g.,:
- Animate Neopixels (hence the name!) or set them to solid colors
- Control LEDs via a web interface (for casually setting a certain color of effect)
- Control LEDs via MQTT or DMX/E131 (for automation)
- Adalight DIY ambient monitor lighting similar to Ambilight
- PixelController
- Timer to switch lights on/off or select a preset after a certain time
- Super awesome easy configuration web interface and over-the-air updateability
(Insert cool photos/videos here!)
- 1 ESP8266 board, e.g., a NodeMCU 1.0 board (around USD 3 from China shipped) or, if it should fit a small enclosure, a bare ESP12E module (around USD 2 from China shipped; in this case need a matching programming jig too in order to flash it initially, and you need to use the usual minimal circuit to pull up CH_PD and pull down GPIO15 as well as a voltage regulator)
- WS2812 strip or matrix
The NodeMCU 1.0 board has an integrated power regulator so I can hook up the light strip and the ESP directly to 5V and it works with 0 external components. The data line of the neopixels strip is connected to the RX of the NodeMCU 1.0 board.
These are very concise instructions on how to build and run using Ubuntu 16.04 (other versions should also work).
First, install known working versions of the dependency libraries.
which git || sudo apt-get install -y git
# rm -rf $HOME/Arduino/ # Uncomment this only if you are sure what you are doing
mkdir -p $HOME/Arduino/libraries/
cd $HOME/Arduino/libraries/
git clone -o dc40877 https://github.com/adafruit/Adafruit-GFX-Library.git
git clone -o 6cfe2a5 https://github.com/bblanchon/ArduinoJson.git
git clone -o b4e453c https://github.com/sticilface/ESPmanager.git
git clone -o f1b4576 https://github.com/marvinroger/async-mqtt-client.git
git clone -o 2cc9846 https://github.com/me-no-dev/ESPAsyncTCP.git
git clone -o 5159d8b https://github.com/me-no-dev/ESPAsyncWebServer.git
git clone -o 94f5ad3 https://github.com/Makuna/NeoPixelBus.git
git clone -o 58138fe https://github.com/sticilface/Melvanimate.git
cd -
By the way, this list was made with
DIRS=$(find ~/Arduino/libraries -mindepth 1 -maxdepth 1 -type d )
echo "cd ~/Arduino/libraries"
for DIR in $DIRS ; do
cd $DIR
unset URL
unset REV
URL=$(git config --get remote.origin.url 2>/dev/null)
REV=$(git log --pretty=format:'%h' -n 1 2>/dev/null)
if [ ! -z $REV ] ; then echo git clone -o $REV $URL ; fi
cd - >/dev/null
done
echo "cd -"
Download and run Arduino AppImage that contains the IDE, the esp8266 core, and the SPIFFS upload tool.
If you are not running Linux or do not want to use the AppImage, you have to download and install those parts manually.
AI="Arduino-1.6.11.esp2.3.0-x86_64.AppImage"
wget -c "https://bintray.com/probono/AppImages/download_file?file_path=$AI" -O "$AI"
chmod a+x "$AI"
./"$AI" &
Now that we have everything in place, configure, compile, and upload.
- File -> Examples -> Melvaimate-withESPManager
- Tools -> Board -> Your board type
- Tools -> CPU Frequency -> 160 MHz
- Tools -> Upload Speed -> 921600
- Tools -> Port -> Your port (can also use OTA)
- Sketch -> Upload
- Tools -> ESP8266 Sketch Data Upload (otherwise we see only white HTML pages)
Melvanimate has a super cool web interface that can do real magic, including over-the-air updates.
- You should see a new WLAN access point. Connect to it
- Open the IP of this access point (you need to find it out somehow)
- In the GUI, connect to your WLAN using your credentials. Save and reboot
- From thereon, you should be able to use the GUI from within your network
If you have multiple installations of Melvanimate in the same network, they will automatically discover each other and talk to each other. From the web interface, you can select the different devices in the upper right-hand corner.
Let's say I want my LEDs to come up as blue, whenever I attach them to a power plug, whether there is WLAN or not. To do this, we create a preset in the GUI called "Default" and change the following section like so:
SPIFFS.begin();
lights.Load("Default"); // Add this line
manager.begin();
// Add effects to the manager.
lights.Add("Off", new SwitchEffect( offFn)); // Remove "true" here
lights.Add("SimpleColor", new SimpleEffect(SimpleColorFn), true); // Add "true" here
Done! Now, whenever I power on, the lights go blue.
Who is going to implement them?
- A GUI setting so that a given preset is automatically loaded when the device is powered on
- Scenarios, e.g., set LED strip on ESP #1 to blue and LED strip on ESP #2 to orange
- A setting to limit the milliamps
- Kelvin based on daytime and location (see code below)
- Bus is coming
- Weather info
- Hue mode (e.g., using code from ESP8266HueEmulator)
- Use dithering so that you can't see the individual steps e.g., in RainbowChase
- Investigate MIDI or OSC for professional stage lighting control (e.g., using https://github.com/OSSIA/i-score which can do things like https://vimeo.com/113089469, or http://www.duration.cc/)