3.1.0 | LED Trickery, and some fixes!
How does 200 FPS sound?
But how? Well, it turns out that the ESP32-S2 is perfectly happy running two threads "at the same time" on a single core, which lets Sensory Bridge now update the LEDs at double the previous rate! This has unlocked a really amazing feature:
Temporal Dithering
Now that we can refresh the LEDs at 200Hz, we can slightly modify their output back forth between intermediate values 100 times a second. This allows for Temporal Dithering/Frame Rate Control, which allows the LEDs to trick your eye into seeing more shades of color than they can normally produce!
While crossing the 120 FPS threshold allowed me to use FastLED's built-in global temporal dithering (Try your PHOTONS knob after updating), I've also been able to implement per-LED dithering, making the Spectrogram look amazing, with a lot less loss of color resolution at pixels with lower brightness. After the update, give your LEDs a shake to see the effect in action! If you don't like the dithering, you're free to disable it @ settings.sensorybridge.rocks.
Also available as a configurable setting now is:
Manual Sensitivity Adjustment
Requested by Matt Crawford, (one of Lixie Labs' GitHub Sponsors!) You can now manually increase the gain of the spectrogram if you find yourself wanting to use your Sensory Bridge farther away from speakers!
Other Notable Changes From 3.0.0
- GDFT calculations now use a Hann window, because I freed up enough CPU to make it feasible! This means much less spectral leakage, especially at lower frequencies.
- GDFT also utilizes interlacing on the 16 lowest frequencies by only updating odd or even fields every frame, cutting their expensive computation time in half! By the time the spectrogram is finished going through all of its filtering steps, you wouldn't even know that it's happening.
- Better post-process scaling of the spectrogram leading to a more even response curve, especially at high frequencies
- Noise calibration data is now a lot less conservative, only scaling itself by 1.2x instead of 1.5x to subtract ambience. This preserves more quiet tones of music
- "FPS" has been split into two variables: "SYSTEM FPS" and "LED FPS". Both are now shows on the settings page, and are independent of each other.
- Audio sample rate is now 12200 instead of 24400, saves on GDFT execution time
- New configuration option:
MAX CURRENT (mA)
. Sets a rough current-draw limit for the LED strip, in milliamps. If a lightshow mode's output would surpass this limit, the display will be automatically dimmed by a factor that helps keep LED power consumption below this value. (Default 1500mA) chip_id
is now actually a unique string on each unit, because ESP32 is dumb sometimes
USB Update Process
If you've already updated to 3.0.0, you're in for a treat! This is your first update that you can do in under a minute if you're really trying. Download the SB_FIRMWARE_310.BIN
below, and do the following:
- Hold down the MODE button on your Sensory Bridge while plugging it into your PC
- This starts Update Mode, and your LEDs will trail blue
- Sensory Bridge is now pretending to be a 2MB flash drive on your PC, just drag the .BIN update into it and your device will do all the work for you!
If you haven't gotten 3.0 on your device yet, you'll have to compile from source this time. It's a bit of extra work, but well-worth the effort and you'll never need to do it again. Keep reading to learn how...
Compiling From Source
To update your Sensory Bridge firmware to 3.0.0 and above from an earlier version, download the "Source code (zip)" at the bottom of this page, extract it, and open the "SENSORY_BRIDGE_FIRMWARE.ino" in Arduino IDE.
If you don't yet have ESP32-S2 in your Arduino Board Definitions, follow the steps on this page:
https://learn.adafruit.com/adafruit-metro-esp32-s2/arduino-ide-setup-2
Install FastLED Dependency
If you don't have it installed in your copy of Arduino yet, you'll need it for Sensory Bridge to compile.
- Go to Sketch > Include Library > Manage Libraries
- In the window that appears, search for "FastLED" (by Daniel Garcia)
- Install the latest version
Board Settings
Finally, make sure that all of your board settings match this image:
Your Serial port (i.e. "COM13") will likely differ from mine.
IMPORTANT PLEASE READ
FOR THIS FIRMWARE TO WORK, you need to make sure the following settings are set in Arduino:
Erase All Flash Before Sketch Upload: ENABLED
This will erase your 2.0.0 config.bin and noise_cal.bin files in your Sensory Bridge's storage, because they are incompatible with this version and can cause your device to not boot correctly.
"USB CDC On Boot: Disabled" is quite important, as the 3.0 firmware manages USB itself, differently from the default behavior
Arduino IDE 2.x Fixes
Unfortunately, the new Arduino IDE 2.x has some issues that I'm hoping are fixed in a future update, because they can break this updating process and all of the new features are weighed down by annoying changes from the Legacy IDE. Here's how to fix those:
DISABLE DEFAULT COMPILATION WARNING BEHAVIOR
(This will make the firmware actually usable)
- In the Arduino 2.x IDE, click "File > Preferences"
- Set "Compiler Warnings" to "Default"
- This is because some external dependencies in the code such as FastLED trigger ignorable warnings like unused variables
- Arduino IDE 2.x treats all warnings as errors by default, breaking thousands of legacy libraries. (WTF)
DISABLE WORD WRAPPING
(This will guarantee code and docs are more readable, it's 2023, 80-column monitors aren't a thing. No IDE needs word wrapping enabled by default, that's dumb.)
- In the Arduino 2.x IDE, hit F1
- In the textbox that appears, type "wrap"
- You'll see a result for "View - Toggle Word Wrap"
- Click this item
- Repeat at least once until buggy word-wrapping is actually disabled
Upload
Hit either Ctrl+U or Cmd+U (depending on your OS), and the code will slowly compile and upload to Sensory Bridge. However, you still have one more step after this:
...Re-upload
Unless you know how to modify your ESP32-S2 compilation flags to use -O3
instead of -Os
(it's in the ESP32 core's platform.txt), you'll need to jump up to the "USB Update Process" section above and follow that short guide to upload again, this time from the pre-compiled binary. (You're able to do that now because only firmware >= 3.0 supports USB Update Mode)
The version I distribute myself has been compiled with the -O3 flag, leading to a slightly larger, but hugely faster firmware, and the speed difference is quite noticeable. Once that's done, you'll never have to go through this longer version of the process again! Enjoy your updated Sensory Bridge!