[Wireless for Opta] Constant I2C errors

Hello,

I recently got a Blues Wireless for Opta device and it was working great with the basic program sending data to NoteHub. But after some testing and changing power supplies a couple of times my Arduino Opta can’t communicate with the Blues module anymore. The debug console is just spitting out tons of errors about I2C transmissions.

Notecard Firmware: Tested with v7.4.1.16848, v8.1.4.17149, and v9.1.1.17181
Blues Wireless Notecard (Arduino Library): v1.6.6

I am using the basic tempature/voltage program found on the Wireless for Opta Quick Start Guide.

#include <Notecard.h>

#define usbSerial Serial

Notecard notecard;

void setup() {
    usbSerial.begin(115200);
    const size_t usb_timeout_ms = 3000;
    for (const size_t start_ms = millis(); !usbSerial && (millis() - start_ms) < usb_timeout_ms;)
        ;
    notecard.setDebugOutputStream(usbSerial);

    notecard.begin();
}

void loop() {
  takeReading();
  delay(15 * 1000);
}

void takeReading() {
  double temperature = 0;
  
  {
    J *rsp = notecard.requestAndResponse(notecard.newRequest("card.temp"));
    if (rsp != NULL)
    {
      temperature = JGetNumber(rsp, "value");
      notecard.deleteResponse(rsp);
    }
  }

  double voltage = 0;
  {
    J *rsp = notecard.requestAndResponse(notecard.newRequest("card.voltage"));
    if (rsp != NULL)
    {
      voltage = JGetNumber(rsp, "value");
      notecard.deleteResponse(rsp);
    }
  }

  {
    J *req = notecard.newRequest("note.add");
    if (req != NULL)
    {
      JAddBoolToObject(req, "sync", true);
      J *body = JAddObjectToObject(req, "body");
      if (body != NULL)
      {
        JAddNumberToObject(body, "temp", temperature);
        JAddNumberToObject(body, "voltage", voltage);
      }
      notecard.sendRequest(req);
    }
  }
}

And after I upload the program it constantly spits out these errors, sometimes with a 15 second gap (which should be the 15s delay in the loop().)

15:00:14.235 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:14.235 -> [ERROR] error encountered during I2C transmit hook execution
15:00:15.271 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:15.271 -> [ERROR] error encountered during I2C transmit hook execution
15:00:16.255 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:16.255 -> [ERROR] error encountered during I2C transmit hook execution
15:00:17.285 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:17.285 -> [ERROR] error encountered during I2C transmit hook execution
15:00:18.272 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:18.272 -> [ERROR] error encountered during I2C transmit hook execution
15:00:19.281 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:19.281 -> [ERROR] error encountered during I2C transmit hook execution
15:00:20.321 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:20.321 -> [ERROR] error encountered during I2C transmit hook execution
15:00:21.316 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:21.317 -> [ERROR] error encountered during I2C transmit hook execution
15:00:22.343 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:22.343 -> [ERROR] error encountered during I2C transmit hook execution
15:00:38.634 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:38.634 -> [ERROR] error encountered during I2C transmit hook execution
15:00:39.626 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:39.626 -> [ERROR] error encountered during I2C transmit hook execution
15:00:40.608 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:40.608 -> [ERROR] error encountered during I2C transmit hook execution
15:00:41.640 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:41.640 -> [ERROR] error encountered during I2C transmit hook execution
15:00:42.627 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:42.627 -> [ERROR] error encountered during I2C transmit hook execution
15:00:43.657 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:43.657 -> [ERROR] error encountered during I2C transmit hook execution
15:00:44.645 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:44.645 -> [ERROR] error encountered during I2C transmit hook execution
15:00:45.670 -> [ERROR] i2c: received NACK on transmit of address {io}
15:00:45.670 -> [ERROR] error encountered during I2C transmit hook execution
15:00:46.706 -> [ERROR] i2c: received NACK on transmit of address {

Photo of Arduino Opta with Blues Wireless for Opta module, along with 12V power supply:

I have confirmed that the Arduino Opta is working on it’s own with a Modbus + WiFi + MQTT program. As well as I updated the firmware twice on the Blues Wireless for Opta unit twice (once from v7 to v8, and then v8 to v9). Also pressing the “TEST” button on the Blues unit sends an event/note to NoteHub like: _button.qo: {"power":true}. I have also physically separated the Arduino Opta and Blues unit, inspected the AUX connector and it looked fine. Then re-attached and still seeing this issue. As well as uploading software to Arduino Opta from a different computer.

EDIT: I have tested with a second Arduino Opta unit, and still seeing the same thing happen.

Any help to resolve this would be great as we love the product.

Hello @zach16!

Welcome to the forums. You’ve come to the right place!

Good news and bad news. The good news, you’ve done everything correctly, and I have a work around and solution for you.

At times, it seems the two devices can get a bit confused. I haven’t figured it out exactly why this happens, but it seems have something to do with plugging in and out the USB to the Opta itself. It’s either something to do with the power supply/switching of the Opta or something to do with jostling the device when the USB is unplugged. I don’t seem to experience this behavior as often (almost never) if I slowly and carefully remove the USB. That even sounds crazy to me when I type it, but that’s the voodoo I’m using today.

Work Around: The Blues Opta Expansion has a Lithium Ion Capacitor (which allows it to survive and report power loss). However, this makes it hard to simply restart. To get out of the state you’re in, I typically hold the reset button on the Opta until the Blues expansion begins to idle (15-30 seconds). If that doesn’t work (very rare), then you can just power down the whole device until the Li Ion Capacitor in the Opta Expansion runs out of power.

The Real Solution: I will be releasing a patch in the coming week or so to allow the Opta to reset itself when it gets in this state. However, that patch has to go through two Arduino releases before it’s available through the Arduino Library Manager. They are usually pretty good to release my patches, so hopefully you’ll have it inside of a month. If you need it more quickly, then I can teach you how to hot patch your Arduino_ConnectionHandler as soon as I have the fix prepared and released.

Let me know your time frame and preference, and I will try to have something that fits your needs.

Cheers,
Zak

1 Like

Hello,

Thanks for the quick reply.

I tried both solutions you mentioned but didn’t seem to have any luck fixing my issue. I’m a little confused on the whole “hold Opta reset button for 15s until Blues expansion begins to idle”. I didn’t see LEDs blink or anything really happen after holding the button for 15-30s multiple times. I also tried holding the Blues Opta Expansion but that didn’t seem to do anything either.

Other than the reset button stuff, I unplugged all power sources for like two hours and let the onboard battery run out of power (hitting the TEST button doesn’t send an update/event to NoteHub). After powering back up the i2c errors still occurred, same thing after reflashing a program.

Our company is still testing/prototyping out this device so we’re not in a huge rush to get it working, but I would still like to do anything I can to try and get it working as soon as possible. As the Blues Opta Expansion is a lot more robust than our current solution of a Raspberry Pi CM4 with a 4G modem.

Update: I tried the same steps with the first Arduino Opta and it was fixed for a few minutes.

However when I unpowered the units and wired up a RS485 Modbus sensor to the Opta, the i2c errors started happening again, and aren’t going away after repeating the “drain battery to 0%” method.

Hi @zach16,

I’m working toward the fix as we speak, and I hope to have it out by tomorrow or Monday. Once I have it pushed to GitHub, I will report back here.

Then I can help you install it manually if needed.

Cheers,
Zak