NodeMCU + WS2812B leds gaan niet aan.

Pagina: 1
Acties:

Vraag


Acties:
  • 0 Henk 'm!

  • Marco1994
  • Registratie: Juli 2012
  • Laatst online: 11:32
Om mij wat beter te verdiepen in elektronica, ben ik bezig om een woordklok te maken. Nu vond ik het wat makkelijk om een Raspberry Pi of Arduino te pakken, wat standaard code te uploaden en klaar. Dus ik heb een ESP01 en NodeMCU gekocht met wat ondersteunende electronica en een goed soldeerstation met toebehorenen. Na mijzelf wat te hebben ingelezen en een paar avonden aanklooien, heb ik besloten om mijn vraag hier te stellen.

Via deze tutorial heb ik de Arduino firmware(?) er op geflashed. Om te testen of alles werkt heb ik het ESP8266 blink voorbeeld geupload, en voila, de ingebouwde led gaat branden. De volgende stap is om een ledstrip te laten branden. Ik heb ervoor gekozen om gebruik te maken van 'NeoPixelBus by Makuna' library, om te testen heb ik de NeoPixelTest sketch geupload en aangepast zodat ik de volgende code krijg:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// NeoPixelTest
// This example will cycle between showing four pixels as Red, Green, Blue, White
// and then showing those pixels as Black.
//
// Included but commented out are examples of configuring a NeoPixelBus for
// different color order including an extra white channel, different data speeds, and
// for Esp8266 different methods to send the data.
// NOTE: You will need to make sure to pick the one for your platform 
//
//
// There is serial output of the current state so you can confirm and follow along
//
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#include <NeoPixelBus.h>

const uint16_t PixelCount = 4; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 5;  // make sure to set this to the correct pin, ignored for Esp8266

#define colorSaturation 128

// three element pixels, in different order and speeds
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
//NeoPixelBus<NeoRgbFeature, Neo400KbpsMethod> strip(PixelCount, PixelPin);

// For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use.  
// There are other Esp8266 alternative methods that provide more pin options, but also have
// other side effects.
// for details see wiki linked here https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods 

// You can also use one of these for Esp8266, 
// each having their own restrictions
//
// These two are the same as above as the DMA method is the default
// NOTE: These will ignore the PIN and use GPI03 pin
//NeoPixelBus<NeoGrbFeature, NeoEsp8266Dma800KbpsMethod> strip(PixelCount, PixelPin);
//NeoPixelBus<NeoRgbFeature, NeoEsp8266Dma400KbpsMethod> strip(PixelCount, PixelPin);

// Uart method is good for the Esp-01 or other pin restricted modules
// for details see wiki linked here https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods 
// NOTE: These will ignore the PIN and use GPI02 pin
//NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart1800KbpsMethod> strip(PixelCount, PixelPin);
//NeoPixelBus<NeoRgbFeature, NeoEsp8266Uart1400KbpsMethod> strip(PixelCount, PixelPin);

// The bitbang method is really only good if you are not using WiFi features of the ESP
// It works with all but pin 16
//NeoPixelBus<NeoGrbFeature, NeoEsp8266BitBang800KbpsMethod> strip(PixelCount, PixelPin);
//NeoPixelBus<NeoRgbFeature, NeoEsp8266BitBang400KbpsMethod> strip(PixelCount, PixelPin);

// four element pixels, RGBW
//NeoPixelBus<NeoRgbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);

RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);

HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);


void setup()
{
    Serial.begin(74880);
    while (!Serial); // wait for serial attach

    Serial.println();
    Serial.println("Initializing...");
    Serial.flush();

    // this resets all the neopixels to an off state
    strip.Begin();
    strip.Show();


    Serial.println();
    Serial.println("Running...");
}


void loop()
{
    delay(5000);

    Serial.println("Colors R, G, B, W...");

    // set the colors, 
    // if they don't match in order, you need to use NeoGrbFeature feature
    strip.SetPixelColor(0, red);
    strip.SetPixelColor(1, green);
    strip.SetPixelColor(2, blue);
    strip.SetPixelColor(3, white);
    // the following line demonstrates rgbw color support
    // if the NeoPixels are rgbw types the following line will compile
    // if the NeoPixels are anything else, the following line will give an error
    //strip.SetPixelColor(3, RgbwColor(colorSaturation));
    strip.Show();


    delay(5000);

    Serial.println("Off ...");

    // turn off the pixels
    strip.SetPixelColor(0, black);
    strip.SetPixelColor(1, black);
    strip.SetPixelColor(2, black);
    strip.SetPixelColor(3, black);
    strip.Show();

    delay(5000);

    Serial.println("HSL Colors R, G, B, W...");

    // set the colors, 
    // if they don't match in order, you may need to use NeoGrbFeature feature
    strip.SetPixelColor(0, hslRed);
    strip.SetPixelColor(1, hslGreen);
    strip.SetPixelColor(2, hslBlue);
    strip.SetPixelColor(3, hslWhite);
    strip.Show();


    delay(5000);

    Serial.println("Off again...");

    // turn off the pixels
    strip.SetPixelColor(0, hslBlack);
    strip.SetPixelColor(1, hslBlack);
    strip.SetPixelColor(2, hslBlack);
    strip.SetPixelColor(3, hslBlack);
    strip.Show();

}

De data kabel zit aangesloten op D1(PixelPin 5) en de ledstrip telt 4 leds.

Om het een en ander duidelijk te maken heb ik onderstaand schema gemaakt, dit schema is zoals het momenteel is aangesloten.

NodeMCU WS2812B aansluitschema

