Questions regarding : WS2812B + ESP8266 + External PSU + Arduino Uno R3

Hello guys I'm new to the community, and Arduino - electricity stuff too. I am learning :slight_smile: I would like to create a led strip setup in my room, I've been searching the internet for a few days but locating everything and applying it to my vision is kinda hard. I tried to segment the post abit, all the questions/concerns would appear as 【?】 I will have 2 types of questions throughout this post, one is electronic wise, and the other will be Arduino code related ( but both actually the same topic )

β”β”β”β”β”β”β”β˜†β˜†β”β”β”β”β”β”β”
#1 Currently working setup
β”β”β”β”β”β”β”β˜†β˜†β”β”β”β”β”β”β”

β–  General objective
【?】To find a way to replace the SP105E and Controll LED strips with Arduino ( via ESP8266 )


ᐛFull size view

β”β”β”β”β”β”β”β˜†β˜†β”β”β”β”β”β”β”
Questions block
β”β”β”β”β”β”β”β˜†β˜†β”β”β”β”β”β”β”

Lets start off with some "generic" questions I came across during the "figuring out" part

【1】a) Is it possible to run the Arduino board from the power supply,
b) if so, I would plug in via VIN + GND or 5V + GND,
c) do i need any resistor or other stuff - in front of the board.
d) Also as you can see from the pictures, the wifi module is "connected" to the Arduino board with the 5V ( and the board via VIN ) - does this connection need any resistor or other stuff - while I am chained from point a).
e) I've seen some pictures/posts that I couldn't use the USB connection ( to make changes on the Arduino board, I don't need a USB wifi connection / it has much less update cycles and can be done separately ) while the Arduino board would be powered by the PSU - is this true ? Is there any way around this - or would I need to disconnect the PSU power and connect PC USB.
【2】Data wire - 4 separate wires - to control the strips independently ? or use one and daisy chain it from say pin 5 of the Arduino - do I need resistors near the board or at the wire input near the leds ( in both variants 1 wire/4 ). General idea is to be able to program 4 of them independently - but also some common pattern e.g. 2+2, 4 is that FastLed library dependent or connection wise.

Β» Practical observation - I used a multimeter and plugged it directly into the FastLed connections I made on the PSU 5V out, when turing on it "gradually" fades towards 5V and stays there - so there is no burst above 5V and reduction.

Β» The purpose of the WiFi module is to send a signal to the Arduino board and control the strips via the digital outputs - with a simple website, you build in the WiFi module which sends a serial signal to turn certain things on/off. Scroll down to see the question related to this.

Β» The temperature is controlled via ds18b20 and the value is displayed on a website view ( runs via ESP - no data is transmitted to the Arduino ) . I don't plan on going more fancy, maybe a few more temp gages and other small modules to control humidity etc, no big installs or w/e. Will it be sufficient while connected to the power supply.

【3】When it comes to dimming, is that a FastLed implementation, or do I need an physical potentiometer or the data line?

I'd better ask all this before I experiment and ruin something.

Below you can see the exact details of everything I'm using.

◇───── Gear used ─────◇

ᐛFull size - board link

● Arduino Uno Rev 3
● ESP8266 Wemos NodeMCU V3 ( Wifi Module )
● Dallas ds18b20 ( Temperature meter )

◇─────────────────◇

◇───── Led Specification ─────◇
Each strip has 5 meters, I will be using 4. Below is a picture of the led connection cords which would be the strip number 2,3,4.

【4】The strip number 1 is a question how to connect - ? my idea would be just data of arduino and the start from PSU directly - similar as from*#1 Currently working setup -* the replacement part box


ᐛFull size - view link

WS2812B Strips

● DC 5V
● 30led / m
● 45w / 5 m = 9w/1m
● 5 meters
◇─────────────────◇

◇───── Power Supply ─────◇

ᐛFull size - side view link
ᐛFull size - back view link

● DC 5V impulse stabilized
● Max 70A/350W

◇─────────────────◇

【5】 Wifi - Arduino communication - taking a look at the gear used , first picture of the board. I got the pin RX of the ESP and routed over to TX on arduino. Everything is fine signal flows - but till arduino picks it up the delay is ~1-2 seconds. Thats why I have that single diode to represent the signal arrival.

Also my current board setup has an issue this has something to do with the Question Block question number 1 d), I assume it might have to do something with the 5V ? or some kind of misconfiguration that I am not aware of - since the serials are at the same value - perhaps I need a resistor there.

