CubeCell i2c Sensor

I am trying to set up an MLX90614 sensor on the CubeCell however having no luck with getting any communications at all. If I do an i2c scan I can retrive the address of the sensor but it looks like that is all. Any register I try to read seems to just return FFFF

Initialy I thought that the issue was the i2c however I managed to find a BMP280 and that seems to be running OK.

The next step was to see if i could communicate directly with the MLX sensor directly using the Wire lib. Sadly the same issue.

#include “LoRaWan_APP.h”
#include “Arduino.h”
#include <Wire.h>

#define MLXADDRESS 0x5A
// RAM
#define MLX90614_RAWIR1 0x04
#define MLX90614_RAWIR2 0x05
#define MLX90614_TA 0x06
#define MLX90614_TOBJ1 0x07
#define MLX90614_TOBJ2 0x08

uint16_t ret;

void setup() {
Serial.begin(115200);
pinMode(Vext,OUTPUT);
digitalWrite(Vext,LOW);//set vext to high
delay(500); //just to make sure the sensor has powered up

Wire.begin();
}

void loop() {
Wire.beginTransmission((uint8_t)MLXADDRESS); // start transmission to device
Wire.write((uint8_t)MLX90614_TOBJ1); // sends register address to read from
Wire.endTransmission();
Wire.requestFrom((uint8_t)MLXADDRESS, 3);// send data n-bytes read
ret = Wire.read(); // receive DATA
ret |= Wire.read() << 8; // receive DATA
Serial.println(ret, HEX);
delay(1000);
}

Does anyone have any sugestions on this?

Hi,

MLX90614 only supports SMBus (I2C) up to 100khz, and the CubeCell only supports 400khz, so the native TwoWire isn’t going to be able to talk to it.

The MLX90614 does go down to 10khz, so you could probably bit-bang SMBus as that speed. Similar to what this person did on STM32: https://github.com/DamnDeadlift/GY-906_mlx90614_STM32_STDLIB/blob/master/src/mlx90614.c

2 Likes

Thanks @MikeNZ I will give that a try. There was a function in the I2C lib that allows you to drop the i2c down to 100khz but that still did not seem to return the data so will try and bitbang it.
With luck this also may work on the mlx90640

Hi,
the set_datarate function has been internally disabled (see in the library code…).
I suppose, Heltec has to give us some advise hoe to reprogram the peripheral clock, or just deliver a new default of 100khz.

BR
Marc

Hopefully th ability to set the datarate will come back as although bitbanging will work its not ideal given that there are other sensors and devices to be connected to the unit.

Hi,
Don’t know if this is still current, but probably this is the same issue as: [SOLVED] Can't read I2C registers

Heltec send a I2C STOP and then I2C START … MLX90640 expects a I2C REPEATED START (See MLX90640 specification figure 5).

Kind regards,
Dario