This is an ever ongoing project to control ws2812, ws2811, ws2813 led light strips having some pre programmed effects and animations while providing a simple interface both via mqtt and http.
Devices work with and without connection to a wireless network, when not connected to a wireless network commands can be issued to the device by connecting to it via it's own ssid (Aurora_{chip_id})
Once the device is configured its configuration is stored in eeeprom memory and can be changed via the /setup endpoint
in src/strip/strip.h you can set the define for WEMOS_D1 and the configuration for neopixelbus library.
on WEMOS_D1 I use pin D4 (GPIO2) for connecting the data pin of ws2812 strips whereas in nodeMCU devices I use pin RX (GPIO3)
Firmware must be upload with platformio upload
LittleFS data contains the web interface, and the filesystem is used to store the settings
use platformio command pio run -t uploadfs to upload contents of data directory to flash memory
In order to configure a device send a post to ::ip::/setup with the following body:
pass: the network password (max 32 chars)
ssid: the network ssid (max 32 chars)
topic: the mqtt topic to listen for commands (max 32 chars)
broker: the address of the mqtt broker (max 32 chars)
announce_topic: the topic where to anounce device changes (birth, will, state change) (max 32 chars)
human_name: the human readable name of the device (max 32 chars)
ap_ssid: the ssid of the access point mode (max 32 chars)
strip_size: the length of the led strip to control
use_mqtt: enables the usage of mqtt
These endpoints are reachable via http requests:
/setupvia HTTP POST and expecting a body with configuration values./cmdvia HTTP POST request, expecting a body containingcmdandpayloadwith the desired command and parameters/clearvia HTTP POST endpoint for clearing eeprom config/infovia any HTTP request responds with a json containing the current config (minus network password) plus the device_name/statevia any HTTP request responds with a json containing the current device state"/"via any HTTP request presents the control interface
fx $1plays an effect where $1 is one of [1,2,3,4,5,6,7,8,9] representing an effectbr $1sets the brightness level from 0 to 255 (brightest) USE WITH CARE INCREASES STRIP POWER REQUIREMENTSspd $1sets the animation speed from 0 to 255 (fastest)offturns the light strip offpausepauses current effectplaycontinues playing of selected effectsetHSL $1fill the strip with HSL color based on $1 corresponding to hue sat and lightness eg.360 100 30this will fill the strip with red at 30% lightnesssetRGB $1fill the strip with RGB color, eg. red would be:255 0 0testtests the strip connection by turning a led at a time
In order to send these commands via MQTT they must be wrapped in a json format:
{"cmd":"set","payload":"xyz"}
Upon receiving a command the device respond with an state update
State is a representation of the current state of the device, if it's playing an animation, which one, its current brightness and speed settings.
The state is published in the device's mosquitto announce_topic and it looks like this json:
{
"id": "the device id",
"ev": "stateChange",
"br": 25,
"spd": 10,
"fx": 255,
"mode": 0,
"size": 100
}
where:
bris the current max brightness (integer 0 - 255)spdis the current animation speed (integer 0 -255)fxis the currently selected animationmodedetermines if we're playing or paused or off (0: OFF, 1: PAUSED, 2: PLAYING)sizeis the currently configured length of our strip
- rc-aurora - Control Aurora devices from an RC control
- aurora-alexa - Control Aurora devices from Alexa
- aurora-mqtt-server - Simple mqtt broker/pub/sub over nodeJS