Comments on: MicroPython: WS2812B Addressable RGB LEDs with ESP32 and ESP8266 https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 21 Oct 2025 14:35:22 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-1112329 Tue, 21 Oct 2025 14:35:22 +0000 https://randomnerdtutorials.com/?p=81128#comment-1112329 In reply to Tom.

Hi.
Did you flash the ESP32 with MicroPython firmware?
It looks like you have selected the wrong interpreter.
Which IDE are you using?
Is the ESP32 connected to your computer and “seen” by the IDE?
Regards,
Sara

]]>
By: Tom https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-1112115 Tue, 21 Oct 2025 03:59:50 +0000 https://randomnerdtutorials.com/?p=81128#comment-1112115 Help, I’m not able to even light up the onboard RGB LED. I don’t understand why it can’t find ‘machine’ or ‘Pin’.

This code is from: embedded-things.blogspot.com

commnted code is yours and doesn’t work either.

Win 11/64; i7 9700K; 16GB RAM; Thonny 4.1.7; Python 3.10.11; Tk 8.6.13; MicroPython v1.26.1; ESP32-C3

import machine
from machine import Pin
import neopixel
import time

N = 1
P = 8

onboard_pixel = neopixel.NeoPixel(board, NEOPIXEL, 1, brightness=0.5, auto_write=False)

np = neopixel.NeoPixel(machine, Pin(8), 1)

PURPLE = (115, 58, 201)

while True:
np[0] = (0, 0, 0)
np.write()
time.sleep(2)
np[0] = (255, 0, 0)
np.write()
time.sleep(2)
np[0] = (0, 255, 0)
np.write()
time.sleep(2)
np[0] = (0, 0, 255)
np.write()
time.sleep(2)
np[0] = (PURPLE)
np.write()
time.sleep(2)

# onboard_pixel.fill(PURPLE) = Red, Green, Blue
# onboard_pixel.show()
# time.sleep(1)
# onboard_pixel.fill((0,255,0))
# onboard_pixel.show()
# time.sleep(1)
# onboard_pixel.fill((115,58,201)) # purple
# onboard_pixel.show()
# time.sleep(3)

yields: %Run -c $EDITOR_CONTENT

MPY: soft reboot
Traceback (most recent call last):
File “”, line 11, in
File “neopixel.py”, line 1, in init
TypeError: unsupported types for mul: ‘Pin’, ‘int’

Looking at pythontutor.com shows:
ImportError: machine not found or not supported
Only these modules can be imported:
future, abc, array, bisect, calendar, cmath,
collections, copy, datetime, decimal, doctest, fractions,
functools, hashlib, heapq, io, itertools, json,
locale, math, operator, pickle, pprint, random,
re, string, types, typing, unittest

]]>
By: Anthony Ferlazzo https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-694753 Sat, 06 Nov 2021 17:26:59 +0000 https://randomnerdtutorials.com/?p=81128#comment-694753 In reply to Anthony Ferlazzo.

The problem was completely my fault. The UART to Serial driver was installed when I was using Arduino C++ and it appears that after re-flashing the ESP8266 with Micro Python I should have reinstalled the driver. Once I did that everything began working fine.

]]>
By: Anthony Ferlazzo https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-694405 Fri, 05 Nov 2021 16:14:58 +0000 https://randomnerdtutorials.com/?p=81128#comment-694405 In reply to Anthony Ferlazzo.

After thinking about this for a while I decided to try reinstalling the USB-to-Serial driver. It was installed when I was using the Arduino IDE and C++. That seems to have worked, but we’ll see.

The WS2812B is not lighting up. To help me debug the issue, rather than use the WS2812 LED strip I used the onboard LEDs.

#for Microcontroller NodeMCU 12E ESP8266 Board, the version I have that includes wifi capability

#The NodeMCU has two on-board LEDs
#The first LED comes with the ESP-12E Module and is connected to GPIO 2 of ESP8266
#The second LED is on the break-out board (near the CP2102 IC) and is connected to GPIO 16

#The ESP8266 uses ‘inverse logic’ meaning that they turn on when the pins are 0 and turn
#off when the pins are 1

import time
from machine import Pin
led1=Pin(2,Pin.OUT) #create the first LED object on pin 2 and set it to output
led2=Pin(16,Pin.OUT) #create the second LED object on pin 16 and set to output
i = 0

#Alternate the blinking of the LEDs every half second 40 times
while i < 40:
led1.value(1) #turn off
led2.value(0) #turn on
time.sleep(0.5)
led1.value(0) #turn on
led2.value(1) #turn off
time.sleep(0.5)
led1.value(1) #turn off
led2.value(0) #turn on

i = i + 1

Since I have over 40 LEDs in the strip I’m going to try using an external 5 volt power supply.

]]>
By: Anthony Ferlazzo https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-693928 Thu, 04 Nov 2021 14:41:31 +0000 https://randomnerdtutorials.com/?p=81128#comment-693928 The LEDs do not light.

The Shell displays the error message:

Unable to connect to COM5: could not open port ‘COM5’: PermissionError(13, ‘Access is denied.’, None, 5)

If you have serial connection to the device from another program, then disconnect it there first.

Device Manager reports a COM5 at 11500 kbps, I lowered it to 9600 in Thonny

]]>
By: Sara Santos https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-665258 Wed, 01 Sep 2021 09:30:49 +0000 https://randomnerdtutorials.com/?p=81128#comment-665258 In reply to Amedo1.

That’s great!

]]>
By: Amedo1 https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-665147 Wed, 01 Sep 2021 04:00:33 +0000 https://randomnerdtutorials.com/?p=81128#comment-665147 Thanks Santos and Sara, I made this addressable LED strip montage and it works fine (ESP32 with an 8 LED strip), and everything is very well explained.

]]>
By: Attila https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-589748 Wed, 14 Apr 2021 12:24:30 +0000 https://randomnerdtutorials.com/?p=81128#comment-589748 In reply to Mike.

Hi Mike !

I’m glad it works now. Was it a software bug or something with the hardware?

This tutorial relies on the chance that the LEDs will work with 3.3V logic level (which is true for most of the time), but adding more and
more LEDs will make it more and more marginal. I would still recommend you to use a level shifter between the ESP and the LEDs.

Attila

]]>
By: Mike https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-589739 Wed, 14 Apr 2021 12:06:52 +0000 https://randomnerdtutorials.com/?p=81128#comment-589739 In reply to Attila.

Thanks Attila, really appreciate your reply, I have found my mistake. Right now, it’s working.

THANKS!
miKE

]]>
By: Mike https://randomnerdtutorials.com/micropython-ws2812b-addressable-rgb-leds-neopixel-esp32-esp8266/#comment-589733 Wed, 14 Apr 2021 11:53:43 +0000 https://randomnerdtutorials.com/?p=81128#comment-589733 In reply to Attila.

If it’s possible that I can send you my work through your email? Mine is 935431582@qq.com.

Regards,
Mike

]]>