PID temperature controller DIY Arduino

PID temperature controller DIY Arduino

Building a PID Temperature Controller

Introduction to the Project

  • The speaker introduces the project of building a temperature control station using a soldering iron with a thermocouple, LCD, and Arduino for PID control.
  • A commercial PID controller is mentioned, highlighting its limitations due to relay-based operation which leads to imprecise temperature control.

Understanding PID Control

  • The focus shifts to creating a precise PID controller that utilizes a k-type thermocouple for temperature measurement and an Arduino for generating the PID algorithm.
  • The heating element used in this project will be from a 3D printer nozzle, providing an effective example for learning about temperature control.

Components and Setup

  • The desired target temperature is set at 100 degrees Celsius. A MAX6675 module will amplify the thermocouple's signal while the Arduino manages the PID algorithm.
  • This setup forms a closed-loop system where feedback from the thermocouple informs the Arduino about real-time temperatures.

Mechanism of PID Control

  • Key components of any PID system include defining the setpoint (desired temperature), feedback mechanism (thermocouple), and three constants: proportional (P), integral (I), and derivative (D).
  • The process involves comparing actual temperatures against setpoints, adjusting power output based on feedback through PWM signals applied to MOSFET.

Challenges in Temperature Control

  • If only proportional control is used, it can lead to oscillations around the setpoint without achieving stability; thus, derivative control is introduced to react quickly to changes in temperature.
  • Integral control accumulates error over time, helping correct persistent discrepancies between actual and desired temperatures.

Building and Testing

  • The speaker emphasizes finding appropriate constants for P, I, D elements as crucial for effective PID performance before moving on to practical implementation.
  • Initial steps involve reading real temperatures using a k-type thermocouple connected via MAX6675 breakout module interfaced with an Arduino SPI port.

Code Implementation

  • Connections are made carefully considering polarity; code uploaded allows reading SPI data from MAX6675 which displays real-time temperatures on an LCD screen.
  • An example code snippet is provided for reading thermocouple data; further instructions follow regarding controlling power with MOSFET after confirming successful readings.

PID Temperature Control Project Overview

Setting Up the PID Control System

  • The system reads temperature, calculates error, sums PID values, and generates a PWM signal on digital pin D3 for the MOSFET. It's crucial to read all comments in the code for better understanding.
  • The desired temperature is set at 100 degrees Celsius, with an LCD screen displaying both the set value and actual temperature. Achieving stable temperature requires fine-tuning of PID constants.

Tuning PID Constants

  • Start tuning by setting I and D values to zero; gradually increase them to achieve optimal results. Observations are made using an oscilloscope to monitor PWM signals from the MOSFET.
  • Initially, when reaching the desired temperature, PWM width is small due to BJT transistor activation of the n-channel gate MOSFET. Once stabilized, it maintains consistent temperatures despite external cooling attempts (e.g., blowing air).

User Interface and Controls

  • A rotary encoder with a push-button will be used for user input to adjust desired temperature settings similar to commercial PID controllers that have up/down buttons. This allows easy navigation through settings on an LCD screen.
  • The final schematic includes components like an LCD screen, rotary encoder, thermocouple with MAX6675 module, MOSFET driver circuit (BJT), ensuring accurate readings by placing the thermocouple in contact with the heating element.

Testing and Implementation

  • New code can be downloaded; it initializes at zero degrees but allows users to set P, I, and D constants via rotary encoder interactions (pressing 'set' button). After adjustments are made, new settings are stored effectively.
  • Upon setting back to 100 degrees Celsius, real-time monitoring shows how well the system maintains this target as indicated by fluctuating PWM signals around that value once achieved.

Future Developments

  • Plans include creating a case for this project akin to commercial models; however, it's currently intended for use as a soldering station tool in future tutorials involving soldering iron modifications with integrated thermocouples. Stay tuned for updates!
  • Future projects may involve AC voltage control systems using similar principles applied in past tutorials aimed at building filament extruders from recycled 3D printed parts—details forthcoming in later videos. Support options available via Patreon link provided below video content for those interested in contributing towards further projects and channel sustainability.
Video description

Best & Fast Prototype ($2 for 10 PCBs): https://www.jlcpcb.com Thanks to JLCPCB for supporting this video. Learn how a PID controller for temperature works. We use a K type thermocouple and read real temperature values with the MAX6675 breakout board. SPI connected to the Arduino which will create the PID and control a MOSFET with PWM signal and the power for a DC heater. my Q&A page: http://electronoobs.com/eng_preguntas.php Help me on Patreon : https://www.patreon.com/user?u=4854866 Canal en Español: https://www.youtube.com/channel/UCL_QvUUeriC6q610RCXDlSQ 🔬PRINTERS FDM ------------------------------------- Artillery Sidewinderr X1 (364€ Aliexpress): https://s.click.aliexpress.com/e/_9y9haI Artillery GENIUS (307€ Aliexpress): https://s.click.aliexpress.com/e/_A9SvG2 Creality3D Ender 3 Pro (230€ Aliexpress): https://s.click.aliexpress.com/e/_APcCa2 Anycubic Mega S (206€ Aliexpress): https://s.click.aliexpress.com/e/_ALcTLs ELEGOO NEPTUNE 2 (186€ Aliexpress): https://s.click.aliexpress.com/e/_AM2y7c Prusa i3 MK3S Clone (393€ Aliexpress): https://s.click.aliexpress.com/e/_ASNXyi Creality CR-10 V3 (480€ Aliexpress): https://s.click.aliexpress.com/e/_AnycCO 🔅PRINTERS RESIN ------------------------------------- ELEGOO Mars Pro (208€ Aliexpress): https://s.click.aliexpress.com/e/_A0nVFY ELEGOO Saturn MSLA (480€ Aliexpress): https://s.click.aliexpress.com/e/_AKxJim Anycubic Photon Mono (199€ Aliexpress): https://s.click.aliexpress.com/e/_9ulv4K Creality HALOT ONE (275€ Aliexpress): https://s.click.aliexpress.com/e/_Ak7jBC LINKS ________________________________________________________ Tutorial webpage: http://www.electronoobs.com/eng_arduino_tut24.php Part list: http://www.electronoobs.com/eng_arduino_tut24_parts1.php Schematic thermocouple: http://www.electronoobs.com/eng_arduino_tut24_sch1.php Final schematic: http://www.electronoobs.com/eng_arduino_tut24_sch3.php Code (thermocouple read example): http://www.electronoobs.com/eng_arduino_tut24_code1.php Code (PID NO rotary encoder): http://www.electronoobs.com/eng_arduino_tut24_code3.php Code (FINAL PID): http://www.electronoobs.com/eng_arduino_tut24_code3.php Please, like, share and subscribe in order to motivate me for moe videos like this one. Thank you!