Skip to content

CrissCCL/Temp_ControlMod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Temperature Control Module

πŸ“– Overview

This low-cost module was designed and built to perform hands-on experiments in Digital Control. The system is controlled using an Arduino Leonardo, heat is modulated with a TIP31C transistor, and temperature is measured using a TMP36 sensor.

It provides a simple and practical platform for learning control theory in a laboratory environment.

⚠️ Note: This project is currently under updates. Features and hardware are subject to change.

πŸ“‚ Contents

  • /HardwareV2 β†’ New Version schematic, PCB, Gerbers.
  • /Hardware β†’ schematic, PCB, Gerbers.
  • /control_temp_LC β†’ C code for Arduino.
  • /docs β†’ photos

πŸ“Š Project Status

Component Status
Temperature Sensor Interface βœ… Completed
Signal Filtering and Smoothing βœ… Completed
PID Control Implementation βœ… Completed
Migration from MATLAB Data Logging to Processing 4 GUI βœ… Completed
Data Storage and CSV Export βœ… Completed
Processing 4 GUI (Monitoring & Logging) βœ… Completed
PCB Design with Improved Measurement Stability βœ… Completed

πŸ’» The project now features a Processing 4 graphical interface that replaces the previous MATLAB-based monitoring, data recording and data logging system.
πŸ”§ This new GUI allows real-time temperature monitoring and data recording, alongside the ongoing development of a custom PCB to improve measurement stability and reduce signal noise.

βš™οΈ System Description

  • Controller: Arduino Leonardo or Mega
  • Sensor: TMP36 analog temperature sensor
  • Actuator: TIP31C transistor controlling a heating element
  • Control Strategy: Digital PI temperature regulation
  • Sampling period: 0.1 seconds
  • Data transmission: Serial communication for data logging and Processing 4 GUI monitoring
  • PCB: Custom-designed board for power and measurement stability

πŸ”„ Control Loop

Diagrama sistema

Controlled Variables

  • Temperature β†’ Temperature value control (stabilization)

πŸ“ Digital PID Control

The Module uses a discrete PI controller implemented on a Arduino microcontroller.
The control law in the digital domain is expressed as:

$$ u(n) = u(n-1) + K_0 e(n) + K_1 e(n-1) $$

Digital PI controller implemented for temperature measured,

$$ V_{PWM}(n) = V_{PWM}(n-1) + K_0 e(n) + K_1 e(n-1) $$

Parameters:

The parameters are adjusted for temperature measured,

$$ K_0 = K_p + \frac{K_p}{2T_i} T_s $$

$$ K_1 = -K_p + \frac{K_p}{2T_i} T_s $$

πŸ”‰ Signal Processing: Low-Pass IIR Filter (1st Order)

To reduce measurement noise, a first-order IIR low-pass filter was applied to the temperature signal before feeding it to the controller and the ARX model.

πŸ”Ή Filter Equation

$$ y(k) =(1 - \alpha) \cdot x(k) + \alpha \cdot y(k-1) $$

Where:

  • $$x(k)$$: raw sensor measurement at time step $$k$$
  • $$y(k)$$: filtered output
  • $$\alpha$$: smoothing factor, $$(0<\alpha<1)$$

πŸ§ͺ PI Control Test and ARX Model Comparison

A test was performed using a PI controller applied to the temperature control module.
The experimental results were compared against a linear ARX model identified from system data.

πŸ”Ή General ARX Model Equation

The ARX (Auto-Regressive with eXogenous input) model is defined as:

$$ y(k) + a_1 y(k-1) + a_2 y(k-2) + \dots + a_{n_a} y(k-n_a) = b_1 u(k-1) + b_2 u(k-2) + \dots + b_{n_b} u(k-n_b) + e(k) $$

Where:

  • $$y(k)$$: system output at sample $$k$$
  • $$u(k)$$: input signal at sample $$k$$
  • $$( a_i, b_j)$$: ARX parameters
  • $$( n_a, n_b)$$: model orders
  • $$e(k) $$: disturbance/noise

πŸ”Ή Results Overview

  • βœ… The PI controller improved temperature tracking and reduced overshoot.
  • πŸ“‰ The ARX model captured the main dynamics, with small discrepancies due to nonlinear heat transfer effects.
  • βš–οΈ The comparison confirms the applicability of ARX models for thermal system control design.

πŸ”Ή Experimental Plots

ARX vs Experimental Comparison (Temperature)

πŸ–₯️ GUI β€” Monitoring and Data Logging

The graphical user interface (GUI) shown in the photograph is developed using Processing 4.
It is designed only for monitoring the temperature module in real time and for recording experimental data.

GUI preview

Key features:

  • Real-time plot of temperature and setpoint.
  • Display of control output (PWM or equivalent).
  • Logging of measurements to files for offline analysis.
  • Simple visualization of system behavior during experiments.

⚠️ Note: The GUI is for observation and data recording only; it does not modify the control system or send commands to the hardware.

⚠️ Status: Work In Progress β€” the GUI is being actively developed and will be added to the repository once sufficiently stable.

πŸ“‰ Measurement Stability Improvement β€” PCB v2 vs PCB v3

The new PCB revision focused on improving the temperature signal stability without changing the control algorithm.

πŸ”§ Issues Observed in PCB v2

In the previous revision, the temperature reading from the TMP36 sensor showed perturbations during heater actuation by the TIP31C transistor.
This was mainly due to lack of proper analog stabilization near the sensor.

βœ… Modifications Introduced in PCB v3

To address this, the following hardware changes were implemented according to TMP36 manufacturer guidelines:

  • βœ” Decoupling capacitor added close to TMP36 power pins
  • βœ” Analog conditioning resistors changed to SMD
  • βœ” All related passive components migrated to SMD footprint to minimize parasitics and noise pickup

No changes were made to the controller firmware or sensor type β€” only the PCB-level conditioning was improved.

πŸ“Š Comparative Experimental Results

Version Condition Plot
PCB v2 (Old) Visible ripple & switching noise on temperature signal
PCB v3 (New) Stable and smooth measurement β€” disturbances eliminated

βœ… The addition of the capacitor and SMD passives significantly reduced noise, improving the quality of temperature measurements and the overall stability of the closed-loop response.

πŸ–ΌοΈ Render 3D PCB

PCB Render - Version 3
PCB Render - Version 3 - NEW VERSION
PCB Render - Version 2
PCB Render - Version 2- OLDER VERSION

⚑ Physical Prototype

The updated PCB and system assembly have been tested successfully.
The following image shows the complete setup of the new prototype version:

Complete Prototype Setup - Version 3

The following images shows the complete setup of the previus prototype version:

Foto del prototipo
Device connections
Foto del prototipo
Complete setup

πŸ“œ License

MIT License

About

This Module is designed for low cost laboratory practices powered by an Arduino

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages