Hello

Welcome lekule blog

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation.
together in the world. #lekule86
Join us on

Embedded PID Temperature Control, Part 1: The Circuit

The key components in this PID (proportional–integral–derivative) controller are an EFM8 microcontroller, a DAC, and the MAX31855 thermocouple-to-digital converter.

Supporting Information

  • This project makes use of a custom-designed PCB; please refer to Custom PCB Design with an EFM8 Microcontroller for guidance on incorporating EFM8 devices into your custom hardware.
  • You can find a brief overview of thermocouples along with some general information about the MAX31855 in Make an EFM8-Based System for Monitoring and Analyzing Thermocouple Measurements.
  • An Introduction to Control Systems: Designing a PID Controller Using MATLAB’s SISO Tool
  • Negative Feedback, Part 1: General Structure and Essential Concepts
  • Introduction to Bipolar Junction Transistors

The Legendary P-I-D

PID controllers have perhaps attained a somewhat mythical status. When a physical variable needs to be controlled—temperature, angular velocity, position, flow rate, etc.—the power of PID is invoked, and with PID comes the confident hope of speedy success. PID’s popularity and renown are not necessarily undeserved; PID control is elegant, flexible, and robust, and it has proved its efficacy in countless practical applications. However, it is possible that our knowledge of PID far exceeds our experience with PID, especially considering that PID implementations are often hidden inside so-called programmable logic controllers (PLCs), with various low-level details abstracted away from the user. PLC manufacturers make really good PID controllers that far surpass anything I could design; of this I have no doubt. But I like designing things myself, from the ground up—it’s more fun and it helps me to actually understand important concepts and techniques.
Hence, this series of articles will explore practical, low-level PID control by means of a simple circuit that can measure the temperature of a resistive heating element. We will not go into the details of PID theory, which are aptly covered in An Introduction to Control Systems, and we will not incorporate every possible feature and refinement into our algorithm. Instead, we will try to illuminate the foundational principles of PID control by applying them to a straightforward temperature-control circuit.

Why PID?

A PID controller is a particular implementation of negative feedback:

To understand the enduring success of PID control, you first need to understand negative feedback’s venerable ability to easily accomplish complicated control tasks. Here I will quote from Negative Feedback, Part 1: General Structure and Essential Concepts: often in life,
we have an output variable of some kind that must be controlled, but the relationship between the control input and the actual behavior of the output is so complex or unpredictable that it would be difficult, if not impossible, to precisely regulate the output simply by applying a specified input.

The solution: negative feedback.
By simply subtracting the actual output value . . . from the reference signal and using the result [i.e., the “error” term] as the input to the open-loop amplifier, we can precisely control the load, even when the input-to-output relationship is inconsistent or complex.

In the case of a PID (proportional-integral-derivative) system, the “open-loop amplifier” is actually an algorithm that operates on the most recent error as well as previous errors and anticipated errors. Herein lies the elegance of PID control: the proportional term adjusts the output in response to the current state of the system, the integral term fine-tunes the output by accumulating past errors, and the derivative term makes the output more responsive by predicting future errors based on how the output is changing.

Circuit Design

The functionality of this project is essentially that of a thermostat: the “heater” is simply a 2.4 Ω, 5 W resistor. The feedback signal is provided by a K-type thermocouple in conjunction with the MAX31855 thermocouple-to-digital converter. However, our thermostat is more interesting than the typical household variety because it’s not limited to “on” and “off”; rather, we can choose from 256 different levels of heater power. This is accomplished with the following circuit:

The leads of the heating-element resistor are screwed into the two terminals of terminal block J7, so when you look at J7, imagine a resistor in its place:

The DAC is an 8-bit voltage-output device controlled by the EFM8 microcontroller via SPI. The reference voltage (provided by the EFM8) is 2.4 V, so the DAC’s output range is 0 V to 2.4 V in steps of (2.4 V)/(28) = 9.4 mV. The puny DAC output driver can continuously source only about 10 mA, and we’re not going to get much heat out of our resistor with only 10 mA. This is where the op-amp and BJT (p/n DSS20201L from Diodes Inc.) come into play.
We could simply use the op-amp to buffer the DAC output, but the op-amp’s output-current capacity is also insufficient. So what you see here is the standard circuit for increasing an op-amp’s drive capability. The BJT can sustain continuous collector current of 2 A, which is more than enough for our purposes. The control voltage (i.e., the DAC output voltage) is applied to the op-amp’s positive input. The general circuit configuration is that of a unity-gain voltage follower, but notice how the feedback signal (connected to the op-amp’s negative input) comes from the voltage applied to the heating element, not from the op-amp’s output terminal. This arrangement tells the op-amp to adjust its output voltage in whatever way is necessary to ensure that the voltage applied to the heating element is the same as the control voltage.

