nygma2004 / RFID_Wiegand_MQTT

RFID Wiegand MQTT Access
GNU General Public License v3.0
27 stars 8 forks source link

Help with wiring the LED strip #3

Closed thehijacker closed 3 years ago

thehijacker commented 3 years ago

Hello,

Another question if I may.

Got the WS2812B LED strip. Bought 1 meter to wrap nicely around the RFID reader. Wondering how to connect this to Wemos D1 Mini.

It has 5 pins on each side. Three are joined together with special connected at end and two are separated.

https://imgaz1.staticbg.com/thumb/large/oaupload/banggood/images/DB/80/f6041a6e-f52a-485a-b8c2-73abf63ba60d.jpg.webp

https://www.banggood.com/1M-3M-5M-Built-in-IC-WS2812B-5050-RGB-LED-Strip-Light-Waterproof-Individually-Addressable-Programmable-Lamp-DC5V-p-1741353.html

You says to connect 5V + GND and DataIn. Those are three pins but I have five, on each side :).

So which one to use and must I use them on both side?

Thank you and best regards, Andrej

nygma2004 commented 3 years ago

I believe in these strips the two white and two red cables are duplicates. So white is GND, red is 5V and green is Data In which goes to the ESP Pin. And check the label on the strip which side is the Data In as it matters. These are individually addressable LEDs and I am only addressing the first LED. So even you got an entire strip, only the first LED will work. But you can fix it, first of all in globals.h there is this line: #define NUM_LEDS 1 Change this to how many LEDs you have on the strip. And you also have this function:

void SetLEDColor(String color) {

  if (color=="black") {
    leds[0] = CRGB::Black;
  }
  if (color=="yellow") {
    leds[0] = CRGB::Yellow;
  }
  if (color=="red") {
    leds[0] = CRGB::Red;
  }
  if (color=="green") {
    leds[0] = CRGB::Green;
  }
  if (color=="blue") {
    leds[0] = CRGB::Blue;
  }
  FastLED.show();
}

Here instead of led[0]... you need as many lines as many LED you have. If it is 10 you can just copy and paste the lines and use led[0]... led[1]... led[2].... Or if more, build a for loop

for (int i=0; i<NUM_LEDS; i++) {
  led[i] = CRGB::<and the color>
}

And of course do this for each section.

thehijacker commented 3 years ago

Thank you for great tips. One more question. Do you power the strip with Wemos or individual 5V power supply? I have separate 5V DC power supply planned and I can use it to power the strip. Only data in wire would go to Wemos then.

You think this would work?

thehijacker commented 3 years ago

Tried it both. GND + 5V to separate 5V DC power supply and DataIn PIN only to D5 on Wemos. No LED gets lit.

Tried to connect GND + 5V to Wemos and DataIn pin to D5. Still the same. No LED gets lit.

I kept it for a while doing other things and when I looked at the strip single green LED was lit. No idea how.

Did you perhaps have simillar issues?

nygma2004 commented 3 years ago

I am not sure. If you are using a separate power supply, GND of the ESP and the power supply needs to be connected otherwise it will not work. But otherwise it should be working. I am not sure why you have issues. I Googled it again and there are plenty of examples where the strip is connected directly on the ESP pin, on other there is a 470ohm resistor in series. Maybe on my neopixel board there is a built in resistor.

thehijacker commented 3 years ago

LED strip was now working. I got refund. Bought one from another seller. That one works fine. Separate power supply, shared ground with Wemos and Data In to GPIO14 (D5) on Wemos. Full control.

Thank you.