ESP8266 Board Code - Partial

#define WIFI_BOARD_LED 2 // wifi board led
void setup(){
  Serial.begin(115200);

  pinMode(WIFI_BOARD_LED, OUTPUT);
  digitalWrite(WIFI_BOARD_LED, HIGH);
}

// Based on what I click on the website, it sends B or C over the serial
String setDiodeState(String type){
 if(Led_Is_ON == 1){
    Led_Is_ON = 0;
    digitalWrite(WIFI_BOARD_LED, HIGH);
    Serial.print('B');
    return String("set off");
  }else{
     Led_Is_ON = 1;
     Serial.print('C');
     digitalWrite(WIFI_BOARD_LED, LOW);
     return String("set active");
  }
}

Arduino Board Code - Partial

#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup(void)
{
 mySerial.begin(115200);
}
void loop(void)
{ 
  testSerials();
}
// Specify what to do when arduino board recieves A,B or C from WIFI serial board ( Over RX-TX )
void testSerials(){
     while (mySerial.available() > 0){ 
      delay(2);
     data = mySerial.readString();
     Serial.println(data);
      if(data == 'A'){
        Serial.println("Recieved Startup");
      }

     else if(data[0] == 'B'){
        Serial.println("Off Led");
        digitalWrite(3, LOW);
      }

      else if(data[0] == 'C'){
         Serial.println("On Led");
         digitalWrite(3, HIGH);
        }
   }
}

I hope I was kinda clear - but if u do have any questions feel free to ask, If I come up with some questions ill post them aswell. Thank you for your time and have a nice day :wink:

all the questions/concerns would appear as 【?】

It would help if you numbered your questions. Then no confusion about which answer is for which question.

Question: your text mentions a Nano 3 but picture shows Uno. Whichever it is, what is it for? Why can't the NODEMCU control the strip? A voltage level shifter may be required between the NODEMCU and the strip, but if connecting Nano/Uno to NODEMCU, you need voltage level shifters there anyway.

I am not sure it is desirable to have all the power wires running separately back to the supply. It would be easier to have a single (or perhaps two), suitably heavy twin cable (and much heavier than the wires illustrated) running from the power supply alongside the strips and tapping into each end connection. You certainly need to feed the power in as frequently to the strips as possible. You need to keep all the wires bundled together.

A 1 mF (1000 Β΅F) 10V capacitor across the power wires at the start of the first strip is recommended, as is a 470 Ohm resistor in series with the data line at that point.

I also noted the disparity between your description of a Nano an the picture of a UNO. But it will be far easier to ditch the Arduino and do it all with the ESP. You do have to include in the ESP code, an instruction to prevent interrupts just while you update the LED strip. And you need a level converter - two gates of a 74HCT14 in cascade, or a 74HC04 will generally do, with the unused gate inputs grounded - powered from the 5 V when using an ESP to drive the LED strip.

Of course you should run it from the same 5 V as the LED strip. There is a warning not to connect the power to the "5V" pin of a UNO (no problem at all with the Nano) when it is connected to a PC via USB. Forget the "Vin" pin or "barrel jack" on a UNO exists, it is pretty useless (applies to Nano also).

Did I miss something?

Questions numbered and to clarify it is an Uno Rev 3 - I am not sure if the LED strip power wiring is wrong - I will just get heavier wires at the start. ( It is not a 20 meter straight line , it will be a 4x5m square, so the wire will never have more than max 7 meter )

After a brief reading I am not quite sure about the level converter ( I am quite new to everything )

  • perhaps a 3.3V, 2.5A Step-Down Voltage Regulator D24V25F3 would work between the Arduino and the ESP or Logic level converter 3,3V / 5V - UART - Iduino ST1167 ( I came across recently )

I am also questioning myself do I need both of those boards. Which setup standalone would be easier ( less required components ) to implement?

● Arduino with simple button to change the led patterns
● ESP ( is the connection with 5V is possible, Vin can go 4,5-9.0V, microUSB 5V )

Think we missed the dimming aspect.

