{"id":3770,"date":"2011-10-16T14:35:23","date_gmt":"2011-10-16T18:35:23","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=3770"},"modified":"2012-11-06T13:55:01","modified_gmt":"2012-11-06T18:55:01","slug":"low-cost-temperature-data-logger-using-pic-and-processing","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/low-cost-temperature-data-logger-using-pic-and-processing\/","title":{"rendered":"Low cost temperature data logger using PIC and Processing"},"content":{"rendered":"<p>This project describes an easy and inexpensive way of adding a digital thermometer and data logging feature to a PC. It involves a PIC microcontroller that gets the surrounding temperature information from the Microchip MCP9701 sensor, and sends it to a PC through an USB-UART interface. The USB port of the PC is also used to power the device. The open-source <a href=\"http:\/\/processing.org\/\" target=\"_blank\">Processing<\/a>\u00a0 programming platform is used to develop a PC application that displays the temperature in a graphics window on the computer screen. The PC application also records the temperature samples plus date and time stamps on an ASCII file.<\/p>\n<div id=\"attachment_3916\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/LoggerTitle.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3916\" class=\"size-full wp-image-3916\" title=\"LoggerTitle\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/LoggerTitle.jpg\" alt=\"\" width=\"560\" height=\"333\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/LoggerTitle.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/LoggerTitle-550x327.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-3916\" class=\"wp-caption-text\">PC-based temperature data logger<\/p><\/div>\n<p><!--more--><strong>Theory of operation<\/strong><\/p>\n<p>This project is based on Microchip&#8217;s PIC12F1822 microcontroller from the enhanced mid-range PIC family. It has got 8-pins in total and the power supply voltage range of 1.8V to 5.5V. The microcontroller has four 10-bit ADC channels and one Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) module for serial communication. The temperature sensor used here is MCP9701A, which is a Low-Power Linear Active Thermistor IC from Microchip Technology. The range of temperature measurement is\u00a0from -40\u00b0C to +125\u00b0C. The output voltage of the sensor is directly proportional to the measured temperature and is calibrated to a slope of 19.53mV\/\u00b0C. It has a DC offset of 400mV, which corresponds to 0\u00b0C. The offset allows reading negative temperatures without the need for a negative supply. The output of the sensor is fed to one of the ADC channels of the PIC12F1822 microcontroller for A\/D conversion. The internal fixed voltage reference (FVR) module is configured to generate a stable 2.048 V reference voltage for A\/D conversion. The use of FVR module ensures the accuracy of the A\/D conversion even when the supply voltage is not stable. The PIC12F1822 microcontroller then serially transmits the 10-bit ADC output to a PC.<\/p>\n<p>Modern PCs are no more equipped with serial ports and therefore this project requires a USB-UART adapter that enables very easy connection of the PIC12F1822 to the PC via the USB port. You can get them really cheap on ebay. I bought one for $3.39 (see the picture below) from here: <a href=\"http:\/\/cgi.ebay.com\/ws\/eBayISAPI.dll?ViewItem&amp;item=370532286388\" target=\"_blank\">http:\/\/cgi.ebay.com\/ws\/eBayISAPI.dll?ViewItem&amp;item=370532286388<\/a><br \/>\nIt can be directly interfaced to the TTL input and output of EUSART module of PIC12F1822. This module also provides +5 V, +3.3 V, and ground terminals. The power supply for the microcontroller circuit is derived from the same +5 V and ground pins.<\/p>\n<div id=\"attachment_3894\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/USB_UARTmodule.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3894\" class=\"size-full wp-image-3894\" title=\"USB_UARTmodule\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/USB_UARTmodule.jpg\" alt=\"\" width=\"560\" height=\"298\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/USB_UARTmodule.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/USB_UARTmodule-550x292.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-3894\" class=\"wp-caption-text\">USB-UART module<\/p><\/div>\n<p>On PC&#8217;s side, the open source programming language Processing is used to receive the ADC output and convert it into the actual temperature. The temperature is displayed on a graphics window on the computer screen in numeric format as well as with a wall tube thermometer looking image where the level of alcohol rises with increasing temperature. A clickable Start\/Stop button also appears on the window to enable or disable the data logging.<\/p>\n<p><strong>Circuit diagram<\/strong><\/p>\n<p>The circuit diagram of this project is pretty simple. The microcontroller reads the temperature sensor&#8217;s output through RA2\/AN2 pin and convert it to a 10-bit digital number. The Tx (RA0) and Rx (RA1) port of the EUSART module are connected to the corresponding pins of the USB-UART module. The microcontroller runs at 4.0 MHz using an internal clock source. Although I have disabled the MCLR function here, you can use it for an external reset if you want.<\/p>\n<div id=\"attachment_3893\" style=\"width: 580px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_TempLogger_Ckt.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3893\" class=\"size-full wp-image-3893\" title=\"PC_TempLogger_Ckt\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_TempLogger_Ckt.jpg\" alt=\"\" width=\"570\" height=\"423\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_TempLogger_Ckt.jpg 570w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_TempLogger_Ckt-550x408.jpg 550w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><p id=\"caption-attachment-3893\" class=\"wp-caption-text\">Circuit diagram<\/p><\/div>\n<p>I soldered the above circuit (except the USB-UART adapter) on a general purpose prototyping board with a 6-pin female header connector so that it could be easily plugged into the male header pins of the USB-UART adapter (shown below).<\/p>\n<div id=\"attachment_3771\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_Logger1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3771\" class=\"size-full wp-image-3771\" title=\"PC_Logger1\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_Logger1.jpg\" alt=\"\" width=\"560\" height=\"389\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_Logger1.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PC_Logger1-550x382.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-3771\" class=\"wp-caption-text\">Microcontroller and USB-UART modules<\/p><\/div>\n<div id=\"attachment_3895\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PluggedIn.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3895\" class=\"size-full wp-image-3895\" title=\"PluggedIn\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PluggedIn.jpg\" alt=\"\" width=\"560\" height=\"163\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PluggedIn.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/PluggedIn-550x160.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-3895\" class=\"wp-caption-text\">Two modules plugged into each other<\/p><\/div>\n<p><strong>Software<\/strong><\/p>\n<p>The firmware for PIC12F1822 is developed in C and compiled with mikroElektronika&#8217;s <em><strong>mikroC Pro for PIC<\/strong><\/em> compiler. The compiler does provide an ADC library but that uses the external supply voltage as a reference for A\/D conversion. In order to configure the FVR module to generate a fixed 2.048V for A\/D conversion, you have to write your own code for ADC operation. The ADC sample is taken every 2 sec and is sent to the PC through USB-UART module as two bytes. The complete source\u00a0code is provided below with comments. It can be compiled with the demo version of mikroC Pro for PIC compiler. Make sure that you select the internal clock source at 4.0 MHz from Project-&gt;Edit window.<\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"c\" style=\"font-family:monospace;\"><span style=\"color: #808080; font-style: italic;\">\/*\n  Project: PC thermometer\n  Description: Sends ADC samples to a PC through UART port\n  MCU: PIC12F1822 running at 4.0 MHz internal clock\n  Written by: Rajendra Bhatt\n  Date:       Oct 10, 2011\n*\/<\/span>\n&nbsp;\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">int<\/span> adc_value<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> MS_Byte<span style=\"color: #339933;\">,<\/span> LS_Byte<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">char<\/span> error<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">int<\/span> i<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">void<\/span> main<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n ANSELA <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b00000100<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ RA2 analog input<\/span>\n TRISA  <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b00100110<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ RA1, RA2, RA5 inputs<\/span>\n PORTA <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n OSCCON <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b01101000<\/span><span style=\"color: #339933;\">;<\/span>\n UART1_Init<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">9600<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n Delay_ms<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">100<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n&nbsp;\n <span style=\"color: #666666; font-style: italic;\">\/\/ Configure FVR to 2.048 V for ADC<\/span>\n  FVRCON <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b11000010<\/span> <span style=\"color: #339933;\">;<\/span>\n&nbsp;\n  <span style=\"color: #666666; font-style: italic;\">\/\/ Configure ADCON1<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADPREF0<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ Vref+ is 2.048 V<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADPREF1<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADCS0<\/span>   <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ Use conversion clock, Fosc\/2<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADCS1<\/span>   <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ Fosc = 500 KHz<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADCS2<\/span>   <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON1.<span style=\"color: #202020;\">ADFM<\/span>    <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ result is right Justified<\/span>\n&nbsp;\n  <span style=\"color: #666666; font-style: italic;\">\/\/ Configure ADCON0 for channel AN2<\/span>\n  ADCON0.<span style=\"color: #202020;\">CHS0<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON0.<span style=\"color: #202020;\">CHS1<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON0.<span style=\"color: #202020;\">CHS2<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON0.<span style=\"color: #202020;\">CHS3<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON0.<span style=\"color: #202020;\">CHS4<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  ADCON0.<span style=\"color: #202020;\">ADON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ enable A\/D converter<\/span>\n&nbsp;\n<span style=\"color: #b1b100;\">do<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n  ADCON0.<span style=\"color: #202020;\">F1<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>     <span style=\"color: #666666; font-style: italic;\">\/\/ start conversion, GO\/DONE = 1<\/span>\n  <span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #009900;\">&#40;<\/span>ADCON0.<span style=\"color: #202020;\">F1<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ wait for conversion<\/span>\n  MS_Byte <span style=\"color: #339933;\">=<\/span> ADRESH<span style=\"color: #339933;\">;<\/span>\n  LS_Byte <span style=\"color: #339933;\">=<\/span> ADRESL<span style=\"color: #339933;\">;<\/span>\n  UART1_Write<span style=\"color: #009900;\">&#40;<\/span>MS_Byte<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n  Delay_ms<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">50<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n  UART1_Write<span style=\"color: #009900;\">&#40;<\/span>LS_Byte<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ Line Feed<\/span>\n  delay_ms<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">2000<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n <span style=\"color: #009900;\">&#125;<\/span> <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #009900;\">&#125;<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p><strong><a href=\"http:\/\/embedded-lab.com\/uploads\/HexFiles\/PIC12F\/TempMeter.zip\" target=\"_blank\">Download the complete mikroC code<\/a><\/strong><\/p>\n<p>As I mentioned earlier, the PC application is developed using the Processing programming language. <strong><a href=\"http:\/\/processing.org\/\" target=\"_blank\">Processing<\/a><\/strong>\u00a0is an open-source software development environment designed for simplifying the process of creating digital images, animations and interactive graphical applications. It is free to\u00a0<strong><a href=\"http:\/\/processing.org\/download\/\" target=\"_blank\">download<\/a><\/strong>\u00a0and operates on Mac, Windows, and Linux platforms. I have written a simple application here that\u00a0receives the 10-bit ADC sample from the serial port, converts it to temperature, and display it on the computer screen.\u00a0The Processing serial library allows for easily reading and writing data to and from the serial ports. Read more about the Processing serial library <a href=\"http:\/\/processing.org\/reference\/libraries\/serial\/index.html\" target=\"_blank\">HERE<\/a>.<\/p>\n<p>You should import the Processing Serial library first before accessing the serial port. This can be done by,<\/p>\n<pre>import processing.serial.*;<\/pre>\n<p>Next, you can open a serial port as<\/p>\n<pre>PIC_Board = new Serial(this, \"COM6\", 9600);<\/pre>\n<p>In my case, the USB-UART module appear as COM6, you should find the right COM number to make it work for you, which you can find out from the Device Manager tool in Windows.<\/p>\n<p>Once the two bytes of ADC data are received serially, the actual temperature is retrieved by applying the sensor specific conversion factors. For MCP9701A, the conversion equation would be,<\/p>\n<pre>   temp = MS_Byte*256 + LS_Byte;\r\n   tempC = (2*temp - 400)\/19.5;  \/\/ Factor 2 corresponds to VREF = 2.048 V\r\n   tempF = ((tempC*9)\/5) + 32;<\/pre>\n<p>A clickable Start\/Stop button is also provided on the display window. The\u00a0<em>Processing Mouse<\/em> functions are used to detect a mouse press over the button. When the Start is pressed, data logging begins and the label on the button turns into &#8216;Stop&#8217;. If Stop is pressed, the data logging is paused. The temperature samples are recorded along with the date and time stamp (from PC) into an ASCII file. Every time the Start is pressed, the program creates a new ASCII log file. The name of the file contains the current system date and time so that there won&#8217;t be any overwriting of files. However, the data are temporarily stored into the PC&#8217;s RAM and are transferred to the ASCII file on the hard drive only after pressing the Stop button.<\/p>\n<p>The Processing source code and exported applications can be downloaded from the following link.<\/p>\n<p><strong><a href=\"http:\/\/embedded-lab.com\/uploads\/Processing\/TempDataLogger.zip\" target=\"_blank\">Download the Processing source code<\/a><\/strong><\/p>\n<div id=\"attachment_3921\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/StartStopLog2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3921\" class=\"size-full wp-image-3921\" title=\"StartStopLog2\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/StartStopLog2.jpg\" alt=\"\" width=\"560\" height=\"299\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/StartStopLog2.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/StartStopLog2-550x293.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-3921\" class=\"wp-caption-text\">PC application window<\/p><\/div>\n<div id=\"attachment_3910\" style=\"width: 517px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/ASCII_File.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3910\" class=\"size-full wp-image-3910\" title=\"ASCII_File\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2011\/10\/ASCII_File.jpg\" alt=\"\" width=\"507\" height=\"326\" \/><\/a><p id=\"caption-attachment-3910\" class=\"wp-caption-text\">Sample ASCII log file<\/p><\/div>\n<p><strong>Future enhancements<\/strong><\/p>\n<p>There is a lot of room for improvements in this project. The sampling interval of \u00a0the data logger is currently hard coded into the firmware of the PIC12F1822 microcontroller. However, both the firmware and the PC application can be modified to make the sampling time user-configurable from the application window. Similarly, a plotting program can also be added to the Processing application to display the temperature profile from the logged files.<\/p>\n<p><strong>Update<\/strong><\/p>\n<p><span style=\"color: #ff0000;\"><em>Conversion formula for MCP9701A<\/em><\/span><\/p>\n<p><span style=\"color: #ff0000;\">Resolution of A\/D conversion (Vref = 2.048V) = 2.048 V\/1024 = 2 mV\/count<\/span><\/p>\n<p><span style=\"color: #ff0000;\">=&gt; Equivalent voltage for 10-bit ADC output (Count) = 2*Count (mV)<\/span><\/p>\n<p><span style=\"color: #ff0000;\">=&gt; Temperature (\u00b0C) = (Voltage &#8211; Sensor Offset)\/Sensor conversion coefficient, <\/span><\/p>\n<p><span style=\"color: #ff0000;\">where Sensor Offset = 400 mV and conversion coefficient = 19.5 mV\/\u00b0C from datasheet.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project describes an easy and inexpensive way of adding a digital thermometer and data logging feature to a PC. It involves a PIC microcontroller that gets the surrounding temperature information from the Microchip MCP9701 sensor, and sends it to a PC through an USB-UART interface. The USB port of the PC is also used to power the device. The open-source Processing\u00a0 programming platform is used to develop a PC application that displays the temperature in a graphics window on the computer screen. The PC application also records the temperature samples plus date and time stamps on an ASCII file.<\/p>\n","protected":false},"author":1,"featured_media":3771,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[245,4,349],"tags":[362,363,1313,118],"class_list":["post-3770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-lab-projects","category-pic-projects","category-processing","tag-pc-data-logger","tag-pic12f1822","tag-processing","tag-temperature-logger"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/3770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=3770"}],"version-history":[{"count":36,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/3770\/revisions"}],"predecessor-version":[{"id":3925,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/3770\/revisions\/3925"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/3771"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=3770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=3770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=3770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}