Low cost Thermal IR Sensor for AVR microcontroller
May 1, 2010

Overview: I needed a temperature sensor to monitor battery temperatures while they were being charged. I happened to have one of these IRTs (Infrared thermometers) from Harbor Freight Tools sitting by my bench. They cost about $20 USD. I thought it would be fun to use an IR sensor for this purpose. After a little probing around inside I found that the device had clock and data test points that were sending out data when ever the measure button was pressed. It took a couple of days to figure out the data format but it turns out to be pretty straight forward. The device sends out the ambient and inferred temperatures at about 2Hz. The response time of the IR output is very good. If I put my hand in front of the sensor the numbers change immediately. So using an Atmel ATMEGA168 and a small program written using Bascom I put together this temperature monitoring solution. I will show the interface and code to implement an IR and ambient temperature sensor with a serial IO.
Infrared thermometer:
Some of the specs:
- Measurement range -33 to +110 degC
- Resolution 0.1 degC
- Accuracy +-2 degC
- Field of view 1:1
- Emissivity 0.95 fixed
I purchased mine at harborfreight.com but they seem to be manufacture in China by ZyTemp.com (model TN105C is my guess). So maybe you can find them elsewhere as well.
When power is first applied the clock must be set before it will measure temperature. So I wired the two buttons to the uC so that I can trick the devise into thinking the clock has been set. Once in it’s normal operating mode the device is ready to measure Inferred temperature. When the measure button is pressed (by software in this case) it sends out 40 bit packets of data containing the IR and ambient temperatures continuously until the button is released.
Another nice feature is that if the measure button is released for more than 15 seconds the device goes into low power mode. If the uC is also put into powerdown then the total current of the device and uC is about 65 micro Amps. And because the IRT wakes up every 30 seconds and sends a packet with the ambient temperature it makes a nice low power temperature logger.
Microcontroller board: I start by building a basic microcontroller board. Most of my designs start with a ATmega88 , ATmega168 or ATmega368. I had a mega168 on hand so that’s what is used here. Most of my designs also use a prototype board as shown here. The board in the next two pictures takes less than an hour to build and cost about $6 USD to complete. The pictures show the board before the IRT connections were added. Wiring is simplified because I use the on chip oscillator and a boot loader so none of the ISP wiring is needed. You will need a way to program the the boot loader on to the chip before it can be used in this way however. I also use a separate USB to TTL serial converter for programing so that is not needed on board.
Before plugging in the microcontroller or making connections to the IRT the board should be tested. Apply power (3 volts in this case) and check that power at the uC socket is correct. Then install the microcontroller and test serial connections by uploading a small test program. If all checks out then continue to connect up the IRT.
Connections to IRT: I connect to the IRT with six wires through a six contact connector salvaged from a printer. The connection points are conveniently labeled on the PCB of the IRT.
- Power labeled “V” on the PCB
- Ground labeled “G” on the PCB
- Clock labeled “C”
- Data labeled “D”
- Measure button labeled “Tp1″
- Mode button labeled “A”
The IRT circuit is very low power. I powered the IRT from one of the uC output pins so it could be turned on and off from software. This is handy for resetting the device and getting it to a known state.
Files:
Here is the bascom code and schematic. The code is small enough to compile with the demo version of Bascom.
In: IR Sensor · Tagged with: avr, bascom, Inferred Sensor





