Led Programming Issues

Hi
We have worked with an led project for over 5 months now and still cant get addressable WS2811 LEDs working properly with Wemos D1 mini pro. We have tried 2 different Wemoses and burnt around 1m of LEDs by now.
We are trying to control WS2811 LED`s via Wifi. Currently we have 12V Power Supply (300W) driving 7m of leds. There is Step-Down connected to chip and data is connected to led with DuPont wire that has 440 ohm resistor on it. There is 1k capacitor between leds and power supply.

Right now leds work perfectly with arduino uno, but trying the same sketch with wemos causes led burnout or flickering in leds. We`ve tried to amplify the data signal, but still no results. We are desperately lost.

Link for video when uno runs: video-1525805969.mp4 - Google Drive
It`s an FastLED program that we found from the internet.

Could someone provide us a solution please?
Thank you.

PS! We are beginners and might have done some errors in the script. If you can, we would be very pleased if you could make us a basic webserver program that changes led color when link is pressed.

Please do us all a favour and post the code and a schematic of the circuit here.

Sorry for late response. I tried my best to draw the circuit.
We got intrested in this project watching bitluni`s video:

Sketch can be found here:

Scheme:

We did not choose the same Leds for the project, that might be issue, we went with older generation WS2811 instead of WS2812B. We got the connection with web server and were able to run the program and saw some changes in leds, but they werent acting normally, they were brighter than usual and alot of flickering between changes and not much of a color, more like white.
In UNO we used FastLED library and examples worked perfectly like seen in the video.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
OPs circuit;

What is the 1K?
How do you burn 1m of LEDs?

Can you post a picture of your project please?

Check that the gnd input of the DC-DC converter is connected to gnd of its output.
The gnd of the LEDs must be connected to the gnd of the controller to give gnd reference to the control signal.

Do you use the DC-DC converter with the UNO?

Thanks… Tom… :slight_smile:

Hello, thanks for the reply, here is our code:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#include <Adafruit_NeoPixel.h>

#include "PinStates.h"
#include "LedStates.h"
#include "Fader.h"
#include "RainbowFunction.h"
#include "SimpleRGBFunction.h"
#include "WaveFunction.h"
#include "RF.h"

const char* ssid = "........";
const char* password = "asdfghjkl";

ESP8266WebServer server(80);

const int LED_PIN = D4;
const int LED_COUNT = 125;

const int RF_OSC = 200;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_RGB + NEO_KHZ400);

LedStates currentLedStates(strip);
LedStates targetLedStates(strip);
Fader<LedStates> ledFader(currentLedStates, targetLedStates);
PinStates currentPinStates;
PinStates targetPinStates;
Fader<PinStates> pinFader(currentPinStates, targetPinStates);

void handleRoot() {
  String message = "<html><head></head><body style='font-family: sans-serif; font-size: 12px'>Following functions are available:

";
  message += "<a href='/rainbow?fade=3000'>/rainbow</a> a rainbow animation on LEDs
";
  message += "<a href='/wave?r=255&g=32&b=10&fade=5000'>/wave</a> a slow wave animation on LED on base color specified by arguments: r=<0..255> g=<0..255> b=<0..255>
";
  message += "<a href='/setleds?r=32&g=64&b=32&fade=1000'>/setleds</a> sets LEDs to the color from arguments: r=<0..255> g=<0..255> b=<0..255>
";
  message += "<a href='/ledsoff?fade=500'>/ledsoff</a> turns off LEDs
";
  message += "<a href='/setpins?D1=128&D2=256&D3=512'>/setpins</a> sets to any of the in arguments specified pins (D0..D8) to their PWM values (0..1023). To use them digital: 0=off, 1023=on
";
  message += "<a href='/togglepins'>/togglepins</a> inverts all pin values form pins used before.
";
  message += "<a href='/rf?D=6&t=200&id=28013&channel=0&on=1'>/rf</a> sends a rf code from arguments: D=<0..8> t=<0..1000> id=<0..1048575> channel=<0..2> on=<0..1>. Dx is the pin, t is the optional signal clock(default is 200, works for me)

";
  message += "All functions except togglepins and rf support the argument 'fade' which specifies the milliseconds it takes to fade to the new specified state. ...nice blending ;-)
";
  message += "
Syntax is as follows: http://&ltip>/&ltcommand>?&ltargument1>=&ltvalue1>&&ltargument2>=&ltvalue2>&...
";
  message += "You can click on each link to see an example.

";
  message += "have fun -<a href='http://youtube.com/bitlunislab'>bitluni</a></body></html>";
  server.send(200, "text/html", message);
}

