DT6-1A-01 I2C Arduino UNO code (seat occupancy detection)

Hello,
I need to write some code for Omron DT6-1A-01 thermal MEMS sensor. I have almost zero skill in coding but i found some codes for these types of application with this sensors (but very few).
I would like to ask, if i need use pull ups resistors or not, how to modify existing code.
Program should work like this:
Sensor measure temp and LED will light up if temp is in some values interval.

Simple code looks like

#include “OmronD6T.h”

OmronD6T sensor;

void setup() {
Serial.begin(9600);
}

void loop() {
sensor.scanTemp();
Serial.println("-------------------------");
int x, y;
for (y = 0; y < 4; y++){
for (x = 0; x < 4; x++){
Serial.print(sensor.temp[y]);
Serial.print(’ ');
}
Serial.println("");
}
delay(1000);
}

Output is like
1100.90 -76.40 1284.90 1024.10
230.40 0.00 -2377.30 25.60
34.60 33.10 33.90 7.40
119.40 122.00 15.30 1404.00
but its always the same.

I also found some other codes but they dont work or im getting just 0 values.

I tried also code from this:

But i dont have that evaluation board and i want to use it with Arduino Uno.

Thanks for all your help and ideas.
Have a nice day!

Hi, @flylow
Welcome to the forum.

Please read the post at the start of any forum , entitled “How to use this Forum”.

To add code please click this link;

What model Arduino are you using?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :grinning: :+1: :coffee: :australia:

Hi,
I loaded the same example code and got the same results without the sensor connected.
A circuit diagram will help.

Tom… :grinning: :+1: :coffee: :australia:

Hello,
I tried that code and get this error:
Omron_D6FPH.h: No such file or directory

Diagram:
From sensor comes VCC, GND, SDA, SCL . I connected all these pins to UNO board like Vcc- 5V, GND - GND, SCL - SCL and SDA-SDA.
I can send photo if needed.
Thanks!

Hi,

Sorry that was the wrong library.

Have you got 4K7 pullup resistors on the SDA and SCL lines?

Tom… :grinning: :+1: :coffee: :australia:

Hello,
NO problem, should i delete that line?
no, i have not. I need to connect it between arduino SDA and SCL pins and wires?
thanks.

Edit:
I found some 5k resistors so i used them - connection from 5V pin to SCL and SDA wires.
But still same issues.

Hi,
Can you post a schematic please?
Can you post a picture(s) of your project so we can see your component layout?

Tom… :smiley: :+1: :coffee: :australia:

I made some schematic:

My component layout is same as in the schematic, first step for me is to get temp values from sensor. After that i will continue with next steps.
Thanks for your help

Hi,
Your schematic looks good.
Try this test code, see if my copy works.

#include "OmronD6T.h"

OmronD6T sensor;

void setup() {
  Serial.begin(9600);
}

void loop() {
  sensor.scanTemp();
  Serial.println("-------------------------");
  int x, y;
  for (y = 0; y < 4; y++){
    for (x = 0; x < 4; x++){
      Serial.print(sensor.temp[x][y]);
      Serial.print(' ');
    }
    Serial.println("");
  }
  delay(1000);
}

Tom… :smiley: :+1: :coffee: :australia:

Hello,
Thanks for reply.
I tried a code and im getting:
-1386.20 -52.20 -224.30 732.70
-430.70 -1754.50 -850.60 -429.80
2783.90 2878.90 3220.20 -326.00
-567.50 3218.50 2634.40 -1805.90

all the time, same values.

Hi,
I’m getting repeating numbers to, and I don’t have a module.
It seems to point to the fact that the DT6 is not responding.

Try this I2C scanner and see what the monitor displays.

 // --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

Tom… :smiley: :+1: :coffee: :australia:

Hello,
Thanks,
I tried:

Scanning…
No I2C devices found

Probably issue will be in the sensor. I was forced to solder wires because i dont have that small 4 pin connector, im going to check sensor again.