PIC16F877A Low-Power Temperature Sensors TC1047&MCP9700

by Marwen Maghrebi

In this article, explore how Low-Power Temperature Sensors like TC1047 and MCP9700 can be interfaced with the PIC16F877A for efficient and precise temperature monitoring.

Features of the TC1047 and MCP9700 Low-Power Temperature Sensors Project

Things used in this project

Software apps and online services:

1- MPLAB

2- Proteus 8

Interfacing TC1047 and MCP9700 Low-Power Temperature Sensors with PIC16F877A Microcontroller: A Complete Guide

In this project, we will explore how to interface the TC1047 and MCP9700 low-power temperature sensors with the PIC16F877A microcontroller. The PIC16F877A TC1047 & MCP9700 project highlights the efficiency and precision of these sensors, making them suitable for a variety of embedded system applications. If you want to see another similar temperature sensor project, check out “PIC16F877A LM335 & AD592 Temperature Sensor.”

Interfacing TC1047 and MCP9700 Temperature Sensors with PIC16F877A

TC1047 Temperature Sensor Overview

The TC1047 is a precision temperature-to-voltage sensor designed for low-power applications. It offers a linear voltage output proportional to temperature, supporting a wide range of -40°C to +125°C. With a low operating current of 35 µA and compact SOT-23B packaging, it is ideal for space-constrained and battery-powered systems, including consumer electronics, thermal management, and industrial instrumentation.

TC1047 Low-Power Precision Temperature Sensor

Key Features

  • Operates with supply voltages from 2.7V to 5.5V.
  • Measures temperature in the range of -40°C to +125°C with a linear voltage output.
  • Low power consumption with a typical supply current of 35 µA.
  • Compact 3-pin SOT-23B package design.
  • Output slope of 10 mV/°C for straightforward temperature readings.

Applications

  • Ideal for portable electronics and battery-operated devices.
  • Used in temperature-controlled systems like fans and power supplies.
  • Integrated into industrial and consumer-grade instrumentation.


Power Efficiency (instead of “Accuracy”)

  • Consumes minimal power with a typical operating current of just 35 µA, making it suitable for power-sensitive applications.
  • Designed for low-voltage operation, enabling integration in energy-efficient systems.

MCP9700 Temperature Sensor Overview

The MCP9700 is a low-power linear active thermistor IC that converts temperature into an analog voltage. It supports a wide temperature range of -40°C to +150°C with minimal power consumption of just 6 µA, making it perfect for portable and battery-operated devices. Its simple design and compatibility with ADCs make it versatile for applications like environmental monitoring, home appliances, and general-purpose temperature sensing.

MCP9700 Low-Power Linear Thermistor IC

Key Features

  • Operates within a voltage range of 2.3V to 5.5V.
  • Measures temperatures from -40°C to +150°C (dependent on package).
  • Ultra-low operating current of 6 µA for energy-efficient applications.
  • Linear output voltage with a slope of 10 mV/°C for easy interfacing with ADCs.
  • Available in compact packages such as SOT-23 and TO-92.

Applications

  • Suitable for temperature monitoring in appliances, PCs, and battery-powered devices.
  • Commonly used in environmental monitoring systems and portable electronics.
  • Reliable in general-purpose temperature sensing tasks.

Power Efficiency (instead of “Accuracy”)

  • Operates on an exceptionally low current of 6 µA, enhancing its suitability for battery-powered and portable systems.
  • Optimized to drive large capacitive loads without additional circuitry, ensuring stability and low power draw.

Project  : Interfacing MCP9700 and TC1047 Analog Temperature Sensors with PIC16F877A and LCD Display

This project demonstrates how to interface the MCP9700 and TC1047 analog temperature sensors with the PIC16F877A microcontroller. The temperatures are measured using the ADC module, processed, and displayed on a 16×2 LCD in real-time. This setup is ideal for monitoring ambient conditions in embedded applications.

ADC Driver Header File (adc.h)

The ADC driver handles analog-to-digital conversions for sensor data processing.

#ifndef ADC_H
#define ADC_H

