PSoC5LP Lab 05: Thermometer

Objective

  • Implement temperature sensing using an analog sensor.
  • Display real-time temperature readings on an LCD interface.

Overview

A thermistor is a thermal resistor, meaning its resistance changes with temperature. While all resistors exhibit some change in resistance with temperature, the variation is usually minimal and difficult to measure. Thermistors, however, are specifically designed to show significant resistance changes with temperature, sometimes by 100 ohms or more per degree, making them highly sensitive to temperature variations.

Thermistors are categorized into two types: NTC (Negative Temperature Coefficient) and PTC (Positive Temperature Coefficient).

  • NTC Thermistors: In NTC thermistors, the resistance decreases as the temperature increases. This characteristic makes them ideal for temperature measurement and control applications. NTC thermistors are commonly used in devices such as digital thermometers, HVAC systems, and automotive temperature sensors.
  • PTC Thermistors: In PTC thermistors, the resistance increases as the temperature rises. These thermistors are often used in applications where overcurrent protection is needed. PTC thermistors act as resettable fuses; as the current increases, the thermistor heats up, causing the resistance to increase, which limits the current flow. This makes them helpful in protecting circuits from overheating, such as power supplies, battery charging systems, and motor protection circuits.

In summary, NTC thermistors are primarily used for accurate temperature measurement, while PTC thermistors are often employed for circuit protection due to their self-regulating current-limiting properties.

Required Reading Material

Required Components

NTC Thermistor s MF52D-103f-3950 NTC Thermistor × 1
R10Kohm 10 KΩ × 1
CharacterLcdDisplay s Character LCD Module × 1
Potentiometer 10K s 10 KΩ Potentiometer × 1

Circuit / Schematic

Schematic 01

Procedure

Creating a New Project

  1. Launch PSoC Creator.
  2. Got to File ➤ Open Project ➤ Project/Workspace.
  3. Open the PSoC5LP workspace in the EE4450 folder.
  4. After PSoC Creator opens the workspace, right-click on Workspace 'PSoC5LP' in the Workspace Explorer and select Add ➤ New Project...
  5. Select the correct PSoC5LP device model number, use the "Empty schematic" template, and enter the project name 04_Thermometer.

Adding PSoC Creator Components

Follow these detailed steps to add components to the PSoC Creator project by modifying the TopDesign.cysch schematic file:

  1. Add a Character LCD component:
    • Navigate to the Display catalog in the component selection panel.
    • Drag and drop the Character LCD onto the schematic.
  2. Add a SAR ADC component:
    • Navigate to the Analog ➤ ADC catalog in the component selection panel.
    • Drag and drop the SAR ADC onto the schematic.
  3. Add an Opamp component:
    • Navigate to the Analog ➤ Amplifiers catalog in the component selection panel.
    • Drag and drop the Opamp onto the schematic.
  4. Add an Analog Pin:
    • Navigate to the Ports and Pin catalog in the component selection panel.
    • Drag and drop the Analog Pin onto the schematic.

The TopDesign schematic is shown below:

Configure the Components

  1. Config the Character LCD (LCD_Char_1):
    • Click on the LCD_Char_1 component in the schematic.
    • Rename the component to LCD for clarity and ease of identification.
      CharacterLCD LCD s
  2. Config the SAR ADC (ADC_SAR_1):
    • Click on the ADC_SAR_1 component in the schematic.
    • Rename the components to ADC for ease of identification.
    • Set the Input range to Vssa to Vdda (Single Ended) to specify the voltage range from ground (Vssa) to the system supply voltage (Vdda).
    • Set the Reference to Internal Vref, bypassed, which allows for an internally generated voltage reference with bypass functionality. This helps ensure stable reference voltage for accurate ADC conversions.
      ADC SAR ADC s
  3. Config the Opamp (Opamp_1)
    • Click on the Opamp_1 component in the schematic.
    • Set the Mode to Follower (Voltage Follower), ensuring that the Opamp buffers the signal without amplification, which is typically used for impedance matching.
      Opamp Op Follower s
  4. Config the Analog Pin (Pin_1):
    • Click on the Pin_1 component in the schematic.
    • Rename the components to Thermo to represent its connection to the thermistor or temperature-sensing device, making it easy to identify in the project.

Wiring

  1. Delete Vout_1 component to remove the existing connection and free up the output for further wiring.
  2. After removing the Vout_1 component, connect a wire from the output of the Op_Follower (Opamp) component to the input of the ADC component. This ensures that the signal processed by the Op_Follower is properly fed into the ADC for conversion and measurement.
  3. Connect the Thermo pin (analog input) to the input of the Op_Follower component. This setup allows the temperature sensor (connected to the Thermo pin) to send its signal to the Op_Follower for buffering and stabilization before passing it to the ADC for conversion.

Following these instructions, the signal flow will proceed from the temperature sensor (Thermo) to the Op_Follower for buffering and then to the ADC for accurate analog-to-digital conversion.

Lab05 TopDesign Final s

Pin Assignment

DevicePort.PinDirectionDrive Mode

Template Firmware Code


#include "project.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    Op_Follower_Start();
    ADC_Start();

    LCD_Start();
    LCD_ClearDisplay();
    LCD_Position(0,0);
    LCD_PrintString("EE4450 PSoC5LP");
    LCD_Position(1,0);
    LCD_PrintString("NTC Thermometer");
    CyDelay(2000);              // Delay for 2 second

    for(;;)
    {
        /* Place your application code here. */

    }
}
/* [] END OF FILE */

Exercises

© 2024 Air Supply Information Center (Air Supply BBS)