I2C read outputting constant 255 with Omron D6T

Hi, I am trying to read temperature values from a D6T-44L Thermal IR sensor, but the Wire.read() data returns a constant 255 value. I am powering the sensor through the VIN pin (5V) and have 10k ohm pull up resistors going to the SDA and SCL pins. The Code snippet below shows how I setup getting the data from the senor:

//Wire address 10
Wire.beginTransmission(10);
//ask sensor to begin sensing 0x4C
Wire.write(76); 
Wire.endTransmission(true);

//request Data from address 10, 35 bytes long
Wire.requestFrom(10,35);

First thing you should do in such circumstances is to check whether the I2C client can actually be found at that address.

The simplest way to do that is by running a bus scanner sketch like this
https://go.particle.io/shared_apps/58cda34c77e5d3ec090004fe

You may also try stronger pull-ups (e.g. 4k7).

Just to make sure: You have the Electron powered off of USB or via a 5V supply on Vin?
With the LiPo alone Vin will not source any power.

1 Like

Thank you for the help! Using the BUS scanner I found I had the SCL and SDA wires switched.

1 Like

I have another question pertaining to this if you don’t mind. I finally got values and everything, but the last 3 bytes of the message are still reading 255. Am I cutting off the bus too early? The sensor should be sending 35 bytes of information, but when I check Wire.available() I only get 32.

The default I2C buffer is only 32 bytes long.
If you know your expected packets will be longer than that you should use this
https://docs.particle.io/reference/device-os/firmware/electron/#acquirewirebuffer