#include "main.h"

// Function Prototypes
void configure_ADC(void);
void select_ADC_channel(unsigned char channel);
void start_ADC_conversion(void);
void wait_for_conversion(void);
uint16_t read_ADC_result(void);

#endif /* ADC_H */

LCD Driver Header File (lcd.h)

The LCD driver provides functions to display temperature data on a 16×2 LCD.

#ifndef LCD_H
#define LCD_H

#include "main.h"

// Define LCD control pins (adjust these based on your hardware setup)
#define RS PORTCbits.RC0  // Register Select pin
#define RW PORTCbits.RC1  // Read/Write pin
#define EN PORTCbits.RC2  // Enable pin

// Function Prototypes
void lcd_initialize(void);
void lcd_data(unsigned char data);
void lcd_string(const unsigned char *str, unsigned char len);
void lcd_command(unsigned char cmd);

#endif /* LCD_H */

Main Application Header File (main.h)

This header contains configuration bits and global definitions.



#ifndef MAIN_H
#define MAIN_H

#include <xc.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>

// Configuration Bits
#pragma config FOSC = XT       // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF      // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF     // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON      // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF       // Low-Voltage Programming Disable
#pragma config CPD = OFF       // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF       // Flash Program Memory Write Enable bits (Write protection off)
#pragma config CP = OFF        // Flash Program Memory Code Protection bit (Code protection off)

#define _XTAL_FREQ 4000000  // Replace with your clock frequency

#endif /* MAIN_H */

Main Application File (main.c)

The main application processes data from the sensors and displays it on the LCD.

#include "main.h"
#include "adc.h"
#include "lcd.h"

// Message buffers
char message1[16];
char message2[16];

void main(void) {
    // Initialize peripherals
    lcd_initialize();
    configure_ADC();
    
    const float VREF = 3.3;           // ADC reference voltage (3.3V)
    const int ADC_RESOLUTION = 1024; // 10-bit ADC resolution
    const float MCP9700_TEMP_OFFSET = 0.5;   // MCP9700 offset at 0°C (500 mV)
    const float MCP9700_TEMP_SLOPE = 0.01;   // MCP9700 slope (10 mV/°C)

    while (1) {
        // MCP9700 Sensor Reading
        select_ADC_channel(0); // Select AN0 for MCP9700
        start_ADC_conversion();
        wait_for_conversion();
        int MCP9700_ADCValue = read_ADC_result();
        float MCP9700_voltage = ((float)MCP9700_ADCValue * VREF) / ADC_RESOLUTION;
        float MCP9700_temperature = (MCP9700_voltage - MCP9700_TEMP_OFFSET) / MCP9700_TEMP_SLOPE;
        sprintf(message1, "MCP9700:%.2f C", MCP9700_temperature);
        lcd_command(0x80); // Move to first line
        lcd_string((const unsigned char *)message1, sizeof(message1));

        // TC1047 Sensor Reading
        select_ADC_channel(1); // Select AN1 for TC1047
        start_ADC_conversion();
        wait_for_conversion();
        int TC1047_ADCValue = read_ADC_result();
        float TC1047_voltage_mV = ((float)TC1047_ADCValue * VREF * 1000.0) / ADC_RESOLUTION;
        float TC1047_temperature = (TC1047_voltage_mV - 500.0) / 10.0;
        sprintf(message2, "TC1047 :%.2f C", TC1047_temperature);
        lcd_command(0xC0); // Move to second line
        lcd_string((const unsigned char *)message2, sizeof(message2));
    }
}

Proteus Configuration :

  • Open Proteus & Create New Project and click next
  • Click on Pick Device
  • Search for PIC16F877A & LCD 16×2 & MCP9700 & TC1047
  • Click on Terminal Mode then choose (DEFAULT & POWER &GROUND)
  • finally make the circuit below and start the simulation
Proteus 8 Circuit Design for TC1047 and MCP9700 Temperature Sensors Project

That’s all!

If you have any questions or suggestions don’t hesitate to leave a comment below

You Might Also Like

Leave a Comment


Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00