For level conversion from 5V down to 3.3V, you can simply use a pair of resistors as a voltage divider. When converting from 3.3V to 5V, you may not need to do anything, depending on the 5V input. It may interpret the 3.3V signal as HIGH, in which case no problem. But if not, you can use a 74hc14 or 74hct14 chip to boost the 3.3V signal up to 5V. This can apply to the connections between the NODEMCU and Uno, or between the NODEMCU and the strip, if you connect them directly.

A voltage regulator is not suitable, or needed, to step down a signal.

Obviously the Uno alone would be the easiest approach, but I assume you wanted to use the NODEMCU for its wifi capability?

Think we missed the dimming aspect.

Not sure what you mean.

+1 karma for numbering the questions.

1a: yes, assuming it is a 5V constant voltage supply, which I assume it is if sold with the ws2812 strip.
1b: 5V and ground, for the Uno. Vin and ground for the NODEMCU.
1c: if the psu is 5V then no.
1d: see 1b
1e: I have heard it is not safe to connect the Uno to usb and to a 5V psu at the same time. Not sure about the NODEMCU.

Ideally a wifi control, but I wouldn't mind a button somewhere either to change the modes, later could go for some IR control perhaps.

But also to clean this up, maybe I missed it the ESP module can work with Vin 4.5- 9.0 and it currently is fed by the arduino 5v ( the board can operate on 5v ). My initial concept was ( part of question 5 ) - The ESP board wouldn't send a signal to the leds ( it registers a click on the website and sends a TX ) to UNO RX where it would be processed and sent to the strips.

  1. Is that a bad way to go about that? - I will go with whatever will work without much changes.

By dimming I mean - lowering the brightness of the led's, I am sure I might go with a brightness potentiometer for the start - 2) I would assume that would work? Since it is a digital dimming not actual power dimmer. That is not so important for now, I would like to sort out the basics.

I would dispute that the NodeMCU may be powered with anything greater than 5 V - not that there is ever a reason to do so. :astonished: According to the circuit diagram below, What is called "Vin" or "VUSB" feeds the CH340 via a diode and the CH340 is most certainly not rated for more than a little over 5 V.

According to the only schematic I can find, pin 1 or "Vin" connects directly to the USB socket so like the UNO, you would not want to power this pin with 5 V whilst connected to a PC. However I do not entirely trust that schematic. If I have a chance I might go find my NodeMCU and check it out. :grinning: Any more up-to-date schematic would be welcome but the NodeMCU site is pretty disorganised.!

Expand!

Seriously, it makes no sense and makes both coding and interfacing more difficult, to use two processors. The NodeMCU has more memory and can drive more LEDs.

If you have a "square" array, you run the power cable to parallel the strips both horizontally and vertically along all sides of the array. You "zigzag" the data cables so that data flows form start to end of one row and then into the next row running in the opposite direction. This is in order to avoid any long distance in the data path.

I note one specific mistake in your original diagram. The 5 V supply does not go to the controller separately. It goes back along with the data and ground from the start of the strips to the controller. It is important to keep the wiring of both sides of every circuit together as a bundle so you have no open loops in the wiring.

Here is the full board name ESP8266 Wemos NodeMCU V3 HW-628 v1.1 if that may help.

I can also see 3 pairs of 3.3V pins in which one would I plug in the 5v ( with resistors to get close to 3.3V ), but then again what is the wiring with the first strip & the 3.3 board - I assume that's not good?

The original wiring - you mean the sp105e +, that's what the producer recommended in the wiring diagram

Q2: either wire the 4 strips to 4 pins or chain the 4 strips and connect to a single pin. You can control each led individually by either method. But if the NodeMCU is driving the strips directly, you have a limited number of pins, so I would suggest chaining the strips. A ~470R resistor should be used in the data line, close to the strip. If the connecting data wires between the chained strips are long, more resistors may be needed in those data lines also.

kavvson:
Here is the full board name ESP8266 Wemos NodeMCU V3 HW-628 v1.1 if that may help.

Fair enough.

The problem is that the diagram I gave is the only schematic I can locate of the actual circuit of any NodeMCU board. I would be particularly pleased if someone can supply a schematic of any later version. :sunglasses:

Do note in what I posted in #2, the need to use a level converter to reliably drive 5 V WS281x strips with a 3.3 V processor such as the ESP8266.

So I finally forced myself to test this out. I started with the uno setup since it is easier to manage - and after I create my scenes and such ill try to move this into the ESP. Below is the current wiring I use. I Plugged in the 5v + gnd pins in uno. The breadboard will eventually be replaced or not used at all - but I am not sure yet, might have some lcd there maybe idk.

