Support for ESP32-PICO

I just got WLED working on the M5Stack Atom

https://docs.m5stack.com/#/en/core/atom_matrix

I haven’t gotten to testing the integrated IR but the wifi works and the button works. It’s a little flakey being an ESP-Pico but it’s progress.

1 Like

I’ve got it running code but had a lot of reboots and wifi issues with WLED although it does compile.

Atom test code

WLED on M5Stack-Atom

1 Like

That’s awesome, gotta get my hands on one of these!

Were there major code changes necessary to get WLED to compile for the pico, even though it’s not perfectly stable yet? (it is single core afaik and quite a bit different from a regular ESP32)

Yes, single core but faster than 8266, 240Mhz iirc. In addition, the M5Stack-Atom had built in IR. There is also the M5StickC which is also ESP32-Pico based but has a small OLED screen and integrated microphone and the full M5Stack which has a full ESP32 with color screen, buttons, gyre, mic, IR but it’s kind of overkill for WLED. My thought for use of the Atom was since I’m using this an automotive application, I wanted the display on the device as an indicator of what was running since I might not be able to see the LEDs and don’t want to have to use a phone with the web interface.

Stability is definitely an issue at this point, the issues seem to he Wifi related. Even when the device isn’t accessible via Wifi or really slow to react, the button will still pause the visualization and turn it back on.

So here is what I have so far and where I’m running into issues. The good news is when I use PlatformIO with default_envs = esp32dev it appears to be stable although the button doesn’t seem to work. I tried to use the exact config that I thought was applicable but it goes back to unstable wifi, those settins are as follows:

default_envs = m5stick-c

[env:m5stick-c]
board = M5Stick-c
platform = espressif32
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
lib_ignore =
ESPAsyncTCP
ESPAsyncUDP

PlatformIO doc page on this SOC is here: M5Stick-c
Any insight into the build process would be appreciated.

That seems good though… Let’s try and see if the instabilities come from the board config or from the custom pins. Is it stable if you use -D LEDPIN=27 -D BTNPIN=39 with the esp32dev environment?

Good question, I’ll try tonight after I get my son to bed.

Thanks again.

[env:esp32dev] unaltered works just fine and I get an immediate connection to wifi.

[env:esp32dev] with build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39 works fine as well except the button isn’t working.

With an unaltered config, the default behavior of the button should be to power on/off the display, correct?

Interesting! Glad to know the env32dev works, but strange that the button doesn’t work. Double check that you have no macros set and that the button is enabled in the top of sync settings. More likely though, the button voltage levels might be opposite what WLED expects (should be LOW if pressed, HIGH otherwise). I’ve ordered one, want to give it a try as well!

That was it in sync settings! D’oh! Thanks again.

Here is what i ended up using for a config, next to get the rotary encoder or button matrix working. Unfortunately I might not be able ti use this as the sound reactive code uses an Analog pin. Use case will be using this as a local display to drive accent lights on a boat. Thanks again for your sharing with the community.

[env:m5stick-c]
board = m5stick-c
platform = espressif32@1.11.2
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
monitor_speed = 1500000
upload_speed = 1500000
board_build.f_cpu = 240000000L
lib_ignore =
ESPAsyncTCP
ESPAsyncUDP

1 Like

Awesome! If that config is stable, i’ll add it to the platformio.ini soon!

Sound reactivity should be possible! There are two pins brought out that support analog, GPIO 25 and 33. See https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ It should work :slight_smile:

That’s great, I mistakenly assumed that none were labeled Ax like on the 8266 that there wasn’t an ADC capable pin. I’ve got the rotary encoder working off the ‘grove’ connector so I’ll take a look at the sound reactive when I get a chance. I’ve got it on an 8266 now and it’s been perfectly stable. Any updates on the multiple output pin/segment mapping? Ideally, I’d like to have something display on the atom that is an indicator of what is plating on the larger strings.

Encoder working

Thanks again!

1 Like

Looks like I’ll have to use G32 or G33 as you can only use ADC1 when WiFi is in use.

1 Like

I want to try the esp32-pico. It Looks very nice and has everything onboard.
Is there a ready Tor flash binary, or can somebody please provide such a File.
Can I flash it with esptool?

Best regards,
Stefan

I just got the M5Stick-C (also ESP32-pico) working as a WLED controller with the following platformio.ini settings.

[env:m5stick-c]
board = m5stick-c
build_flags = ${common.build_flags_esp32} -D LEDPIN=26 -D BTNPIN=37
lib_ignore = 
	ESPAsyncTCP
	ESPAsyncUDP
upload_port = /dev/cu.usbserial-514A6FFF41
upload_speed = 115200
platform = espressif32
lib_deps = M5StickC

Note: your upload port will vary (I’m on a Mac and would be different than Windows or Linux).

I hooked up a string of 50 ws2811 bullet pixel LEDs to the GPIO headers (pins GND, 5V --> (out), and G26) on the top of the M5Stick-C, but I limit the number to 10 in the WLED settings so I don’t overdrive the current limits on the M5Stick-C’s 5V output port. The button on the front of the M5Stick-C (known as button A) will toggle the light strip on/off.

I plan to order a few AtomMatrix devices as well, so thanks @lanman1 for all your work so far.

In the video for “Atom test code”, when you press the button, is it cycling through the WLED presets? If so, how did you do that?

Pretty sure that is in a standard build. Tap on/off, long-press change mode.

That was different code, right now the button does on/off, to enable the button, make sure you have this line.

build_flags = ${common.build_flags_esp32} -D LEDPIN=26 -D BTNPIN=37

It looks like the stick has 2 buttons, G37 and G39 so I’m not sure which one will work, if you want to switch them, switch the above line to G39. Then you need to make sure the button is enabled in the GUI, goto Config -> Sync Interfaces and then make sure that On/Off button enabled is checked, then hit save.

Yep, I was already using -D BTNPIN=37 for toggling the lights on/off. I double checked the button was enabled in the GUI and it already was.

@tonyno, thanks for the hint. After reading a bit more on the wiki, I ended up setting the API macros in the Time & Macros menu of the configuration.

  1. FX=~
  2. T=2

Then set:
Button short press macro: 1
Long press: 2

So when I short press button A on the M5Stick-C it will cycle through the effects and long press button A will turn the M5Stick-C on/off.

I’m curious. Since there is another button B on the M5Stick-C, can I somehow map something else to that button, which is GPIO39? Is there anything like BTNPIN2?

Just wanted to make the note that I changed from lib_deps = M5Stack to lib_deps = M5StickC in platformio.ini. This enabled me to interface with the LCD screen with a usermod.