Using TC74 Temp Sensor

March 22, 2018 | Author: GaneshVenkatachalam | Category: Microcontroller, Pic Microcontroller, Embedded System, Areas Of Computer Science, Computer Engineering


Comments



Description

13/12/2014HOME Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab NETDUINO PIC TUTORIALS CHIPKIT AVR XMEGA PRODUCTS STM32 ARDUINO PROJECTS TIPS AND TRICKS THEORY PIC PROJECTS CONTACT US Embedded Lab An online teaching laboratory for Microcontrollers and Embedded Systems USING TC74 (MICROCHIP) THERMAL SENSOR FOR TEMPERATURE MEASUREMENT Posted on July 17, 2011 by R-B 19 comments | Search... SUBSCRIBE The TC74 chip is a serially accessible, digital temperature sensor from Microchip Technology that acquires and converts temperature information from its onboard solid-state sensor with a resolution of 1°C. The Follow temperature is available as an 8-bit digital word stored in its internal temperature register, which is accessible through a 2-wire I2C compatible serial bus. This tutorial describes how to use the TC74 sensor with a PIC microcontroller to measure the surrounding temperature. Read Our Privacy Policy! Subscribe through email Sign Up Using TC74 sensor for temperature measurement Theory The TC74 digital temperature sensor is available in SOT-23 and TO-220 packages. The communication with the device is accomplished via a 2-wire I2C compatible serial bus. Temperature resolution is 1°C and conversion rate is http://embedded­lab.com/blog/?p=3146 EASY PULSE SENSOR Easy Pulse Sensor is designed for hobby and educational applications to illustrate the principle of finger photoplethysmography 1/13 (PPG) as a non-invasive technique for detecting cardio-vascular pulse wave. which is set to 1 for negative temperatures.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab a nominal 8 samples/sec. Read More . The downside is they are resource hungry and requires lots of I/O pins and CPU time for continuously displaying the readings. The TC74 has also got another 8-bit Read/Write Configuration Register (RWCR) that is used to put the device into a low power (IDD = 5 µA. In this mode. the A/D converter is halted and the temperature data registers are frozen. The most significant bit is the sign bit. Bit 7 of RWCR must be set to put TC74 into Standby mode. Temperature conversion table and internal registers 7-segment LED displays are fun way of displaying numeric sensor readings in Arduino or any other microcontroller-based projects.. We have designed varieties of 7-segment displays that support SPI interface and allows you an easy control of every LED segments using only 3 I/O pins of your MCU. The port is I2C compatible http://embedded­lab.com/blog/?p=3146 2/13 . Therefore. the maximum SERIAL 7-SEGMENT LED DISPLAYS measurable positive temperature is + 127 °C (0111 1111). The pin diagram of TC74 chip is shown below for reference. typical) Standby mode.. US customers buy here Pin diagram of TC74 The TC74 stores the measured temperature into its 8-bit International customers buy here internal register as 2′s complement binary format. Serial port operation The Serial Clock input (SCLK) and bidirectional data port (SDA) form a 2-wire bidirectional serial port for communicating with the TC74. Refer the datasheet for further details. The address byte consists of the 7-bit slave address and a Read/Write bit (R/W). The new address byte with R/W bit 1 is sent by the host. The R/W bit is always ’0′ (Write) in the first phase. but it can be implemented with any other smaller size PIC microcontrollers that support I2C communication. The PIC18F2550 microcontroller used in this experiment is from the StartUSB for PIC board. the command byte should be 00h. http://embedded­lab. The host microcontroller next sends the command byte to TC74 to indicate which register it wants to access. The TC74 transmits the 8-bit temperature data from the temperature register. Inter-Integrated Circuit (I2C) communication in PIC. Don’t forget to put two pull-up resistors (1K) on SDA and SCL lines of I2C bus. Visit our Tindie store Reading temperature from a TC74 device through I2C port involves the following steps: The host microcontroller issues a Start condition CATEGORIES followed by the address byte. I have got a TC74A0 in TO-220 package. The TC74 responds with an acknowledge pulse. For reading the temperature. please read my article. Similarly.com/blog/?p=3146 555 Timer (9) Analog (16) Arduino (110) ARM projects (2) AVR Projects (48) AVR Tutorials (5) BeagleBone (1) chipKIT (16) Display (1) dsPIC (1) Electric Imp (1) Embedded Lab Projects (61) Embedded Labs (25) Embedded Lessons (39) ESP8266 (1) Internet of Things (1) littleBits (1) MCU develeopment tools (12) Microcontroller Programmers (6) MSP430 Launchpad (4) Netduino (9) Open-source (1) PIC Projects (89) PIC Tutorials (46) PIC18F (10) Power Supply (13) Processing (3) Product Review (16) Products (34) Raspberry Pi (10) 3/13 . The host microcontroller provides the clock signal for all the data transfers and the TC74 always operates as a Slave. If you are not familiar with I2C protocol. For example. 7 other address options are also available which can be identified from the part number of the device. Upon receiving the byte. The temperature is read from the TC74 sensor and displayed on a character LCD. which is acknowledged by the slave. However. A0 corresponds to the device address 1001 000b. If the received 7-bit address matches with its own slave address. TC74A3 has its I2C address 1001 011b. the TC74 responds with an acknowledge pulse. Circuit diagram I am using PIC18F2550 to demonstrate here. the host doesn’t acknowledge. The default 7-bit I2C address of TC74 is 1001 101b. The host microcontroller issues a new Start condition because the direction of data transfer is now going to be changed. usually a microcontroller. but generates a Stop condition.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab and all transfers take place under the control of a host. The http://embedded­lab.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab Robotics (9) STM32 (7) Tech News (110) Texas Instruments (4) Tips and Tricks (85) Uncategorized (2) XMega (4) Circuit diagram Circuit setup on breadboard TC74 temperature sensor Software The firmware for PIC18F2550 is developed in C using mikroC Pro for PIC compiler. The compiler provides the built-in library for I2C support.com/blog/?p=3146 4/13 . The microcontroller reads the temperature word from the TC74′s internal temperature register and displays it on the LCD.         // Cursor off   Lcd_Out(1.1.          // Initialize LCD   Lcd_Cmd(_LCD_CLEAR).   do {    check_device(TC74A0).   TRISC = 0x00."Device not found").13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab following program works for the entire operating range of TC74 (-40 °C to 125 °C).   I2C1_Stop().   // Initiate I2C   Lcd_Init().  sbit LCD_D4 at RB4_bit. const int TC74A0 = 0x90.  sbit LCD_D6_Direction at TRISB6_bit.   http://embedded­lab.         // Read Temp  I2C1_Repeated_Start().  return result.  sbit LCD_D6 at RB6_bit.    num = Read_Temp(). void main() {   CMCON = 0x07.0 MHz using HS + PLL   MCLR Enabled */   // Define LCD module connections.  sbit LCD_D7_Direction at TRISB7_bit.     // Address + Read bit  result = I2C1_Rd(0u).1.  if (I2C1_Wr(dev_address)){   Lcd_Out(1.   void check_device(unsigned short dev_address){  I2C1_Start().       // Address + Write bit  I2C1_Wr(0x00).  sbit LCD_RS_Direction at TRISC6_bit. }   unsigned short Read_Temp(){  unsigned short result.  sbit LCD_D4_Direction at TRISB4_bit."TC74 device").  sbit LCD_EN at RC7_bit."Thermal sensor").   Delay_ms(1000).   TRISB = 0x00.  I2C1_Start(). unsigned short num.  sbit LCD_RS at RC6_bit.   I2C1_Init(100000).1.   Lcd_Out(2.             // CLEAR display   Lcd_Cmd(_LCD_CURSOR_OFF). }   char temperature[] = " 000  C".   Lcd_Cmd(_LCD_CLEAR)."Testing TC74").  sbit LCD_D7 at RB7_bit.1.  sbit LCD_D5_Direction at TRISB5_bit.  sbit LCD_EN_Direction at TRISC7_bit.  sbit LCD_D5 at RB5_bit.   // Disable comparators   ADCON1 = 0x0F.  }  else Lcd_Out(1.com/blog/?p=3146 5/13 . /*   Project: Using TC74 with PIC microcontroller            for temperature measurement   MCU: PIC18F2550 on‐board StartUSB for PIC        Clock 48.          // Issue start signal  I2C1_Wr(TC74A0). // Issue start signal  I2C1_Wr(TC74A0+1). // End LCD module connection definition   unsigned char Temp.  // Disable Analog functions   TRISA = 0x00. } Download the mikroC source and HEX files Output The following pictures show the device displaying both positive and negative temperatures. the device is put inside the freezer.    temperature[3] = num%10 + 48. 127) {     temperature[0] = '‐'.    temperature[5] = 223.temperature). The tip of a hot soldering rod saturates the sensor at 127 °C.   } while(1).      // eliminate 0s at beginning    if (temperature[1] == '0') {       temperature[1] = ' '.     num = ~num +1.    }      Lcd_Out(2.      temperature[1] = num/100 + 48. Displaying room temperature http://embedded­lab.4.    }    else temperature[0] = '+'.       if (temperature[2] == '0') temperature[2] = ' '.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab    // Check for negative temperature    if (num &gt.    temperature[2] = (num/10)%10 + 48.    Delay_ms(500).com/blog/?p=3146 6/13 . To test the negative temperature reading. Lab 12: Basics of LED dot matrix display 2. Expanding the number of I/O lines using Microchip MCP23008 tagged with digital thermometer. The communication with the TC74 sensor was accomplished through an I2C bus interface of PIC18F2550.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab Maximum measurable temperature Measuring negative temperature inside the freezer Conclusion The technique of interfacing Microchip’s TC74 sensor with a PIC microcontroller to measure the ambient temperature was discussed and demonstrated successfully. Lab 14: Inter-Integrated Circuit (I2C) communication 4. Lab 11: Multiplexing seven segment LED displays 3. The 8-bit temperature word was read from the internal temperature register and displayed on a LCD screen by the PIC18F2550 microcontroller.com/blog/?p=3146 7/13 . Related posts: 1. Microchip temperature http://embedded­lab. Unfortunately. it doesn’t work.your program (after going in this function for the first time) can’t use the i2c protocol again.com/blog/?p=3146 8/13 . And can i used PIC 16f877A for the same code? thanks. Could you possibly explain why? Also.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab sensor. I’ll be happy to answer me by e_mail Reply http://embedded­lab. is it a good idea to place I2C1_Stop at the very end of Read_Temp function? Thank you in advance! Reply Ehsan December 19. 2014 4:49 am hello. if you don’t do it.it’s very useful This project was very useful for me but your program has a tiny problem : in the “” read_temp “” function after you got the result . nice to meet you. 3) add I2C1_stop(). 2012 1:27 pm Hi Thank you about your excellent website. Reply Konstantin August 13.you can repair it by steps below : 1) at the program (wich shown in the site) where function “unsigned short Read_Temp(){ ” is developed 2)after result = I2C1_Rd(u). and before return result. you must stop the i2c with i2c_stop(). PIC18F2550. i have tried the code and but is given me error that the device not found. TC74 Embedded Labs Embedded Lessons PIC18F Tips and Tricks 19 COMMENTS shab132 November 10. 2014 5:14 am Hi! I tried to implement your circuit in Proteus by means of source and cof/hex files you provide for downloading. thank you for your site. The code hangs while attempting to execute I2C1_Start in check_device function. 2014 10:33 am Hi! Thank you for your reply. I am not trying to say that the code is wrong or anything like that.com Reply Konstantin August 22. 2012 11:49 am Hi. I could send you the Proteus project if it is necessary.could we use LM35 as a replacement for TC74? Reply Johnsan October 23.good day. 2012 12:21 pm hello. In Proteus environment. I’ve got an A0 type.. The code works great! Regards! Reply johnsan October 23. Konstantin [email protected]/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab Konstantin August 13. help if possible. 2014 5:11 am Hi! I dealt with the problem. I’m making a project with this sensor. 2012 1:32 am can the tc74 be replaced with lm35? Reply Johnsan October 22. Reply Davide March 1. the pull-up resistors’ properties must be set to digital.) in the code to match with the correct device.com/blog/?p=3146 9/13 . Regards. Obviously. 2012 3:48 am hello. You may have to change the I2C address (const int TC74A0 = 0×90.0 VCTTR instead of VAT? Reply R-B October 22. Please. However. See the datasheet page 9 for more details. I still can’t run the simulation in Proteus. 2012 1:38 pm It should work. http://embedded­lab.. I miss subtle details. will the project still work the same if we will use TC74-5. Reply R-B March 4. ThankYou p. Miklos Reply Miklos Vago January 30. init () { TRISCbits. Reply Miklos Vago January 31. // Read Temp RestartI2C(). Thanks in advance. my code should work. } unsigned char Read_Temp(){ unsigned char result. Which part of the original program do I have to modify for the proper functionality. // Issue start signal WriteI2C(0×91). Kind regards. My program stops in the Read_Temp function and doesn’t exit never. OpenI2C(SLAVE_7. // Address + Read bit result = ReadI2C().com/blog/?p=3146 10/13 . // Issue start signal WriteI2C(0×90). // Address + Write bit WriteI2C(0×00).0VAT sensor. http://embedded­lab. Make sure you connected the I2C pins of PIC18F4620 correctly. } I hope you can help me.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab I’m trying to read temperature but it seems impossible. I’m a newbee for uControllers and unfortunately I have only a TC74A2 5. 2012 3:34 am If you are using A0 type.SLEW_OFF ).TRISC3=1.. Could you help me? I’m using a PIC18F 4620.TRISC4=1. I don’t understand why. StartI2C(). I’m sorry for my english. TRISCbits. 2012 12:35 pm That’s great! Thank you for the prompt help. return result. 2012 10:15 am Hi.s. Simple. 2011 3:36 am Good day. If I convert temperture to int then it stays at a value of 36. it would be greatly appreciated. Regards Michael PS: I am in the process of converting to 3v3 uMicro. but I would like to be able to do a conditional operator to set a temperature point where something happens: Psuedo When temp >= 28′C then print additional message to LCD.com/blog/?p=3146 11/13 .13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab Miklos Reply R-B January 30. Reply Michael Havenga Go to Top| Contact Us | Privacy Policy | Log In October 31. got it working. If I just fo a conditional operator ie: void checktemp(){ if (temperature >=28) Lcd_Out(2. 2012 6:20 pm @Miklos. When temp >= 28′C then set port to start fan. } Then when the temp on the display is no where near 28and the additional message is already typed. I am enjoying working with this project. The I2C slave address of TC74A2 5.”T HIGH!”). So you need to change it in the following line of the code: const int TC74A0 = 0×90. Thanks for the great project. 2011 6:25 am Hi. I was however perplexed by a problem I first experienced when trying to get the code to work on a PIC16F887 – I might be mising http://embedded­lab. yes but I can’t figure out how to work with tha data types. So I will let you know how the project works on low voltage J type PICs. and it should work.6.0VAT is 0×92. Any help please. Reply Michael Havenga November 2. Replace 0×90 by 0×92. com/blog/?p=3146 12/13 . Interestingly. 2011 5:34 am Hi. Has this been tested on SMBUS – I would like to use this is in a 3v3 application ? Regards Michael Reply Pingback: I liked this: How to use Microchip’s TC74 sensor for temperature measurement | Road to 2012 Pingback: Electronics-Lab.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab somthing but as far as I could tell the I2C capability of the the 16F887 and the PIC18F2550 were the same. the 16F887 kept gettting the device not found error wheres the PIC18f2550 worked first time … weird.com Blog » Blog Archive » How to use Microchip’s TC74 sensor for temperature measurement LEAVE A REPLY Your email address will not be published. Required fields are marked * Name * Email * Website Comment Post Comment http://embedded­lab. Regards Michael Reply Michael September 21. com/blog/?p=3146 zeeDynamic Theme 13/13 . All Rights Reserved.13/12/2014 Using TC74 (Microchip) thermal sensor for temperature measurement | Embedded Lab © 2014 Embedded-Lab. http://embedded­lab.
Copyright © 2024 DOKUMEN.SITE Inc.