Giter Club home page Giter Club logo

nodemcu-mqtt-rgb-led's Introduction

NodeMCU v3 MQTT RGB LEDs Using JSON for Home Assistant

This project is primarliy a fork of corbanmailloux's repository esp-mqtt-rgb-led with a means of controlling LED Strips or neopixels.

After making my own RGB led lamp with a WS2812B Ring, a NodeMCU V3, some hot glue and half a bird feeder I wanted to intergrate it with home assistant.

alt text

I first tried with using a REST approch with HTTP requests but there wasn't an intergration in home assistant, so I was linked to corbanmailloux's repository.

Installation/Configuration

To set this system up, you need to configure the MQTT JSON light component in Home Assistant and set up a light to control. This guide assumes that you already have Home Assistant set up and running. If not, see the installation guides here. As well as these you also have to install the appropriate libraries in your arduino IDE

In Home Assistant

  1. In your configuration.yaml, add the following:

    light:
      - platform: mqtt_json
        name: mqtt_json_light_1
        state_topic: "home/rgb1"
        command_topic: "home/rgb1/set"
        brightness: true
        rgb: true
        optimistic: false
        qos: 0
  2. Set the name, state_topic, and command_topic to values that make sense for you. Make sure these are unique to every light unless you would like the lights on the same group.

  3. Restart Home Assistant. Depending on how you installed it, the process differs. For a Raspberry Pi All-in-One install, use sudo systemctl restart home-assistant.service (or just restart the Pi).

The Light Side

For this I used a NodeMCU v3 which used a ESP8266-01 microcontroller. The NodeMCU is bigger than a raw ESP8266 but it has a voltage regulator and is breadboard friendly. You'll need an ESP set up to work with the Arduino IDE. This needs to be added to your boards manager, you can read here for instructions on how to do this.

  1. Using the Library Manager in the Arduino IDE, install ArduinoJSON, PubSubClient and FastLED. After downloading all the zipped libraries you can install them with "Sketch" -> "Include libraries" -> "Add from ZIP"
  2. Open the mqtt_nodemcuv3_rgb.ino file in the arduino IDE
  3. Configure FastLED using the Data pin, color order, chipset and led number variables.
  4. Configure the MQTT broker using MQTT server, MQTT username, MQTT port (optional) and MQTT password.
  5. Configure your wifi connection with your SSID and Password.
  6. Set the client_id variable to a unique value for your network.
  7. Set light_state_topic and light_command_topic to match the values you put in your configuration.yaml.
  8. Upload to your nodemcu board after selecting "NodeMCU 1.0".

Future Changes

As described in this adafruit tutorial they say that their LED manufacturer recommends using 70% of the 5v required. The best way to do this with a NodeMCU would be to use a logic level shifter for 3.3v to 5v

Wiring

With v3 of the nodemcu the RSV pin has been changed to be 5v, we can use this to power the WS2812B directly. Watch out because I don't believe that pin has voltage regulation to prevent a surge.

RGB No Barrel Wiring

We can also wire it with a barrel jack and power both the node and the light strip with common positive and negative's BOTH MUST BE 5V COMPATIBLE

RGB With Barrel Wiring

nodemcu-mqtt-rgb-led's People

Contributors

chrom3 avatar corbanmailloux avatar fabaff avatar jamesmcclelland avatar lackhove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.