Sensor de temperatura D6T

Hola, he estado probando un sensor de temperatura de detección de presencia de personas.
El problema que tengo, es que no logro hacer que funcione.
Ya intenté un montón de cosas pero nada parece funcionar.
He revisado los diagramas de conexión de las hojas de datos, y creo que el problema está en que el código que estoy utilizando para la lectura no es correcto (intento utilizar un arduino mega)
Les dejo el código del arduino que estoy usando, el datasheet del sensor y una hoja de aplicación que encontré:

Hoja de aplicación: http://media.digikey.com/pdf/Data%20Sheets/Omron%20PDFs/D6T44L_8L_Appl_Note.pdf
Datasheet: http://farnell.com/datasheets/1712551.pdf

Código arduino:
Código:
#include <Wire.h>

void setup()
{
 Wire.begin ();
 Serial.begin (9600);
 }
 
 void loop ()
 {
 Wire.requestFrom(14,7);
 while(Wire.available ())
 {
   char c=Wire.read();
   Serial.print ("Temperatura  ");Serial.println (c);
 }
 delay(500);
 }
Les agradezco mucho su tiempo.
Saludos
 
Última edición por un moderador:
Hola, también estoy trabajando con un sensor omron d6t y grafico los valores en un lcd 20x4, la manera en la que trabaja el sensor es que genera una matriz de 4x4 con las lecturas de calor que toma.
El proveedor sugiere utilizar resistencias de 3K a 10K en cada una de las terminales de SDA y SCL hacia los 5v, ya he probado con valores de 3.3K, 5.6K, y 10K pero los valores que imprime el lcd son siempre 254 en cada elemento de la matriz tooodo el tiempo y en toda circunstancia.

Código en PIC C
Código:
#include <16F887.h>
#use delay(internal=8000000)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT                    //No Power Up Timer
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOCPD                    //No EE protection
#FUSES NOBROWNOUT               //No brownout reset
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOWRT                    //Program memory not write protected
#FUSES BORV40                   //Brownout reset at 4.0V
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#include <math.h>

#include "lcd420.c"

int D6T_adress = 0x0A;
int D6T_WRITE = 0x14;
int D6T_READ = 0x15;
int b[35];                              //Buffer para datos
int i;
int tPTAT;
int tP[16];
int tPEC;
float TPR;


int lectura_D6T() { 
   for ( i=0; i<35; i++) {
      i2c_start();               //Comienzo de la comunicación I2C ...
            
      i2c_write(D6T_adress);
      i2c_write(D6T_WRITE);        
      i2c_write(0x4C);
      i2c_start();
      
      i2c_write(D6T_adress);
      i2c_write(D6T_READ);
      b[i] = i2c_read(0);
      i2c_stop ();
      delay_us(10);  
       
      } 

      
      tPTAT = b[1] + b[0];
      tP[0] = b[3] + b[2]; 
      tP[1] = b[5] + b[4]; 
      tP[2] = b[7] + b[6];
      tP[3] = b[9] + b[8];
      tP[4] = b[11]+ b[10]; 
      tP[5] = b[13]+ b[12];
      tP[6] = b[15]+ b[14]; 
      tP[7] = b[17]+ b[16]; 
      tP[8] = b[19] + b[18];
      tP[9] = b[21] + b[20]; 
      tP[10] =b[23] + b[22]; 
      tP[11] =b[25] + b[24]; 
      tP[12] =b[27] + b[26]; 
      tP[13] =b[29] + b[28]; 
      tP[14] =b[31] + b[30]; 
      tP[15] =b[33] + b[32]; 
      tPEC = b[34];
return 1;
}

void main()
{
   lcd_init();                   //Inicialización lcd

   lectura_D6T(); //Lectura de temperaturas 
   
   setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT|T1_EXTERNAL_SYNC);      //16.3 ms overflow
   setup_timer_2(T2_DIV_BY_4,0,1);      //4.0 us overflow, 4.0 us interrupt

  
   while (1) {
              
         lectura_D6T();   
         delay_us(5); 
              
         printf(lcd_putc,"\f%u %u %u %u\n",tP[1],tP[2],tP[3],tP[4]);
         printf(lcd_putc,"%u %u %u %u\n",tP[5],tP[6],tP[7],tP[8]);
         printf(lcd_putc,"%u %u %u %u\n",tP[9],tP[10],tP[11],tP[12]);
         printf(lcd_putc,"%u %u %u %u",tP[13],tP[14],tP[15],tP[16]);
         
         
        
         
         if(TPR>=21){
         output_high(PIN_C1);
         }
         else
         {output_low(PIN_C1);
         }
       }   
}

Gracias!
 
Última edición:
Atrás
Arriba