antiElectron
Published © CC BY

Arduino Based IR Thermometer with TFT Display and TMP006

Just a simple infrared thermometer.

BeginnerFull instructions provided1 hour6,134
Arduino Based IR Thermometer with TFT Display and TMP006

Things used in this project

Hardware components

Adafruit TMP006
×1
Arduino Pro Mini 328 - 3.3V/8MHz
SparkFun Arduino Pro Mini 328 - 3.3V/8MHz
×1
2.2" LCD TFT (ILI9341) - 4 wire SPI
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

TMP006 infrared thermometer

Arduino
/*
HARDWARE CONNECTIONS
PROMINI   ILI9341
PIN       PIN

GND       -->  GND
VCC(3.3)  -->  VCC
10        -->  CS
8         -->  RESET
9         -->  D/C
11        -->  SDI(MOSI)
13        -->  SCK
VCC(3.3)  -->  LED
12        -->  SDO(MISO)

PROMINI   TMP006
PIN       PIN

GND       -->  GND
VCC(3.3)  -->  VCC
A5        -->  SCL
A4        -->  SDA

*/


#define SDA_PORT PORTD
#define SDA_PIN 3   //define the SDA pin         
#define SCL_PORT PORTD
#define SCL_PIN 2   //define the SCL pin

#include <Average.h>
#include "SPI.h"
#include "ILI9341_due_config.h"
#include "ILI9341_due.h"
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_TMP006.h"

Adafruit_TMP006 tmp006;
/*
#include "Arial_bold_14.h"
#include "SystemFont5x7.h"
#include "Verdana_digits_24.h"
#include "fixednums8x16.h"
#include "fixednums15x31.h"
#include "roboto32.h"
#include "jokerman_255.h"
*/
#include "roboto32.h"
#include "allFonts.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#define TFT_MOSI 11
#define TFT_CLK 13
#define TFT_RST 8
#define TFT_MISO 12

ILI9341_due tft = ILI9341_due(TFT_CS, TFT_DC, TFT_RST);

float tobj = 0;
float tobjavg = 0;
char tobjf[8];
float tamb = 0;
float tambavg = 0;
char tambf[8];

// Color set
#define  BLACK           0x0000
#define RED             0xF800
#define GREEN           0x07E0
//#define BLUE            0x001F
#define BLUE            0x102E
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define ORANGE          0xFD20
#define GREENYELLOW     0xAFE5 
#define DARKGREEN       0x03E0
#define WHITE           0xFFFF

uint16_t  color;
uint16_t  colorFONDO = BLACK;

Average<float> avetobj(10);
Average<float> avetamb(10);

void setup()
{
  tmp006.begin();
  tft.begin();
    tft.fillScreen(BLUE);
    tft.setTextColor(WHITE, BLUE);
   tft.setFont(SystemFont5x7);
    tft.setTextScale(3);
    
    tft.printAt("Tobj", 0, 10);
    tft.printAt("Tamb", 0, 50);
    tft.printAt("C", 210, 10);
    tft.printAt("C", 210, 50);
    tft.setArcParams(100);
}

void loop()
{
tobj = tmp006.readObjTempC();
tamb = tmp006.readDieTempC();

  avetobj.push(tobj);
  tobjavg = avetobj.mean();

  avetamb.push(tamb);
  tambavg = avetamb.mean();

  dtostrf(tobjavg,5, 2, tobjf);
  dtostrf(tambavg,5, 2, tambf); 


  tft.printAtPivoted(tobjf,100,10, gTextPivotTopLeft);
  tft.printAtPivoted(tambf,100,50, gTextPivotTopLeft);
//tft.fillArc(120, 200, 40, 10, 0, tobjavg, WHITE);
 delay(100);
}

Credits

antiElectron

antiElectron

20 projects • 115 followers

Comments