I wanted to test a Pitch Bend potentiometer connected to a Nano ESP32 S3 through a multiplexer (4051) using the Control Surface Library.
It works but it is noisy.
The shift factor is set to 4.
The analog filter type is uint32_t.
The sketch with the additional code gets compiled but once loaded the Nano keeps rebooting in cycle. This extra bit of code works fine on a Micro Pro.
Strange behaviour indeed.
It seems that the multiplexer somehow bypasses the control surface filtering.
Do you think there is a way to increase further more the filter factor or type?
Does the same potentiometer work fine without the multiplexer?
It does.
Try using 3.3V for VCC/DD, see the VIH values in §6.3 of the datasheet
I tried using 3.3v VCC/DD and decoupling capacitors but it didn't seem to improve much.
At this point I don't think it is hardware related; it could be due to a wrong board selected on IDE.
I installed the esp32 package but there are plenty of models to choose from. The board's manufacturer recommends to use the Arduino Nano ESP32; however if I do so, the sketch gets uploaded but the board turns unresponsive.
Instead I selected the ESP32-S3-USB-OTG which seems to work fine but it bypasses the filtering of the Multiplexer's analog inputs.
What do you mean? The code related to filtering is independent of the platform.
I noticed that boards from different manufacturer behave differently with the same filtering settings.
Anyway, is there a way to increase further more the filtering?
It is almost ineffective for now and there is almost no delay.
I fixed the sketch above and it works now but it doesn't improve much:
Could you be more specific? Which manufacturers are you talking about? What are the exact settings I should select in the IDE to reproduce these different behaviors?
Sure, you can increase the filter shift factor even further. Switching the filter type to uint64_t won't have any noticeable effect, though.
The sketch itself won't change the behavior, it is meant to visualize the un-filtered and filtered signals. Please post a screenshot of the serial plotter using this sketch, similar to this one:
It worked with the last bit of sketch you sent.
I'm afraid I'm unable to use the serial plotter as the board needs to be "offilne" in order to work. On the contrary, in order to upload a sketch, I have to call the bootloader mode (Pin B1 to GND and press reset button), which would make the board nonoperational.
Anyway, the filter now works but it leaves a 1sec of delay which means I have to play a little bit more with the filter settings.
Interestedly, I noticed that the Partition Scheme on IDE needs to be set to 16M otherwise the analog filter doesn't work.
In order to upload the sketch I need to set the board to bootloader mode (B1 to GND) which makes the board inoperative BUT visible to IDE. After uploading the sketch I need to disconnect B1 to ground and reset via the onboard button. IDE won't detect the board anymore BUT it would be operative and recognised by Midi Monitor as a MIDI source.
I installed the esp32 package. The board's manufacturer recommends to use the Arduino Nano ESP32; however if I do so, the sketch gets uploaded but the board seems unresponsive.
Instead I selected the ESP32-S3-USB-OTG which seems to work fine if the Partition Scheme is set to 16M, otherwise the analog filter wouldn't work.
Due to the name being fairly generic, it isn't clear but the "ESP32-S3-USB-OTG" board definition is provided to add support for a specific development board:
As mentioned in the post you linked, you can typically achieve a configuration equivalent to any of the model-specific board definitions by selecting the general purpose "dev module" board definition (in this case, "ESP32S3 Dev Module"), and then adjusting the various custom board options menus you will find under Arduino IDE's Tools menu after selecting that board.