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:

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.

It checks out. Ready to program at this point.

Ready to add 6 wires to the IR thermometer.

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.

  1. Power labeled “V” on the PCB
  2. Ground labeled “G” on the PCB
  3. Clock labeled “C”
  4. Data labeled “D”
  5. Measure button labeled “Tp1″
  6. Mode button labeled “A”

Click on image to enlarge

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.

IR41.zip

Finished


Screen Shot - 2 Hz update rate

Posted on May 3, 2010 at 5:53 pm by admin · Permalink
In: IR Sensor · Tagged with: , ,

3 Responses

Subscribe to comments via RSS

  1. Written by Ross McKenzie
    on August 1, 2010 at 5:55 am
    Permalink

    Hi Dave,

    Have recently obtained a couple of IR thermometers through a friend in Spokane to be able to emulate your efforts. I notice in one of the photos that you have a resistor bridging between the two CR2032 battery connections, but do not record this in your schematic.

    Care to discuss?

    Best wishes,

    Ross
    Melbourne Australia

  2. Written by Anonymous
    on August 10, 2010 at 7:56 pm
    Permalink

    Ross – The resistor in the picture is not needed in the final design. It should be left out of your device. – Dave

  3. Written by admin
    on August 12, 2010 at 5:37 pm
    Permalink

    Hi Ross,

    As fare as I know you are the only person who is trying to duplicate my work with the IR thermometers. I would like to hear your feedback. Would you care to share?

    Best Regards,
    Dave

Subscribe to comments via RSS

Leave a Reply