A nodemcu powering a WS2812B 144 LED strip to create lighting effects under a model rocket powered by Home Assistant
- ESP8266 Development Board
- 1M RGB LED Strip - WS2812B
- Electrolytic Decoupling Capacitors - 1000uF/25V
- Resistor 330 Ohm 1/4 Watt
- 74AHCT125 - Quad Level-Shifter (3V to 5V) - 74AHCT125 - Wasn't used but is recommended
Create a secrets.h
file in the same directory as rocket_led.ino
and define the following secrets.
/************ WIFI and MQTT Information (CHANGE THESE FOR YOUR SETUP) *************/
#define STASSID "" // Wifi SSID
#define STAPSK "" // Wifi Password
const char *ssid = STASSID;
const char *password = STAPSK;
#define mqtt_server ""
#define mqtt_username ""
#define mqtt_password ""
const int mqtt_port = 1883;
/**************************** FOR OTA **************************************************/
#define SENSORNAME "led" //change this to whatever you want to call your device
#define OTApassword "password" //the password you will need to enter to upload remotely via the ArduinoIDE
int OTAport = 8266;
The LED effects and power is controlled by Home Assistant.
light:
- platform: mqtt
schema: json
name: model_rocket_led
state_topic: "rocket/led"
command_topic: "rocket/led/set"
rgb: true
effect: true
effect_list:
[
rocket_take_off,
rocket_flight,
bpm,
candy cane,
confetti,
cyclon rainbow,
dots,
fire,
glitter,
juggle,
lightning,
noise,
police all,
police one,
rainbow,
rainbow with glitter,
ripple,
sinelon,
solid,
twinkle,
]
optimistic: false
qos: 0
input_number:
rocket_animation_speed:
name: Rocket Animation Speed
initial: 150
min: 1
max: 150
step: 10
For changing the speed of the light effect.
- alias: "Rocket Animation Speed"
initial_state: True
hide_entity: False
trigger:
- platform: state
entity_id: input_number.rocket_animation_speed
action:
- service: mqtt.publish
data_template:
topic: "rocket/led/set"
payload: '{"transition":{{ trigger.to_state.state | int }}}'
Based on ESP-MQTT-JSON-Digital-LEDs