ESP microPython lesson 2.3 fatal error in instructions (LED not illuminating)

ESP microPython course: Lesson 2.3 Colorful Light

Drawing has a fatal error. The drawings all show the long lead of the multicolor LED as negative. It is positive and should NOT be connected to the board ground but the 5v pin right next to it instead.

Also, the RGB colors cause inverted coloring on the LED as written. 1023, 0, 0 should be 0, 1023, 1023. All entries would need to be prefaced with 1023 - x [x is the desired value]

Our verification indicates no issues on our end.

Could you please double-check if the wiring is correct?

To clarify, are you saying that when following our wiring instructions and running the code, the RGB LED displays colors that are inverted (e.g., shows green instead of red, or shows cyan instead of purple) compared to the expected result?

The expected result is for the RGB LED to display colors in the correct sequence: Red, Green, Blue, and Purple, etc.

I’m wondering if you’ve somehow been shipped the common anode version of the LED device, rather than the correct common cathode variant. That would explain your power, observations and apparent software inversion issues.

No. When following the lesson’s wiring and running the code, it doesn’t work at all. I have to move the ground pin to the 5v pin. After moving the pin, the LED works, but the colors are inverted. Since my original post I’ve read the docs on the Machine module at microPython and learned that the PWM class allows for an output to be inverted. I added that to the code and it now works fine. You can see it below in lines 10-12. The drawing in the lesson even shows the LED anode as negative. I suspect that if I went back to the two previous lessons that the faint glow at power on is due to this, also. I’ll have to check that out. The development board that came with this kit just says ESP32 on it without any other designation like WROOM-32 that the advertising image has on it, but I don’t seem to be having any pinout problems.

from machine import Pin, PWM
import time

Define the GPIO pins for the RGB LED

RED_PIN = 27
GREEN_PIN = 26
BLUE_PIN = 25

Set up the PWM channels and invert output

red = PWM(Pin(RED_PIN), invert=True)
green = PWM(Pin(GREEN_PIN), invert=True)
blue = PWM(Pin(BLUE_PIN), invert=True)

Set the PWM frequency

red.freq(1000)
green.freq(1000)
blue.freq(1000)

def set_color(r, g, b):
red.duty(r)
green.duty(g)
blue.duty(b)

while True:
# Set different colors and wait for a while
set_color(1023, 0, 0) # Red
print(‘red’)
time.sleep(1)
set_color(0, 1023, 0) # Green
print(‘green’)
time.sleep(1)
set_color(0, 0, 1023) # Blue
print(‘blue’)
time.sleep(1)
set_color(1023, 0, 1023) # purple
time.sleep(1)

I think this may be the case. The multi-colored LED in the kit definitely has the anode as the longest lead.
As a side note, many many moons ago I had a lab partner that trimmed all of the LEDs so they would fit nicely in our breadboards. I was not happy. The flat edge on some LEDs for the cathode side can be nearly impossible to see without a bright light and/or magnification.

It’s often possible, if you’ve got good eyes! To look inside the LED as the collector is usually the largest bit inside. This would confirm my theory that you have a common anode device for whatever reason.

As stated in another response, I believe the problem is the LED is common anode and it would certainly cause an issue as the print is illustrated as common cathode.

Based on your description, it appears you have received a common anode RGB LED.

The correct component intended for use with our kit is a common cathode RGB LED.

We can arrange to send you a replacement common cathode RGB LED.

For reference, our tutorial also explains this distinction:

I would definitely be interested in a replacement RGB LED. That would be so much easier than attempting workarounds.

Please provide your detailed address to service@sunfounder.comn to get the RGB.

Awesome. I actually needed a pair of flush mount cutters and while I was online got a pack of 10 RBG LED CC while I was there from my electronics supplier. At $.39 it didn’t seem worth it to bother Sunfounder with postage. I only bought 10 to avoid the surcharge so the net cost was even cheaper considering I was going to buy only the cutters. But, don’t think the CS didn’t go unnoticed. Some other kit makers have been barely more than copycat dropshippers. I love that you helped me find a solution and offered a resolution.

We are delighted that you quickly found a suitable alternative and can smoothly progress with your project.

Seeing your recognition of our customer service truly makes us happy. For us, it goes beyond just selling kits; we care more about helping everyone solve practical problems and ensuring a smooth building process. Whether it’s assisting with replacement parts or troubleshooting issues, providing valuable support for you is what matters most to us.

If you encounter any other issues while using the ESP32 Starter Kit later, or have any questions about the subsequent lessons, please feel free to reach out to us anytime. Wishing you happy coding and enjoyable creating