Another important detail is the following: Although the op-amp does not directly drive the heating element, its output-current capacity is not irrelevant. The current flowing into the base of Q1 will be approximately equal to the heater current divided by the BJT’s active-region DC current gain, otherwise known as beta or hFE. (Note that Q1 will always be in cutoff or active mode, because the base voltage will not exceed 2.4 V + ~0.7 V = 3.1 V, whereas the collector is always at 5 V. An npn transistor will not enter saturation as long as the base voltage does not exceed the collector voltage by more than ~0.4 V.) The minimum beta for our transistor is 200, so if we are driving 1 A into the heating element, the op-amp must be able to supply 5 mA to the base. I think that just about any op-amp can handle 5 mA, but if you modify this circuit for significantly higher heater current, remember to confirm that your op-amp can safely provide the necessary base current.

The Heater

There are basically two requirements for the heating-element resistor: its resistance must be very low so that our low drive voltages will produce high current, and its power rating must be sufficiently high (much higher than what we are used to with typical through-hole or surface-mount resistors). I can’t draw much more than 1 A from the USB charger I am using as a power supply, so I chose a resistance of 2.4 Ω: the maximum drive voltage is 2.4 V, and thus when the drive voltage is at max, the current will also be at max. The power dissipation at max current is simply 2.4 V × 1 A = 2.4 W. I like to maintain about 2x safety margin, so a 5 W resistor will do the trick. Here is a photo of the hardware setup:

Even at 1 A this system does not generate huge amounts of heat, so during operation I extend the usable temperature range by wrapping the resistor in fluffy insulating fabric:


Conclusion


We introduced the general concept and benefits of PID control, and we discussed in detail the “thermostat” circuit that we will use to explore PID functionality. In the next article we will focus on the firmware needed to gather temperature data from the MAX31855 and to adjust the heater drive current via the DAC.

Share this:

ABOUTME

Hi all. This is deepak from Bthemez. We're providing content for Bold site and we’ve been in internet, social media and affiliate for too long time and its my profession. We are web designer & developer living India! What can I say, we are the best..

Post a Comment
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Labels

EDITORIALS ARTICLES LEKULE TV DC ROBOTICS DIGITAL SEMICONDUCTORS GENERATOR AC EXPERIMENTS MANUFACTURING-ENGINEERING REFERENCE FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT TRANSDUCER & SENSOR VIDEO ARDUINO RENEWABLE ENERGY AUTOMOBILE TEARDOWN SYNCHRONOUS GENERATOR DIGITAL ELECTRONICS ELECTRICAL DISTRIBUTION CABLES MICROCONTROLLER AUTOMOTIVE SOLAR PROTECTION DIODE AND CIRCUITS ELECTRONICS BASIC ELECTRICAL MOTOR SWITCHES CIRCUIT BREAKERS CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES WEARABLES CAMERA TECHNOLOGY COMMUNICATION GENERATION BATTERIES FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE CONTROL SYSTEM NUCLEAR ENERGY POWER SMATRPHONE FILTER`S BIOGAS BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS ENERGY SOURCE PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR HOME AUTOMATION 555 TIMER CIRCUITS AUTOCAD BLUETOOTH C PROGRAMMING HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY COMPUTER DEFECE & MILITARY FLUORESCENT LAMP INDUSTRIAL ROBOTICS ANDROID ELECTRICAL DRIVES GROUNDING SYSTEM CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS USB ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE APPS & SOFTWARE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS CONTROL MOTION ELECTRICAL LAWS INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RECTIFIER AND CONVERTERS RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS DC MOTOR DRIVES ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS WIRELESS BUILDING SERVICES COMPRESSOR CRANES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION INDUSTRIAL DRIVES LAPTOP SCIENCE THERMOCOUPLE TRIGONOMENTRY REFERENCE UART oscilloscope BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING ELECTROMECHANICAL FEATURED FILTER DESIGN HARDWARE JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER VALVE COLOR CODES ELECTRIC TRACTION FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF