top of page
Search
  • Writer's pictureIfrim Ciprian

I2C Bus - Nicla Sense ME - Issues Resolved

My research on the I2C bus performed last week, with the outcomes and findings is present here: https://ciprianaa30.wixsite.com/aurismartwatch/post/i2c-sensor-testing-nicla-sense-me-arduino-mega.


The main issues found were:

  • The sensors not being detected;

  • Sensors not working together;

  • Power issues;

  • The I2C Bus stopping after 50 seconds.


Because of these issues I thought that it could be that the I2C bus is write only, especially considering the examples provided in the Arduino reference page.

So with a Logic Analysed, I was able to see if there is any connection on the I2C bus:

The library itself has code for receiving data as well, so everything should be working, especcially considering that data is being transmitted on the bus as seen with the analyser.


So through trial and error I have been able to find the following relevant information:

  • The sensor has to be 3.3 volts. It seems that with a logic level convertor it creates issues.

  • The sensors have to be powered by the board's VDDIO_EXT. Where the voltage measurement is 3.3 volts constant, with a maximum of 100mA for current.The interesting part about this pin, although no data is presented in the documentation, is that it can be changed through software from 1.8v to 3.3v. And it can be used either as an analog reference internally or as a regulated voltage output to other components, which by default is set to, with 3.3 volts.

  • The I2C bus stopping after 50 seconds is an issue caused by the fact that the bus is shared between the 2 on-board chips: nRF52832 System-on-chip (64 MHz ARM® Cortex-M4F microcontroller 64 KB SRAM 512 KB Flash RAM) and the ATSAMD11D14A-MUT (Microcontroller Serial to USB Bridge Debugger interface). It turns out that that the following code must be included for the data package to be processed correctly:

    1. #include "Nicla_System.h" (before the void setup)

    2. nicla::begin(); (in the void setup before any code)

  • The sensors not being detected and the power issues for them were caused by all the aforementioned issues, and then some connectos/headers not making good contact with the PCB. They have been fixed.

After all these changes, I was able to get different I2C sensors to work separately. However, using multiple sensors together were causing issues.

  1. The Adafruit MLX90614 together with Adafruit SI1145 is not working.

  2. The Adafruit MLX90614 with the BM280 is working.

This made me thing there was an issue with the I2C address, but the MLX90614 is 1x5A and the SI1145 is 1x60. So there should be no issues there.


After running some more tests with the Logic Analyser and changing the breadboard and connections, plus the USB cable, I have gotten the modules to work together, so there must have been some connection issues, espcially considering the I2C bus sensitivity.


Furthermore, I have run into some issues where the Nicla Sense ME would reset itself when using all the onboard sensors and outputting in the serial, which made me thing there was a library issue. But it turns out it was just USB Compatibility issues, where the board was not happy with the USB ports I was using on my desktop, but was working perfectly fine with my laptop. USB 3.1 to USB 3.0 issues, as well as the usb control chip difference on the motherboard.


So from here on out, all sensors issues should have been fixed. And I will now be focusing on calibrating the values against the commercial devices and implement the filtering techniques.


The following code is used to run the 2 I2C devices that will be used in the final build:

#include <Wire.h>
#include "Adafruit_SI1145.h"
#include <Adafruit_MLX90614.h>
#include "Nicla_System.h"

Adafruit_SI1145 uv = Adafruit_SI1145();
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  nicla::begin();
  Serial.begin(9600);
  Serial.println("Adafruit SI1145 test");
  if (! uv.begin()) {
    Serial.println("Didn't find Si1145");
    while (1);
  }

  Serial.println("OK!");
  while (!Serial);
  Serial.println("Adafruit MLX90614 test");

  if (!mlx.begin()) {
    Serial.println("Error connecting to MLX sensor. Check wiring.");
    while (1);
    };
}

void loop() {
  Serial.println("===================");
  Serial.print("Vis: "); Serial.println(uv.readVisible());
  Serial.print("IR: "); Serial.println(uv.readIR());
  
  // Uncomment if you have an IR LED attached to LED pin!
  //Serial.print("Prox: "); Serial.println(uv.readProx());

  float UVindex = uv.readUV();
  // the index is multiplied by 100 so to get the
  // integer index, divide by 100!
  UVindex /= 100.0;  
  Serial.print("UV: ");  Serial.println(UVindex);

  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");

  Serial.println();

  delay(1000);
}


7 views0 comments

Recent Posts

See All
bottom of page