RGB LED strip control using Arduino and MQTT

great suggestion, looking into this for this and some other applications. Looked at them a while back but didn’t realize the full potential. Thanks

Ok, so that means that you dont have to use a Velleman in between?

You’d still need a velleman or another driver in line, this just removed the arduino with Ethernet or wifi…so you could save $15-$20 perhaps

Ok!
I’m looking into building on mysensors so I would “just” hook the Velleman up to an arduino nano with an rf-chip.

That should work fine as long as libraries and pins are the same or make adjustments, haven’t worked with the nano but believe it is the same

Good Day

Is it possible to run same coding as above on arduino instead on ESP8266 to get more io’s?
My coding works great with Ethernet (Arduino Ethernet), but want to use arduino mini with ESP-05 as a “modem” to wifi, but cant find any coding to do so.

Any help will be appreciated.

Thank You

Albertus Geyser

Id be interested to see what you come up with, please share here if you do implement successfully. I do not have an ESP-05 to play with yet.

Digging up an old thread, but I have just assembled a Velleman RGB shield, have an ethernet shield but cannot get anything to work

All I want is simple control of my rgb strip by OpenHAB but it is proving to be an impossible job for me :frowning:

Are you attempting control via MQTT? There may be an issue with MQTT depending on the openhab version you are using, have you tested for messages?

I am, I cannot even get it to compile. I have made a new topic to discuss it with more details.

Look for H801 rgb Wifi controller based on esp8266. Very cheap and easily hackable! I can share my arduino ide code!

Will google that now. If you could share it anyway that would be great, I’m sure it would be of some use.

Please feel free to share the new thread link here in case any others are having issues.

I have not used the code for a while so it could be something to do with a library dependency or updated version, but I will take a look when I get home.

This year I have installed digitally addressable WS2811 chip based strips and have been having fun with increased possibilities, however I had planned to reuse some of this code for MQTT control.

I have found the WS2811 easier to work with since there is no PWM to contend with, only data, ground and power…and more fun so far too!

RGB Strip Arduino MQTT control is my thread.

Spent most of the evening messing around with it and googling but got nowhere. I do have a few reels of ws2812b but that is a project for another day and I want to use what I have now for the analog strips.

I’m having the same issues. Did you manage to get it working?

I had the same Issue.
You have to put the void callback above “PubSubClient client(server, 1883, callback, ethClient);” Then it should work.

Did you ever think of using the ARILUX controller for Openhab?
Didnt find documentation about it yet, but its basically a modded ESP8266 board.
costs about 5$ and I have 5 of them.
Would be cool to use them in Openhab.

Please check sonoff-tasmota, it’s supporting lot of things beside sonoff devices, details in


I was using this firmware together with MagicHome and on bare esp12 modules. Works great!

Please be warned seems to be missing configuration files to work.

I have gotten this to flash to an Arduino Nano using an ENC28J60.

Arduino Code Modified

#include <UIPEthernet.h>
#include <utility/logging.h>
#include <PubSubClient.h>

// Set the MAC address
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x5E, 0x69 };

// Set fallback IP address if DHCP fails
IPAddress ip(192,168,3,20);

// Set the broker server IP
byte server[] = { 192,168,3,3 };

EthernetClient ethClient;

// Callback function header
void callback(char* topic, byte* payload, unsigned int length);

PubSubClient client(server, 1883, callback, ethClient);

int SoffitR;
int SoffitG;
int SoffitB;
int BLUE = 5;                   
int GREEN = 7; 
int RED = 3; 

void setup()
{
    // Open serial communications
  Serial.begin(9600);
  
    // Start with a hard-coded address:
    Serial.println("Assigning Static IP address:");
    Ethernet.begin(mac, ip);
  
     Serial.print("My address:");
  Serial.println(Ethernet.localIP());
  
  // Connect to Broker, give it arduino as the name
  if (client.connect("arduino_LED2")) {
    
    // Publish a message to the status topic
    client.publish("status/arduino_LED2","Arduino LED2 is now online");
    
    // Listen for messages on the control topic
    client.subscribe("control/arduino_LED2/#");
  }
}


void loop()
{
  client.loop();
}

void callback(char* topic, byte* payload, unsigned int length) {
  // check for messages on subscribed topics
  payload[length] = '\0';
  Serial.print("Topic: ");
  Serial.println(String(topic));
  


  // check topic to identify type of content
if(String(topic) == "control/arduino_LED/livingroom/color") {
    // convert payload to String
    String value = String((char*)payload);
    //value.trim();
    Serial.print (value);
    //Serial.flush();
    // split string at every "," and store in proper variable
    // convert final result to integer
    SoffitR = value.substring(0,value.indexOf(',')).toInt();
    SoffitG = value.substring(value.indexOf(',')+1,value.lastIndexOf(',')).toInt();
    SoffitB = value.substring(value.lastIndexOf(',')+1).toInt();

    // print obtained values for debugging
    Serial.print("RED: ");
    Serial.println(SoffitR);
    //client.publish("status/arduino_LED2", SoffitR);

    Serial.print("GREEN: ");
    Serial.println(SoffitG);
    //client.publish("status/arduino_LED2", SoffitG);
    
    Serial.print("BLUE: ");
    Serial.println(SoffitB);
    //client.publish("status/arduino_LED2/soffit/color/blue", int SoffitB);
    //Serial.flush();
   
  analogWrite(GREEN, SoffitG);
  analogWrite(RED, SoffitR);
  analogWrite(BLUE, SoffitB);
  
   while(Serial.available())
  Serial.read();
    
  }
}

.Items Code

/* LED STRIPS */
Color LivSoffitLight "Living Room Soffit Color" (Lights_LivingRoom)
String LivSoffitLightColor (Lights_LivingRoom) {mqtt=">[mosquitto:control/arduino_LED/livingroom/color:command:*:default]"}
Number LivSoffitAnimation "Living Room Soffit Animation" (Lights_LivingRoom) {mqtt=">[mosquitto:control/arduino_LED/livingroom/animation:command:*:default]"}

Sitemap Code:

sitemap demo label="MC Smart Home Automation" {
    Frame label="Date" {
        Text item=Date
    }

Frame label="Accent-Lighting" {


Colorpicker item=LivSoffitLight


}

}

I have not gotten this to acutally light the LED’s on the Arduino I think this is missing rules. I will post rules if I figure them out. If anyone has knowledge about the rules I need I could use them.

Otherwise this will connect to mosquitto MQTT broker.

Hello All ,

I do have a problem with the last Arduino cod from this topic.
i am using binding-mqtt - 2.4.0
The cod is running but is not receiving the value from server , check the next picture , i try to check step by step but something is not right and i ca’t figure this out .

in the serial monitor from Arduino , you can see that is not stuck after providing the IP
sry for my English

image