Go Down

Topic: Questions regarding : WS2812B + ESP8266 + External PSU + Arduino Uno R3 (Read 395 times) previous topic - next topic

kavvson

Hello guys I'm new to the community, and Arduino - electricity stuff too. I am learning :) 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
Code: [Select]
#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
Code: [Select]
#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 ;)

PaulRB

Quote
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.

Paul__B

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?

kavvson

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.




PaulRB

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?

Quote
Think we missed the dimming aspect.
Not sure what you mean.

PaulRB

+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.

kavvson

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.

Paul__B

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.  :smiley-eek:   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.  :smiley-lol:  Any more up-to-date schematic would be welcome but the NodeMCU site is pretty disorganised.!


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.

kavvson

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


PaulRB

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.

Paul__B

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.  :smiley-cool:

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.

kavvson

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

PaulRB

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.

kavvson

Yes Paul things are starting to make sence and working though, I might run into a wall now  :smiley-eek-blue: , 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 :(

PaulRB

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.

https://www.aliexpress.com/item/32529101036.html

Go Up