I ran this setup on strand fastled test for 1 hour and everything is fine. The voltage is varying from 4.99 - 5.01 which I think is fine. I will test this setup also on 4 x 5 meters.

  1. I do question myself if the common grounding here is done right or I overdid it.
    a) Also does the next strips need be grounded with the uno ( in the common ground connector - or just as separate lines from the psu )?.
    b) is the 330 ohm resistor ok? I dont have others atm (i got multiple of those 47,100,220,330) - all are 1/4W THT

ᐛFull size view (paint connection)

ᐛFull size view (physical)

I will keep questions coming once I find any. Thanks

Q3: you could use a pot to control the dimming. It would not/cannot be connected directly to the strip. You would connect it to an analog input on the arduino. Your code would read the pot and adjust the brightness using a function of the FASTLED library.

Q4: think we covered that now?

Q5: think you got Tx & Rx mixed up in the question. I don't see the diode you mentioned, unless you meant the led? The Uno will be receiving the data immediately, it is the code running on the Uno that is not dealing with that data for 1~2 seconds, due to mySerial.readString() timing out. It is waiting for an end-of-line character, but the esp is not sending any. Try changing Serial.print('B') to Serial.println('B') in the esp code.

Yes Paul things are starting to make sence and working though, I might run into a wall now :fearful: , I breaked out my micro-usb port from the esp ( and I cant resolder it back in, its too small ) - is there a way to send data to it over the usb-pins ( after the wire disassemble ) ? Or do I have to get a new board / something else :frowning:

Maybe, yes, using a usb-serial adaptor board, but it will be a PITA to use even if you can make it work. I would replace the NODEMCU with a wemos mini, but it must be a genuine one from Ali express. There are many poor quality clones, including on Ali express. You must buy from the Lolin / Wemos shop. I have never had any problems with the genuine ones. But I have a few clones, and the micro-usb connector broke on at least 2 of those.

Ok dispite that I still continue testing 5 x 5 meters - so kinda full setup, but it will be lower than that.

I have set #define LED_COUNT 620 in the strand test so thats 20,66 meters, when I want to set a higher value they do not even light up.

I placed a 330 ohm resistor at the far end of the strip and routed back to the breadboard. Any ideas why it doesn't work? ( stops at 5th strip - the far right one, after ~ 30 leds )

Also I used the USB port while PSU active - unplug 5v pin of arduino >:(. Wonder if I could automate that to detect what power comes in some time ... but lets focus on basics.

ᐛ Full size view

Problem now is the Uno, I suspect. 3 bytes of ram memory required for each pixel, so 620 pixels need 1860 bytes and Uno only has 2048 and reserves some of those bytes for other things like the variables in your code, serial buffers and so on.

In the words of Roy Schieder/Police Chief Brody: "We're gonna need a bigger boat"

Ah that might be right, I am getting a Adafruit HUZZAH ESP8266 & a usb serial device soon hope it will be fine. Will keep you updated :stuck_out_tongue:

Hey I got my parts - to start off - the old ESP board is working over uart usb, was simple rx-tx + correct power and button press while it was connecting - nothing fancy. The huzzah board also - no issues with uploading stuff.

I implemented OTR uploads for both of them - during dev.

But coming back to the issue I faced. link of the back plate ( voltates etc ). I use 3.3v with the current setup. I uploaded the same sketch as I had on my other ESP, changed the pin to #5 = 5 and it didnt show anything.

Below is the schema I run.

ᐛFull size - view link



ᐛFull size - view link

  1. I dont really know what can be wrong here the voltage measurments are all right I am not sure why the data doesn't do anything - and dont know how to kinda debug that. The board is working ( I did also a board blink sketch )

  2. While on the other ESP everything is fine - sometimes I can see an odd blink ( lets say I have a chase, at some point all strips goes green for a second ), also the first led in the chain seems to be not working properly - is off color - it has a 330 ohm resistor on the way in though. Any tips on that ? - am I losing some data on that 25m? I did not do the Z or multiple data inputs its just one line for now - I am sure its directional and cant plug in the data just as I would do the power plugs

Cheers

You appear to have a WeMOS D1 Mini board sitting over some header pins but not connected to them.

Do you propose to connect it up?