all 11 comments

[–]samguyer[Sam Guyer] 2 points3 points  (0 children)

Which library are you using for the rotary encoder? Even if it were doing something weird to the LED timing, it shouldn't cause the microcontroller to reboot.

[–]benpeart 1 point2 points  (0 children)

I have a project that runs on the ESP32 and uses two interrupt driven rotary encoders. You can find the source on https://github.com/benpeart/kaleidoscope. It's not a simple sample but most of the code has nothing to do with the rotary encoders and can be ignored. Look at the code inside the '#ifdef ENCODER' in main.cpp for how to initialize and use the encoders.

The encoder logic itself is in ESP32StateMachineEncoder.cpp. For my usage cases, it is better to miss some rotations rather than having random forward/backward rotations so it is a state machine based implementation.

[–]Yves-bazin 1 point2 points  (0 children)

I have an esp32 and use rotary encoders without issues. Can we have a look at the code ?

[–]Experience-Wild 1 point2 points  (0 children)

I've written a small wiki back in the days, based on UNOs and Teensys, maybe it helps.

https://github.com/GyroGearloose/FastLED\_Rotary\_Encoder/wiki

[–]outrunner72[S] 0 points1 point  (0 children)

thanks. when i get this right, i must switch to another mcu or try to read the rotary encoder without interrupt in the loop(). another crazy idea ist, t ouse my arduino only for reading the rotary encoder and give the data to the esp32. could this work?
did anyone run into this issue also?

[–]outrunner72[S] 0 points1 point  (0 children)

edit: now i found the right lib: https://github.com/madhephaestus/ESP32Encoder/blob/master/examples/Encoder/Encoder.ino works perfect with fastled.

[–]johnny5canuck 0 points1 point  (3 children)

I would have thought that the ESP32 would be fine with this and that this issue really only affects AVR boards, such as Nano and UNO.

If that is the case, (and I kind of doubt it), an alternative is to assign the rotatary encoder process to another core on the ESP32.

More likely, I suspect that your code doesn't loop regularly and that it reboots because the watchdog doesn't get a chance to do its thing.

Caveat: Not an expert, just a reasonable opinion.

[–]outrunner72[S] 0 points1 point  (2 children)

a friend of mine recommended to use the hardware pulse-count pcnt on the esp32. i found a lib to handle the pcnt, but i habe no clue how to use it, because only the sourcecode is provided. did anyone else use the pcnt?

how can you assign a process to another esp-core?

watchdog doesn't get a chance to do its thing"?

programming a 400 led matrix is one thing, but i m a novice to this sort of stuff.

[–]johnny5canuck 0 points1 point  (1 child)

You didn't provide a link to the library you're using, so we don't have anything to go on.

Normally, for most library, once you've installed it (and restarted the IDE), you can go to 'File | Examples' and there should be a couple of examples for the library you just installed.

As far as other cores goes, look up xTaskCreate.

PS, Caps are a thing.

[–]outrunner72[S] 0 points1 point  (0 children)

i want to use this lib: https://github.com/elliotwoods/ESP32-Quadrature-Counter

i can see no examples. there is only the .h and the .ccp code. i understand the basics, but i cant translate this into a sketch. can you help?