Het probleem is echter dat er geen led gaat branden, het gekke is dat de eerste twee leds wel gaan branden wanneer ik met mijn vingers de ledstrip aanraak. Met een multimeter heb ik aan het uiteinde de 5v en gnd gemeten en deze meet netjes 5v. Ook de stepdown voeding heb ik gemeten, deze meet ook netjes 3.3 volt.

Ik heb ook deze methode geprobeerd en de logic level converter weggelaten en ook dit werkte helaas niet.

Gebruikte onderdelen
NodeMCU V3
3V3-Stepdown-voeding
Logic level converter

Beste antwoord (via Marco1994 op 04-06-2019 09:03)


  • BosGnoom
  • Registratie: Februari 2002
  • Laatst online: 24-09 10:26
Uit je code voorbeeld:
code:
1
2
3
4
// For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use.  
// There are other Esp8266 alternative methods that provide more pin options, but also have
// other side effects.
// for details see wiki linked here https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods


Zit GPIO3 op D0 of D1?

Alle reacties


Acties:
  • 0 Henk 'm!

  • Boudewijn
  • Registratie: Februari 2004
  • Niet online

Boudewijn

omdat het kan

Wat meet je multimeter?

i3 + moederbord + geheugen kopen?


Acties:
  • 0 Henk 'm!

  • Marco1994
  • Registratie: Juli 2012
  • Laatst online: 11:32
Waar bedoel je, zoals vermeld heb ik de 5V en de 3.3V gemeten.

Acties:
  • 0 Henk 'm!

  • Boudewijn
  • Registratie: Februari 2004
  • Niet online

Boudewijn

omdat het kan

Nou ja je wil die ledstrip aansturen vanaf een GPIO pin (D0), wat meet je daar?
ik ga niet naar 90 regels code kijken, waar de fout zit, maar je wil wel zien of de code werkt of niet.

[ Voor 39% gewijzigd door Boudewijn op 03-06-2019 15:22 ]

i3 + moederbord + geheugen kopen?


Acties:
  • 0 Henk 'm!

  • Marco1994
  • Registratie: Juli 2012
  • Laatst online: 11:32
Goede vraag, totaal niet aan gedacht eigenlijk, ik zal vanavond eens kijken wat dat ding doet. Ik heb het plaatje aangepast, in het schema stond had ik D0 aangesloten, dit was fout want hij is daadwerkelijk op D1 aangesloten.

Acties:
  • 0 Henk 'm!

  • ThaStealth
  • Registratie: Oktober 2004
  • Laatst online: 30-09 12:22
const uint8_t PixelPin = 5; // make sure to set this to the correct pin, ignored for Esp8266
Hij word genegeerd bij de ESP, maar welke pin word dan wel gebruikt? Als ik even snel de docu doorzoek zeggen ze GPIO3, maar GPIO3 != D0/D1, GPIO3 is de RX pin
Probeer eens met een simpel ledje + weerstandje, (of met je multimeter) te kijken welke pin je eigenlijk aan het gebruiken bent :)

[ Voor 3% gewijzigd door ThaStealth op 03-06-2019 15:15 ]

Mess with the best, die like the rest


Acties:
  • Beste antwoord
  • 0 Henk 'm!

  • BosGnoom
  • Registratie: Februari 2002
  • Laatst online: 24-09 10:26
Uit je code voorbeeld:
code:
1
2
3
4
// For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use.  
// There are other Esp8266 alternative methods that provide more pin options, but also have
// other side effects.
// for details see wiki linked here https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods


Zit GPIO3 op D0 of D1?

Acties:
  • 0 Henk 'm!

  • Marco1994
  • Registratie: Juli 2012
  • Laatst online: 11:32
Zoals op onderstaand plaatje te zien is, is D1 GPIO pin 5.
Afbeeldingslocatie: https://i1.wp.com/www.teachmemicro.com/wp-content/uploads/2018/04/NodeMCUv3.0-pinout.jpg?ssl=1

Vanavond zal ik proberen met de multimeter de pins langs te gaan om te kijken welke pin er aangaat en of er daadwerkelijk wel een pin aangaat? Helaas beschik ik niet over een simpel ledje... i know.. |:(

[ Voor 38% gewijzigd door Marco1994 op 03-06-2019 15:32 ]


Acties:
  • +1 Henk 'm!

  • El_kingo
  • Registratie: Mei 2002
  • Laatst online: 17-03 11:17
Marco1994 schreef op maandag 3 juni 2019 @ 15:22:
Zoals op onderstaand plaatje te zien is, is D0 GPIO pin 5.
[Afbeelding]

Vanavond zal ik proberen met de multimeter de pins langs te gaan om te kijken welke pin er aangaat en of er daadwerkelijk wel een pin aangaat? Helaas beschik ik niet over een simpel ledje... i know.. |:(
Nee, GPIO16 zit op D0. Jij moet de strip aansluiten op GPIO3, dus dat is pin RX (Zie ook BosGnoom's post!)

Acties:
  • 0 Henk 'm!

  • Marco1994
  • Registratie: Juli 2012
  • Laatst online: 11:32
El_kingo schreef op maandag 3 juni 2019 @ 15:26:
[...]


Nee, GPIO16 zit op D0. Jij moet de strip aansluiten op GPIO3, dus dat is pin RX (Zie ook BosGnoom's post!)
Dit was een typo, ik bedoelde D1. Lol hier had ik dus compleet overheen gelezen, ik heb me blind zitten staren op de hardware.. Ik laat meer van me weten zodra ik dit geprobeerd heb.

EDIT:

het probleem was inderdaad dat ik de RX pin moest gebruiken.

[ Voor 8% gewijzigd door Marco1994 op 04-06-2019 09:03 ]

Pagina: 1