Wednesday, December 18, 2024

Make A Battery-Operated Portable Temperature Measurement System

This project presents a K-type thermocouple-based temperature measurement system using MSP430G2553 microcontroller (MCU). The MCU reads sensor data and updates it on a four-digit, seven-segment display, and also sends it to a smartphone through Bluetooth module. The author’s prototype is shown in Fig. 1 and its block diagram in Fig. 2.

Author’s prototype for Battery-Operated Portable Temperature Measurement System
Fig. 1: Author’s prototype
Block diagram of the temperature measurement system
Fig. 2: Block diagram of the temperature measurement system

Temperature measurement is vital in various industrial and weather-monitoring applications. Resistance temperature detectors (RTDs), thermistors and thermocouples are commonly used as sensors for temperature measurement in industrial applications. K-type thermocouples are widely used in industrial applications as these work well in rugged environmental conditions and in various atmospheres. These can provide temperature measurements in the range of -270°C to 1260°C, and an output of -6.4mV to 54.9mV over maximum temperature range. Thermal response of K-type thermocouples is also fast as compared to RTDs and thermistors.

Circuit and working

Fig. 3 shows the complete circuit diagram of the system. K-type thermocouple is used for temperature sensing and MAX6675 module is used as signal converter. MAX6675 performs cold-junction compensation and digitises the signal from K-type thermocouple. Data is output in a 12-bit resolution and communicated to the MCU through SPI protocol. MAX6675 provides a resolution of 0.25°C, and allows temperature readings from 0°C to +1024°C.

- Advertisement -
Circuit diagram of the temperature measurement system
Fig. 3: Circuit diagram of the temperature measurement system

MSP430G2553 (IC2) is an ultra-low-power mixed-signal MCU with 16-bit RISC CPU, and has a digitally-controlled oscillator for data processing. A twenty-pin MSP430G2553 MCU is used here. It periodically acquires data from the signal converter and converts the digital data into corresponding temperature value.

Converted values are sent to the four-digit, seven-segment display (DIS1) through an analogue multiplexer/demultiplexer HEF4051B (IC3). Through pin P2.7 of MCU, temperature data is sent serially to pin E of HEF4051B to update the segments of the digit.

- Advertisement -

Pins P2.0, P2.1 and P2.2 of the MCU are connected to selection pins S1, S2 and S3 of HEF4051, respectively, to select the particular segment of a digit in DIS1. Pins P2.3, P2.4, P2.5 and P2.6 of the MCU are connected to pins 12, 9, 8 and 6 of DIS1, respectively, to select a particular digit.

The MCU also sends data to the smartphone through HC-05 module. HC-05 is a Bluetooth Serial Port Protocol (SPP) module interfaced with the MCU through UART. Pins RX and TX of HC-05 are connected to pins P1.1 and P1.2 of the MCU, respectively. HC-05 Bluetooth module is used to communicate between the smartphone and the circuit. A 9V PP3 battery or a suitable DC power supply adaptor is used to power up the system. LM317 is used as voltage regulator to provide 3.3V to 3.6V.

DIS1 is capable of displaying temperature up to 999.8°C. Temperature measurement can also be viewed through an Android smartphone with Bluetooth Terminal HC-05 app installed. Connect Bluetooth of the smartphone with HC-05 Bluetooth module in the circuit. Default auto-pairing password is 1234.

Next, open the app; you will notice a list of nearby Bluetooth devices. Select HC-05 from the list to connect it.

Send ST ASCII value to HC-05. Whenever UART of the MCU gets the command ST, it will send data to HC-05, as shown in Fig. 4.

Output of Temperature monitoring System through Bluetooth terminal on smartphone
Fig. 4: Output through Bluetooth terminal on smartphone

Software

Fig. 5 shows the integrated development environment (IDE) of the IAR-embedded workbench for MSP430 version 7.12. KickStart edition is used to develop the firmware in embedded C and program MSP430G2553. MSP430 LaunchPad Kit is used to burn the program to the MCU.

IDE of IAR-embedded workbench
Fig. 5: IDE of IAR-embedded workbench

The following steps are used to develop and burn the firmware to the MCU:

  1. Install IAR-embedded workbench for MSP430 (IAREW) on Windows PC.
  2. Register for KickStart (free) licence.
  3. Open IAR-embedded workbench IDE.
  4. Select File->New Workspace.
  5. Open Project->Create New Project->Expand C Tree Node->Main, Toolchain->MSP430. Click OK.
  6. Give a filename and save it.
  7. Copy and paste the source code (main.c) in the text editor.
  8. On the workspace (left pane), right-click on the project name. Select  Options->Category->General Options Device->MSP430G2553.
  9. Select Category->Debugger->Driver->FET Debugger.
  10. Connect MSP430 LaunchPad Kit (with MSP430G2553) with the PC using USB type A male to USB type B mini cable.
  11. To burn the code to the MCU, select Project->Download->Download active application.

After burning is complete, remove the MCU and place it on the temperature measurement target board. It is always good to save the file by giving a filename and clicking on Save.

Troubleshooting

In case there is a problem in running the project, troubleshoot using the steps given below.

    1. Download and install MSPDRIVERLIB from this page.
  1. Select Category->FET Debugger->Connection->Elprotonic USB-FPA, Manual Selection->Spy-Bi-Wire.

The firmware performs the following functions:

  1. Halt watch-dog timer and initialise the internal clock to 16MHz (digital-controlled oscillator).
  2. Initialise USCI for SPI and UART.
  3. Initialise the timer to create periodic interrupts.
  4. For every timer interrupt, read sensor data from MAX6675 and convert that digital data to temperature.
  5. Update the value on seven-segment display.
  6. If UART receives ST in ASCII, it will keep sending temperature data to HC-05 module for every timer interrupt.

Construction and testing

While constructing the circuit, care must be taken to check all components prior to assembly. This includes checking HEF4051B by connecting digital select pins, ground pin, inhibit pin to 0V and VDD pin to 3.6V.

Now, give input to pin Z; it must be reflected at output pin Y0. If Z is high, then Y0 is high, and vice-versa. Connect inhibit pin (E) of HEF4051B to high (VDD). Output Y0 should be floating.

Test the four-digit, seven-segment display (DIS1) using a multimeter in continuity mode, and map the pins including anode and cathode. Pin details of DIS1 used in the project are shown in Fig. 6.

Pinout of the four-digit common-anode seven-segment display
Fig. 6: Pinout of the four-digit common-anode seven-segment display

Need for the resistor to limit current to DIS1 is eliminated due to the presence of internal resistance of HEF4051B.

Parts List for portable temperature measurement system

Whenever the Temperature Measurement System system is powered on, the MCU waits for timer interrupt (~1sec). Upon timer interrupt, the MCU starts to acquire temperature data from the thermocouple sensor through MAX6675 module and converts digital data to valid temperature data, and displays the same on the four-digit, seven-segment display (DIS1).

Download Source Folder


J. Anuj is an electronics hobbyist. His area of interest includes automotive electronics, embedded systems, artificial intelligence (AI) and Python programming

Dr K. Vairamani is assistant professor in Department of Electronics, St. Joseph’s College (Autonomous), Tiruchirappalli, Tamil Nadu. His area of interest includes instrumentation and wireless sensor networks

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics