0% found this document useful (0 votes)
10 views5 pages

Uk 2011020481

Uploaded by

HecOs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Uk 2011020481

Uploaded by

HecOs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

INFRARED THERMOMETER

Contactless Thermometer
Are you running an infrared temperature?
By Christian Tavernier (France)

It’s easy these days to find


several cheap sensors for
contactless thermometers, also
called infrared thermometers.
These sensors, which measure
the infrared radiation from
objects, make it possible to
build a contactless thermometer
yourself with performance
easily as good as its commercial
counterparts.

Technical
specifications
• Infra-red detecting thermometer
• PIC16F876A microcontroller
• Four line × 20 character LCD display
• Displays ambient and object
temperatures
• Stores minimum and maximum
temperatures
• Runs off two 1.5 V cells
• Open-source software

Our thermometer measures at the same mometer automatically remembers the This IC, which comes in a metal TO-39 pack-
time both the ambient temperature and the maximum and minimum temperatures of age with a window, should not be regarded
temperature of any object placed within its objects, and displays everything on a backlit as just any old temperature sensor, like a
‘field of view’. And even though the ambi- LCD display with four lines of 20 characters. thermistor, for example, as it includes a
ent temperature range ‘only’ goes from −40 Thanks to the sensor used, it only needs two whole load of processing and shaping cir-
to +125 °C, the object temperature can be ICs: a perfectly ordinary PIC microcontroller cuitry (Figure 1).
from −70 to +380 °C, and all with an accu- and a switching regulator to power it. The sensor proper is an infrared thermopile
racy of 0.5 °C and a measurement resolu- (or two, depending on the IC version) that
tion of 0.02 °C. MLX90614 sensor delivers a very low, non-linear signal which
In order to be self-contained and portable, The sensor we’ve chosen is the MLX90614 would thus be difficult to use directly. This
it runs off batteries or rechargeable cells, from Melexis, and it’s this that gives our signal is first amplified by a chopper-stabi-
and for even greater convenience, our ther- thermometer its excellent performance. lized opamp. It is then converted to digi-

48 02-2011 elektor
INFRARED THERMOMETER

OPA ADC DSP PWM

tal in a delta-sigma type converter before 81101 STATE MACHINE


being applied to a digital signal processor
(DSP). After noise filtering and sensor sig-
Voltage
nal processing performed by this DSP, the Regulator
90302
temperature information is available in a
directly-usable digital form. 100707 - 12

To simplify interfacing, the sensor can pro-


vide this information via a 2-wire SMBus
(virtually identical to the I²C) or in the form Figure 1. Internal block diagram of the MLX90614 sensor.
of a PWM (pulsewidth modulated) signal.
Although the latter mode does make it
simpler to connect up the MLX90614, the 1 7 1 1 8 1 1 7 1 1
PWM signals are trickier to process than
S Slave Address Wr A Command A Sr Slave Address Rd A
those from the SMBus. What’s more, the
resolution in PWM mode is only 0.14 °C, as
against 0.02 °C in SMBus mode.
Depending on the version, this IC runs off a 8 1 8 1 8 1 1
single power rail of either 3 V or 5 V, so you Data Byte Low A Data Byte High A PEC A P
need to pay great attention to which 100707 - 13
type you’ve got before fitting it into
this circuit — we nearly learnt the
hard way… Figure 2. Principle of one of the sensor’s RAM read frames.

Talking to the sensor


If we decide to communi- Table 1. The main commands for reading the temperatures.
cate with the sensor in Command Code (hexadecimal)
SMBus mode — which Raw ambient temperature 0x03
is what we’ve done
Temperature, IR sensor 1 0x04
in our thermometer
— the syntax to be Temperature, IR sensor 2 0x05
used is relatively Linearized ambient temperature 0x06
simple, provided Linearized sensor 1 temperature 0x07
we don’t want to
Linearized sensor 2 temperature 0x08
modify the internal
parameters, which are
factory-set but perfectly suit-
able for our needs. To read the ambient we call the 15-bit word output N, and given fortunately PIC microcontrollers with an I²C
temperature and the temperature of the the sensor resolution in SMBus mode, the interface are able to handle, as long as we
objects the sensor is aimed at, all you have measured temperature T expressed in K is correctly program one bit in one of the con-
to do is read from two different locations given by: trol registers in their MSSP interface.
in its internal RAM, which is done using an T = 0.02 × N
SMBus frame similar to the one in Figure 2. Thermometer circuit
After sending the sensor its slave address, But as it’s more user-friendly to read a tem- Clearly, the sensor’s high degree of integra-
all you then have to do is send it a com- perature in degrees centigrade (Celsius), tion simplifies the circuit of our thermome-
mand, chosen from those proposed in the thermometer software simply uses the ter, which can therefore be based on a sim-
Table 1 as far as temperature measure- formula: ple PIC microcontroller, as long as it has an
ment alone is concerned. Sending its slave T = 0.02 x N − 273.15 I²C interface. Here the 16F876A was chosen.
address again then lets you receive back
two bytes containing the LSB and MSB of If you’re not familiar with the SMBus, don’t As shown in Figure 3, our PIC is used in
the temperature, followed by a check poly- worry, it’s 99 % identical to the better- crystal clock mode (20 MHz) and has a
nomial, marked PEC in Figure 2, which we known I²C bus. It only differs in a few sub- manual reset command via the button S1,
won’t be using here. tleties in the protocol, which are unimpor- included to allow the memories containing
The temperatures, expressed in Kelvin, are tant here, and by a small difference in terms the maximum and minimum temperatures
represented by unsigned 15-bit words. If of the electrical levels; a difference that very to be reset.

elektor 02-2011 49
INFRARED THERMOMETER

COMPONENT LIST
Resistors (0.25W 5%)
R1,R4,R6 = 10kΩ
R2, R5 = 100Ω
R3 = 1.5kΩ
P1 = 10 kΩ trimpot, horizontal

Capacitors
C1,C3 = 100μF 16V, radial, lead pitch 2.5mm
C2 = 470nF 63V, MKT, lead pitch 5 or 7.5mm
C4 = 10μF 25V, radial, lead pitch 2.5mm
C5, C8 = 22pF ceramic, lead pitch 0.2’’
(5.08mm)
C6 = 100nF ceramic, lead pitch 5 or 7.5mm
C7 = 10nF ceramic, lead pitch 5 or 7.5mm

Inductors
L1 = 10μH, Panasonic type ELC08D100E (RS
Components)

Semiconductors
IC1 = LT1300 Miscelllaneous Pinheader pins, lead pitch 0.1’’ (2.54mm)
IC2 = PIC16F876A-I/SP, programmed, Elektor LCD1 = LCD, 4 lines of 20 characters, e.g. Dis- Pinheader sockets, lead pitch 0.1’’ (2.54mm)
# 100707-41 playtech 204A PCB, Elektor # 100707-1
IC3 = Sensor type MLX90614ESF-BAA or MLX- X1 = 20MHz quartz crystal, HC18/U case
90614ESF-AAA (see text) S1 = pushbutton, 1 make contact, ITT type D6
D1 = 1N5817 (must-have Schottky) if fitted on PCB
D2 = 3.3V 0.4W zener diode S2 = swich, changeover, or wire link
DIL IC sockets: 1 pc 8-way; 1 pc 28-way

The display used is an LCD type, with or visible, which is a bit of a shame. The display cells (or two 1.2 V NiMH rechargeables) by
without backlight as you prefer, depend- is used in 4-bit mode, driven from port B of way of the LT1300 switching step-up DC-DC
ing on whether or not switch S2 is closed the microcontroller. converter. This IC provides a stabilized 5 V
(or a link is fitted). Ideally, you should use output from any input voltage between 2
a perfectly standard type with four lines The two bus lines coming from the sensor and 5 V. It is capable of supplying a current
of 20 characters, but the circuit also works terminate at RC4 and RC3 of the PIC respec- of 400 mA, i.e. a great deal more than is
with a pin-compatible two-line, 16-charac- tively, the inputs to parallel port C, which needed for our thermometer.
ter type. In this instance, the two lines dis- are shared with its internal I²C interface. Although the sensor does exist in a 5 V
playing the minimum and maximum are not The circuit is powered at 5 V from two 1.5 V version, the most readily available at the

50 02-2011 elektor
INFRARED THERMOMETER

moment is the 3 V version. This explains temperature and 0x07 for the
the reason for resistor R2 and its associated temperature of the object);
zener diode (D2). Note here that the SMBus • send a repeated start signal;
load resistors R4 and R6 are returned to the • send the IC’s slave address, this time
5 V rail all the same, in order to guarantee with Read mode selected (R/W = 1);
correct electrical levels at the PIC input. But • receive a series of three bytes: the LSB
there’s no risk to the MLX90614, as it has and MSB of the temperature, then the
internal limiting diodes. PEC (not used in our application);
• send a stop signal to terminate the I²C/
Software SMBus transaction;
The software (copiously annotated source • and finally, reconstruct the 15-bit
code and HEX file) is available for free down- word containing the temperature
loading from [1] and [2]. It has been written by concatenation of the two bytes
in MikroBasic from Mikroelektronika, which received.
has the advantage of having available a per-
fectly functional I²C library. Note that the We’ll leave you to analyse the rest of our
size of the compiled software is over 2 KB program with the help of our copious notes,
and so it can’t be compiled using the demo and move on to the practical aspects of
version of this compiler. construction.

Judging by the content of the Internet Construction


