Wrong library on ESP32 — used RBDdimmer instead of rbdimmerESP32

I recently migrated my home automation from Domoticz on a Raspberry Pi to Home Assistant with ESP32 boards. In my old Domoticz setup I used to control an AC dimmer through a Python script on the Pi — it worked reliably for over two years.

Now I’m running the dimmer directly from an ESP32 DevKit. I searched the Arduino Library Manager for “rbdimmer” and installed the first result — RBDDimmer. The code compiles, uploads, and initially seems to work. But after a few minutes the ESP32 crashes with a Guru Meditation Error, restarts, works for another 2-3 minutes, then crashes again. Sometimes it runs for 10 minutes, sometimes only 30 seconds.

I found in the documentation that there appear to be two separate libraries:

  • RBDDimmer (RBDdimmer.h)
  • rbdimmerESP32 (rbdimmerESP32.h)

Can someone confirm — is the RBDDimmer library not supposed to be used on ESP32? Is this the cause of my crashes? I assumed since it compiled without errors it was compatible.

My current code:

#include <RBDdimmer.h>  // is this the wrong library for ESP32?

dimmerLamp dimmer(25, 18);

void setup() {
  Serial.begin(115200);
  dimmer.begin(NORMAL_MODE, ON);
}

void loop() {
  dimmer.setPower(50);
  delay(5000);
  dimmer.setPower(80);
  delay(5000);
}

Board: ESP32 DevKit V1, Arduino IDE 2.3, rbdimmer 1CH 8A module.

[SOLVED] Confirmed — switching to rbdimmerESP32 resolved all crashes.

I uninstalled RBDDimmer, installed rbdimmerESP32 from Library Manager, and updated my code:

#include <rbdimmerESP32.h>

rbdimmer dimmer(25, 18);

void setup() {
  Serial.begin(115200);
  dimmer.begin(NORMAL_MODE, ON);
}

void loop() {
  dimmer.setPower(50);
  delay(5000);
  dimmer.setPower(80);
  delay(5000);
}

Running for over 6 hours now with zero crashes. WiFi and MQTT are active simultaneously — no Guru Meditation Errors.

The confusing part was that the AVR library compiled perfectly on ESP32 with no warnings. In my experience with other Arduino libraries, if it compiles it usually works. Good to know this is an exception.

Thank you Kai — very clear explanation. This should probably be highlighted more prominently in the Library Manager description to prevent others from making the same mistake.