Hello Fellow Arduino Lovers,
I am working with Omron D6T sensors (D6T-1A-01) and an Arduino Uno R3. This sensor has a 16 pixel sensor array. Using the Wire library, I am only getting valid data for the reference temp (the first two bytes) and the first pixel's temp reading (third and fourth byte). All other bytes are invalid. I have two such sensors, from different suppliers, both behaving in this way.
Does anyone have any ideas on what might be going on?
My sketch.
#include <Wire.h>
#define D6T_addr 0x0A // Address of OMRON D6T is 0x0A in hex
#define D6T_cmd 0x4C // command to start up the Omron
int rbuf[35]; // a buffer for D6T data; returns 35 bytes.
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial);
}
void loop()
{
//kick off the comms with the D6T by writing a command to its internal buffer
Wire.beginTransmission(D6T_addr);
Wire.write(D6T_cmd);
Wire.endTransmission();
int i;
//using Wire lib to read >32 bytes requires modifying the library to use its 64 byte buffer
//otherwise, it will silently replace 35 with 32
//Wire.requestFrom() will either return zero, or the number of bytes received.
//for this demo, 32 bytes is plenty; the issue starts occuring with i == 4;
int byteCount = Wire.requestFrom(D6T_addr, 35);
if (byteCount > 0) {
//put data into a read buffer
for (i = 0; i < 35; i++) {
rbuf[i] = Wire.read();
}
printBuffer();
} else {
Serial.println("ERROR! Unable to get data from I2C.");
}
//printTemps();
}
void printBuffer() {
for (int i = 0; i < 35; i++) {
Serial.print(rbuf[i]);
Serial.print(" | ");
}
Serial.println();
}
And what I get back, with either sensor:
15 | 1 | 248 | 0 | 218 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | 255 | -1 | -1 | -1 |
Obviously we are not concerned with the -1's, as we're not getting those last bytes (I use WireExt for that). It's all the 255's that I'm concerned with. I've used Wire lib for simplicity here.
I am attaching this sensor to a breadboard using Omron's harness, and using 5kΩ pullup resistors. I've attached my wiring diagram.
Any ideas or pointers would be greatly appreciated!