forums devoted to the MLX90614, some With the aim of simplifying the mechanical the MLX90614ESF-BAA. The letter B indi-
users seem to have encountered difficulties, side of building the thermometer, we’ve cates that it runs on 3 V. If you come across
so we thought it would be worth comment- designed a PCB the same size as the dis- an MLX90614ESF-AAA, this is a 5 V version
ing here on the relevant section of code. play board, so it can be mounted on the that can still be used in our circuit, but in
back of it. that case you’ll need to remove D2, C4, and
The procedure for reading the temperature C7, and replace R2 by a wire link.
is called using the parameter ‘com’ for the Sourcing the components should not pre- Note that L1 must be capable of carrying a
chosen command. The procedure then scru- sent any problem. The display used is a Dis- current of 800 mA without saturating. Oth-
pulously adheres to the instructions from playtech 204A, but in theory at least any erwise the LT1300 will work very badly, or
Melexis, namely: 4 line × 20 character LCD display using a not at all.
standard interface (ST7066, HD44780, or
• send a start signal to start the I²C/SMBus KS066 controller) will do, as well as any 2 The sensor can be remoted to the case via
transaction; line × 16 character LCD display, as indicated the four connecting pins provided for the
• send the IC’s slave address (Melexis above, albeit with the loss of the min. / max. purpose, but to avoid possible interference
specifies in the data sheet that all the ICs display. and distortion of the SMBus signals, it’s
respond to the address 0x00) with Write preferable not to extend its connections
mode selected (R/W = 0); The MLX90614 exists in numerous versions, more than a few tens of cm.
• send the command contained in the distinguished by the part number suffixes.
variable ‘com’ (0x06 for the ambient The commonest and cheapest version is We fitted 2.54 mm (0.1”) pitch sockets on
the back of the display and pins at the same
pitch on the copper side of the PCB. In this
Sub procedure Read_temp(dim com as byte) way, you can produce an assembly that’s
I2C1_Start() ‘ issue I2C start signal easy to remove in the event of problems.
I2C1_Wr(0x00) ‘ send address (device address + W)
I2C1_Wr(com) ‘ send command Use and adapting
I2C1_Repeated_Start() ‘ issue I2C signal repeated start to your own needs
I2C1_Wr(0x01) ‘ send address (device address + R) The thermometer operates as soon as
SensorLow = I2C1_Rd(1) ‘ Read temp. low byte (acknowledge) power is applied, and the first line of the
SensorHigh = I2C1_Rd(1)‘ Read temp. high byte (acknowledge) display gives you the ambient temperature,
PEC = I2C1_Rd(1) ‘ Read PEC (not used)
i.e. that of the sensor case. The second line
I2C1_Stop() ‘ issue I2C stop signal
shows the temperature of the object the
SensorRaw = SensorLow + (SensorHigh << 8) ‘ Build temp. word
sensor is pointing at, i.e. the average of the
End sub
temperatures of the objects in the sensor

elektor 02-2011 51
INFRARED THERMOMETER

The maximum and minimum object tem- bration parameters, rendering any subse-
peratures are stored automatically, and quent measurements inaccurate.
display on the last two lines of the display. (100707)
They are updated at the same time as the
measurements, which take place once per Internet Links
second.
[1] www.elektor.com/100707

To reset the minimum and maximum, all [2] www.tavernier-c.com


you have to do is press the reset button.
Can also be read without contact, but using
You can adapt the software to your own
a mobile phone.
needs and make the thermometer behave
quite differently. However, if you want to
modify the procedure that handles the
window’s field of view. The angle of view of communication with the sensor, only do so
the standard version (MLX90614ESF-XAA) if you really know what you’re doing, as it is
is not stated. For the MLX90614ESF-XAC it possible to write to it, and incorrect writing
is 35°, and 10° for the MLX90614ESF-XAF. may destroy or modify its factory-set cali-

LCD1

L1
LC DISPLAY
10uH
D1
VDD
VSS

R/W
VO
RS

D0
D1
D2
D3
D4
D5
D6
D7
A
+3V

K
E

C3 C6
6 7 1N5817 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
V IN IC1 SW
2 4 100u 25V 100n
SELECT SENSE S2
R6 R4 R2 R1
3 LT1300 5
SHDN I LIM
BACKLIGHT
100R
10k

10k

10k

20
GND PGND
R3 VDD R5
1 8 1 P1
1k5 MCLR 100R
21 10k
IC2 RB0
2 22
RA0/AN0 RB1 CONTRAST
3 23
C1 S1 C2 RA1/AN1 RB2
4 24
RA2/AN2 RB3
IC3 5 25
100u 470n RA3/AN3 RB4
RESET
25V MXL90614 3 6 26
RA4/TOCKI RB5
VDD 7 27
RA5/AN4 RB6
4 2 28
VSS SDA
PIC16F876A RB7
SDA 15
RC4/SDA
SCL SCL 14 16
RC3/SCL RC5/SDO
1 13 17
RC2 RC6/TX
12 18
RC1 RC7/RX
K1 11
SCL RC0
SDA VSS OSC1 OSC2 VSS
VDD 8 9 X1 10 19
VSS
D2
C4 C7
C5 20MHz C8

10u 10n
3V3 25V 22p 22p

400mW 100707 - 11

Figure 3. Complete circuit of the contactless thermometer.

52 02-2011 elektor

You might also like