Home > Electronics, Embedded System, Microcontroller, Robotic, Sensor > Coding TPA81 Thermopile Array With C

Coding TPA81 Thermopile Array With C

Sensor thermalThe TPA81 is a thermopile array detecting infra-red in the 2um-22um range. This is the wavelength of radiant heat.
The Pyro-electric sensors that are used commonly in burglar alarms and to switch on outside lights, detect infra-red
in the same waveband. These Pyro-electric sensors can only detect a change in heat levels though – hence they are
movement detectors. Although useful in robotics, their applications are limited as they are unable to detect and
measure the temperature of a static heat source. Another type of sensor is the thermopile array. These are used in
non-contact infra-red thermometers. They have a very wide detection angle or field of view (FOV) of around 100°
and need either shrouding or a lens or commonly both to get a more useful FOV of around 12°. Some have a built
in lens. More recently sensors with an array of thermopiles, built in electronics and a silicon lens have become
available. This is the type used in the TPA81. It has a array of eight thermopiles arranged in a row. The TPA81 can
measure the temperature of 8 adjacent points simultaneously. The TPA81 can also control a servo to pan the
module and build up a thermal image. The TPA81 can detect a candle flame at a range 2 metres (6ft) and is
unaffected by ambient light!

Source Code control of TPA81:
#include
#include
#include
// I2C Bus functions
#asm
.equ __i2c_port=0x1B ;PORTA
.equ __sda_bit=1
.equ __scl_bit=0
#endasm
#include
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x12 ;PORTD
#endasm
#include
unsigned char Msg1[16];
unsigned char Msg2[16];
// Declare your global variables here
int data,i;
unsigned char reg,revision,ambient,pixel[8];
void TPA_read()
{
delay_ms(40); //wait for 40mS to get accurate reading
i2c_start();
i2c_write(0xD0);
i2c_write(reg);
i2c_start();
i2c_write(0xD1);
data=i2c_read(0);
i2c_stop();
}
void main(void)
{
.
.
.
// I2C Bus initialization
i2c_init();
// LCD module initialization
lcd_init(16);
while (1)
{
// Place your code here
reg=0x00;
TPA_read();
revision=data;
reg=0x01;
TPA_read();
ambient=data;
for (i=0;i<8;i++) {
reg=reg+1; // reg=0x02,0x03,…,0x09
TPA_read();
pixel[i]=data;
}
sprintf(Msg1,”%3d %3d %3d %3d”,pixel[0],pixel[1],pixel[2],pixel[3]);
sprintf(Msg2,”%3d %3d %3d %3d”,pixel[4],pixel[5],pixel[6],pixel[7]);
lcd_gotoxy(0,0);lcd_puts(Msg1);
lcd_gotoxy(0,1);lcd_puts(Msg2);
};
}

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: