Introduction: A PICAXE Infrared "logging" Thermometer

About: Ray Burne is my pseudonym, I sometimes write on various Blogs and Sites. Effective 12 June 2013, Ray has decided to no longer participate as an author on Instructables. This decision was precipitated due to…
21 July Edit - See how I used the IR thermometer in my Laser Experiments!

You may already have one of those very useful IR thermometers... just point, shoot, and read the temperature.  Are they not great?  I have two. 

But, what if you want to record the temperature readings on your PC?  This Instructable will show you how to build your own IR thermometer that will log to the PC - an added benefit is that the data can be graphed in Excel or displayed in realtime using a free Shareware program called StampPlot Pro from the company SelmaWare Solutions.  The total parts costs should come under $50 but a significant amount of the purchase can be reused on your next PICAXE project.

The device communicates with the PC on a USB link.  After construction, you can easily modify the device if you desire to communicate over a free COMM port on the PC.  This will free up the USB adapter for use on another project.  After assembling everything and doing the programming and testing, I transferred the parts to a minibox and added a 5V regulator so that I could run the project from a 9V battery.

The ground-work for this PICAXE came from P.H. Anderson on and I have used his code with written permission.  The site is a great source for the PICAXE chips and for the MLX90614 IR sensor from Melexis.  Of course, there are other sources but my personal experience with ordering from has been very positive.  If you are new to PICAXE Basic programming, the site has many well documented examples on his website.

Part One : Inventory of parts and potential vendors

1) PICXE-20X2 and Protoboard    "A"
2) Melexis MLX90614                      "A"
3) 10K 1/4 watt resistor                  "*"
4) 22K 1/4 watt resistor                  "*"
5) 4.7K 1/4 watt resistor X 2          "B"

Vendor Parts List (suggested):

B     RadioShack
*      Note: The PICAXE-20X2 Protoboard includes the Protoboard, the PICAXE chip, pullup resistors, and USB interface for one price.

Part Two: Download the free software

To program your PICAXE, you will need the free PICAXE Programming Editor from:  Just download the software and install on your PC.  Your protoboard and PICAXE will come programmed with a simple test program to ensure that everything is working correctly... the test program simply flashes the red LED. 

You will also need the USB driver software.  It is available here:

Part Three: Connecting the MLX90614 to power and to the PICAXE

Build the circuit on the protoboard being careful to observe the MLX90614 pinout.  A bottom-view image is included in this Instructable.  In our case (bottom-view), Pin4 is VSS which is ground for our 5V USB design.  Pin3, VDD, will be connected to +5 volts.  Both Pin1 and Pin2 have a pull-up 4.7K (yellow-violet-red) resistors that are connected to +5V.   Pin1 is connected to Pin-11 of the PICAXE and Pin2 is connected to Pin-13 of the PICAXE. 

The rest of the wiring on the protoboard can be left exactly as it was shipped.  Just ensure that you test the board when it arrives and that the red LED flashed properly.  You may find a few components that need "pushing down" into the breadboard if the unit does not come up.

Part Four: Programming the PICAXE with the temperature acquisition code

To build your thermometer, the sample code located here: must be slightly modified and I have made available the modification to the code below. Open up the Programming Editor, connect the USB cable to the PC, install the USB software driver.  Then copy the code below into an empty window in the Programming Editor and save it with a name like MLX90614.BAS.  To program your PICAXE, simply click the "Program" button in the editor.  (Hint: if you have a syntax error, you may need to paste the code into Notepad first, save it, and then load it into the Editor.)

Code is in TXT format in the attached file.  Download and rename to .BAS to utilize in the PICAXE program editor.

Part Five: Working with the PC and your thermometer

Now that you have a connection from your temperature project to the PC, you may wish to graph the data or save the data to a log file on the disk.  There are many options available, but I will discuss two simple approaches for capturing the data in text format.

1) Use the PICAXE Programming Editor "Terminal" to capture the serial output.  This project will send serial data at 2400 BAUD, no parity, 8 data bits, and 1 stop bit... (2400,n,8,1)

2) On Microsoft Windows XP, you can use the Hyper Terminal to capture data using the settings in #1

Both of the above scenarios will allow you to copy data into the OS buffer and then transfer that data to another program, such as Excel, by simply "pasting" the text in the buffer.

Another option is that you can use a free program like StampPlot Pro from SelmaWare to plot the serial data in realtime.  I used the "Calc-n-Plot" graph option of StampPlot Pro because I can add a math function into to the program which works on each received data element received from the PIC.  The data from the project is in degrees Kelvin and the last digit is the decimal place, so you must divide by 10 to recover the decimal.  You can then work with Kevin directly or convert to Celsius or Fahrenheit by simple math.

The formula for converting the Kelvin degrees (last digit of serial data is the "tens" decimal place) is:
data_K / 10 x 1.8 - 459.67 = data_F.n

In Excel, you can use the following formula to convert the serial data to degrees Fahrenheit:
=$A2/10*9/5-459.67  (assuming A2 is the first data element... A3 would be the next, etc.)

I hope you have fun with your new IR temperature recording thermometer.


20110721 - Removed inline code and reflected attached TXT file to enhance readability
20110701 - Updated to reflect new etched circuit board (negotiating for a few on eBay soon... check back)
20110701 - Updated to show new project box (Newark #H97, 9V about $5)

Microcontroller Contest

Participated in the
Microcontroller Contest