MR60BHA2: failing to get arduino examples to work

I bought a MR60BHA2 and I am able to get it into Home Assistant via ESPHome (it arrived flashed in this way). I want to develop my own sampling / publishing solution and thought to go via Arduino, following the examples and adapting them.
I can compile and upload the code, no issue, but then I see nothing on the Serial monitor and I cannot even run the blink example. I tried several solutions and eventually thought that maybe the issue is the Serial, but everything works (I tried the WiFi example but nothing connects to the WiFi …) … but no.

I am sure I am making a stupid mistake somewhere, but I am not finding a way out of the corner. I succeded in re-flashing back the provided seeed-studio firmware to get the thing work with HA and ESPHome, but this is not what I want … I am making my own platform and I need to be able to program access to WIFI and MQTT …
Is anyone able to help? Thanks in advance.

What code are you using? After uploading the program, did you reset to ensure it runs?

Thank you for checking :slight_smile:
I succeeded yesterday in getting the sensor to run the code compiled and uploaded with arduino. To be honest, after the n-th trial I do not know how I got the device to work, but at least it does. Thanks

1 Like

It must match Serial.begin(baudRate) in your sketch (default for ESPHome is usually 115200, but some examples use 9600).
Ensure Serial Monitor is Closed During Upload.
Try a minimal working sketch:

void setup() {
  Serial.begin(115200);
  delay(1000); // Wait a bit for Serial to initialize
  Serial.println("Booting...");
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  Serial.println("Blink");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
}

Open Serial Monitor at 115200 baud and look for output. The problem may happen due to wrong SSID/password. It is also possible that WiFi.begin() is not being followed by WiFi.waitForConnectResult() or while (!WiFi.isConnected()) {...}

If you want to keep all info about MQTT always handy, you can see here: ESP32 MQTT - The Engineering Projects

1 Like