Thermal infrared camera for an alarm?

Hey guys I'm new here and I'm working on my first project. I want to create an alarm clock that will shut off only when the camera doesn't sense any heat signatures in view. My goal is to have the camera looking towards the bed and when the alarm goes off it would only be able to shut off if the person leavers the bed. Looking for an appropriate sensor that would the best for this project. Appreciate the help in advance.

check - http://www.instructables.com/id/Build-an-Arduino-based-thermal-scanner/ -

http://no.mouser.com/new/omronelectronics/omron-d6t/
Measure temp at at several points wihtin an area. 'perfect' for detection presence/absence of humans
Easy to use

Hey! Were you able to make the thermal sensor work with the Arduino? I bought one of these sensors and have been struggling with them. On running an i2c scanner program it fails to find any i2c device. Please help :frowning:

Which I2Scanner?
what does it print?
Did you use pull up resistors on the DTA /SCL lines?

This code is not tested, but very close.

// NOT tested !, but a guess
#include <Wire.h>
// #include <WireExt.h>

#define D6T_addr 0x0A
#define D6T_cmd 0x4C

byte rbuf[19];
float temp[9]; // amb + 8 temp_readings

void setup()
{
Wire.begin();
Serial.begin(9600);
// pinMode(17,OUTPUT); // this is a trick to feed power from I/O -lines
// digitalWrite(17,HIGH);
// pinMode(16,OUTPUT);
// digitalWrite(16,LOW);
}

void loop()
{
int i;
Wire.beginTransmission(D6T_addr);
Wire.write(D6T_cmd);
Wire.endTransmission();
Wire.requestFrom(D6T_addr,19);
for (i = 0; i < 19; i++) rbuf = Wire.read(); // if sensor is slow, and this wont work.
/* OR

  • for (i = 0; i < 19; i++)*
  • {*
  • while (!Wire.available()); // wait for data to arrive*
    _ rbuf = Wire.read(); // then read it to buffer_
    * }*
    */
    * // assemble 9 temperatures (*
    for (i=0; i<9; i++) temp_=(rbuf[(i2)]+(rbuf[(i2+1)]<<8))0.1;
    // printout ?
    }[/quote]*_

@knut_ny, were you able to get any result?
The following website contains the code for D6T-44 version

I have tried the code out on my Arduino Due (with modification) but did not manage to get any meaningful data out of it.
The following is my code

#include <Wire.h>

#define D6T_addr 0x0A
#define D6T_cmd 0x4C

int rbuff[35];
float tPTAT;
float tP[16];
int c;

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

void loop() {
  read_D6T();
  
  Serial.print("tPTAT: ");
  Serial.println(tPTAT);
  Serial.print("tP: ");
  for (int i=0;i<16;i++) {
    Serial.print(tP[i]);
    if(i==15) 
      Serial.println();
    else 
      Serial.print(", ");
  }
  Serial.println(); 
}

void read_D6T() {
  int i = 0;
  
  Wire.beginTransmission(D6T_addr);
  Wire.write(D6T_cmd);
  Wire.endTransmission();
  Wire.beginTransmission(D6T_addr); 
  Wire.requestFrom(D6T_addr, 35);
  while(Wire.available()){
    c = Wire.read();
    rbuff[i] = c;
    i++;
  }
  Wire.endTransmission();
    
  tPTAT = (256*rbuff[1]+rbuff[0])*0.1;
  for(i=0;i<16;i++) {
    tP[i] = (256*rbuff[2*i+3]+rbuff[2*i+2])*0.1;
  }
}

The result:

tPTAT: 0.00
tP: 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00

tPTAT: 0.00
tP: 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00

tPTAT: 0.00
tP: 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00

When I want to check the SDA line for data transfer I get this on the serial monitor

tPTAT: 6116.60
tP: 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 0.00

tPTAT: 6116.60
tP: 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 6116.60, 0.00

The oscilloscope does not show any data transfer but just a flat line
Anyone else has any luck?

Wire.requestFrom(D6T_addr, 35);
  while(Wire.available()){
    c = Wire.read();
    rbuff[i] = c;
    i++;
  }
  Wire.endTransmission();

If I recall correctly the internal buffers of Arduino are only 32 bytes so they will not be able to capture 35 bytes…

try replace the communication with 7 blocks of 5 bytes? or 35 individual bytes?

for (int cnt = 0; cnt < 7; cnt++)
{
  Wire.requestFrom(D6T_addr, 5);
  while(Wire.available())
  {
    c = Wire.read();
    rbuff[i] = c;
    i++;
  }
  Wire.endTransmission();
}

Or adapt the wire lib to have a 64 (or 40) byte buffer.

see reply 9 here
http://forum.arduino.cc/index.php?topic=212749.msg1731374#msg1731374

@robtillaart

Thanks for the tip. It seems that in the Japanese site they were using a library called WireExt which allows Arduino to cleverly take in 32 bytes or more of data.

This is the website which contains the WireExt library (which is also in Japanese):
http://fenrir.naruoka.org/archives/000773.html

Scrolling down to the end of the blog post, the author has placed the links to the WireExt.cpp, WireExt.h and keywords.txt.
It is not in the standard way to import self-made libraries.

I will be trying it out.

@knut_ny thanks for the reply

Latest updates: The WireExt library is for the Atmel chips and not for ARM chips.
Error encountered:
fatal error: avr/io.h: No such file or directory

After changing the above to Arduino.h another error occured:
fatal error: compat/twi.h: No such file or directory