void handleNotFound(){
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

int getArgValue(String name)
{
  for (uint8_t i = 0; i < server.args(); i++)
    if(server.argName(i) == name)
      return server.arg(i).toInt();
  return -1;
}

bool checkFadeAndSetLedFunction(LedFunction *f)
{
  int fade = getArgValue("fade");
  if(fade > -1)
  {
    targetLedStates.setFunction(f);
    ledFader.start(fade);
  }
  else
    currentLedStates.setFunction(f);  
}

void handleRf()
{
	const int pinNumbers[] = {D0, D1, D2, D3, D4, D5, D6, D7, D8};
	int pin = getArgValue("D");
	int t = getArgValue("t");
	if(t == -1) t = RF_OSC;
	int id = getArgValue("id");
	int ch = getArgValue("channel");
	int on = getArgValue("on");
	String out = "rf D";
	out += pin;
	out += " ";
	out += t;
	out += " ";
	out += id;
	out += " ";
	out += ch;
	out += " ";
	out += on;
	pinMode(pinNumbers[pin], OUTPUT);
	for(int i = 0; i < 5; i++)
		rfWriteCode(pinNumbers[pin], t, id, (1 << (ch + 1)) | (on > 0? 1: 0));
	server.send(200, "text/plain", out);	
}

void setup(void){
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  //find it as http://lights.local
  /*if (MDNS.begin("lights")) 
  {
    Serial.println("MDNS responder started");
  }*/
  
  server.on("/", handleRoot);

  server.on("/rainbow", [](){
    server.send(200, "text/plain", "rainbow");
    checkFadeAndSetLedFunction(new RainbowFunction());
  });

  server.on("/wave", [](){
    server.send(200, "text/plain", "wave");
    WaveFunction *f = new WaveFunction();
    f->init(server);
    checkFadeAndSetLedFunction(f);
  });

  server.on("/setleds", [](){
    server.send(200, "text/plain", "setleds");
    SimpleRGBFunction *f = new SimpleRGBFunction();
    f->init(server);
    checkFadeAndSetLedFunction(f);
  });

  server.on("/ledsoff", [](){
    server.send(200, "text/plain", "ledsoff");
    checkFadeAndSetLedFunction(new SimpleRGBFunction());
  });

  server.on("/togglepins", [](){
    server.send(200, "text/plain", "togglepins");
    currentPinStates.toggle();
    currentPinStates.commit();
  });
  
  server.on("/setpins", [](){
    server.send(200, "text/plain", "setpins");
    int fade = getArgValue("fade");
    if(fade > -1)
    {
      targetPinStates.loadValues(server);
      pinFader.start(fade);
    }
    else
    {
      currentPinStates.loadValues(server);
      currentPinStates.commit();
    }
  });

  server.on("/pinsoff", [](){
    server.send(200, "text/plain", "pinsoff");
    currentPinStates.setAllTo(0);
    currentPinStates.commit();
  });

  server.on("/rf", handleRf);
  
  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started");
  
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop(void)
{
  server.handleClient();
  //MDNS.update();
  currentLedStates.render();
  if(ledFader.active)
    targetLedStates.render();
  if(!ledFader.fade())
    currentLedStates.commit();
  pinFader.fade();
}

Well we eventually burnt around 1m of leds in course of 5 months, trying to fix the circuit and program. First and last led controllers stopped working.
There is an video, showing the project in the first post. We wanted to do cealing lightning with leds, that are stuck between the wooden piece. Theres not much to show of the controlling box. There is just an AC wire going into Power supply and the rest is shown in the sketch.

1k = 1000uf 16v Electrolytic Capacitor

GND input in DC-DC is connected to GND output.
GND of the Leds werent connected to controller ground because we didnt think it was necessary, and thought that its automatically grounded, because its one circuit.

Yes, we use the converter with UNO aswell and it works perfectly fine.

We tried FastLED example program with UNO and Wemos. Uno worked perfectly, but Wemos didnt give a sign. It seemed working, but leds didnt show anything. We tried diffrent pins for wemos aswell, but maybe data is too weak?

Picture file was too big for the site:

Thanks

Hi,
OPs circuit, thank you;
IMG_20180510_134140cc.jpg

Tom… :slight_smile:

Hi
Haven't seen any smoke yet, but LED's just stopped working. We think that it's the chip, that controls LED lights, what is burnt. Those LED chips stopped working when we used Wemos D1 mini pro chip to control LED. Haven't burnt any LED's using UNO.

Did you try a 3.3v -> 5.0V Level Shifter in the data line to the LED controller? The 74AHCT125 works well.

Haven't tried it.
We have tried Wemos D1 mini pro, Arduino UNO keystudio, and MEGA+WiFi-R3-AT2560-ESP8266-CH340G

Does your LED strip really expect +12V input?
That’s pretty unusual.

Those are the LED’s that we are working on.

lastchancename:
Does your LED strip really expect +12V input?
That’s pretty unusual.

The driver chip can be set up for 12V supply operation:

OP, you should level shift the ES8266's data output up to 5V logic as I previously suggested.

OP's Picture:

Loogika muundur 5V-3.3V mõlemasuunaline 4-kanaliga - Oomipood Would this work?

Don't know, never used it. You don't need bidirectional. I KNOW the one I suggested works because I've used it.

Thank you, you've been really helpful. I'm probably going to buy that piece, because otherwise I would need to wait around month to get one. Bidirectional level shifter should work. Does anyone know for sure?

We just noticed, that when data is transfered, pin voltage sticks around 0.04V, which might be the issue. When we tried powering simple 2 wire led sticking positive to data and negative to ground, and putting pin to high, then everything seemed fine.
We used this code to do so:

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>

const char* ssid = "name of your wifi network";             //!!!!!!!!!!!!!!!!!!!!! modify this
const char* password = "passwoord of your wifi network";                //!!!!!!!!!!!!!!!!!!!!!modify this
 
int ledPin = D4;          //connect led pin to d4 and ground
WiFiServer server(80);
 
void setup() {
  Serial.begin(115200);
  delay(10);
 
 
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");
 
  // Print the IP address
  Serial.print("Use this URL : ");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println("/");
}

 
void loop() {

   
   
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the request
  String request = client.readStringUntil('\r');
  Serial.println(request);
  client.flush();
 
  // Match the request
 
  int value = LOW;
  if (request.indexOf("/LED=ON") != -1) {
    digitalWrite(ledPin, HIGH);
    value = HIGH;
  } 
  if (request.indexOf("/LED=OFF") != -1){
    digitalWrite(ledPin, LOW);
    value = LOW;
  }
 
 
 
  // Return the response
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println(""); //  do not forget this one
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
 
  client.print("Led pin is now: ");
 
  if(value == HIGH) {
    client.print("On");  
  } else {
    client.print("Off");
  }
  client.println("

");
  client.println("Click <a href=\"/LED=ON\">here</a> turn the LED on pin 4 ON
");
  client.println("Click <a href=\"/LED=OFF\">here</a> turn the LED on pin 4 OFF
");
  client.println("</html>");
 
  delay(1);
  Serial.println("Client disconnected");
  Serial.println("");
 
}