PID Controller Tutorial and Build Information

  • Some of the links on this forum allow SMF, at no cost to you, to earn a small commission when you click through and make a purchase. Let me know if you have any questions about this.
SMF is reader-supported. When you buy through links on our site, we may earn an affiliate commission.

JC in GB

Master of the Pit
Original poster
OTBS Member
★ Lifetime Premier ★
Sep 28, 2018
3,625
2,855
Green Bay, WI
Good day all. It was suggested that I start up a PID controller tutorial thread. Sounded like a good idea to me so, here I am.

What is a PID in the first place?

P - Proportional
I - Integral
D - Derivative

These parameters describe gain formulas. Gain determines how fast and how hard your controlled device will turn on.

What are gain, error and setpoint?

Gain is the multiplication of the error that causes the circuit to start a correction. Error is the difference between the setpoint and the feedback from your sensor. In this case, the sensor is a thermocouple. Setpoint is the point at which you want the PID to regulate. (i.e. 250 F)

Proportional gain is a straight forward multiplication of feedback error times circuit gain. For example; if I had 1 volt of error on a proportional gain stage with a gain (Av) of 10, the output of the error amplifier would be 10 volts. Proportional gain will get you close to your set point regulation but it is sloppy when used alone for regulation.

Integral gain is an integration of error over time. Integral gain will smooth out your proportional peaks and valleys and will hold tight regulation if set correctly. PI regulation is good for most analog thermal control applications.

Derivative gain will push your PI hard in one direction or the other depending on the trending temperature. For example, if you open the smoker door, the sudden loss of heat will trigger your controller to turn full on faster with a derivative gain function than if only a PI loop were used.

How is heat controlled in the smoker?

In an electric smoker, heat is generated by a resistive element usually over 1000 watts. To control 1000 watts at 120 VAC, you need to control 8.333 Amps of current. To switch this much power, you need a relay or silicon switch capable of handling the voltage and current needed by the element.

Solid State Relays or SSRs are inexpensive and readily available silicon switches for DC control of AC switching.

Charcoal smoker:

The amount of air pushed through the fire box controls the internal temperature of the charcoal smoker. Regulation is achieved by using a fan that blows into the fire box and partially starving the smoker for air when the fan is off. Fans can be of AC or DC design but usually DC fans are easier to obtain in the size needed for controlling a smoker cabinet. Fans are turned on and off using a relay or silicon switch like an NPN transistor or N-MOSFET which are wired to pull the fan negative lead to ground when the device gate is energized.

Next discussion will cover how a PID is wired for use in controlling a smoker.

JC :emoji_cat:
 
Last edited:
PID wiring in a smoker.

This installment will assist you in getting power and feedback to your PID so you can set up control parameters if necessary.

Regardless of smoker type, you will have to account for a minimum of three things with your wiring.

1) Power Input
2) Power output
3) Feedback input

Power Input: Most PID controllers run off of AC voltage and they are largely standardized to run on either 120 or 220 VAC 50/60 Hz. Some controllers can run off of DC current. Input power wiring is the most important aspect of your wiring as an incorrect hook up can cause damage to your controller, trip breakers, or even give you a shock.

Power output: PID controllers use either an output relay contact or an SSR driver output. The SSR driver output is suitable for driving an SSR or a solid state switch like a transistor or MOSFET.

Relay contacts are rated for voltage and current so make sure your relay output will handle the current load you are expecting to drive.

SSR modules and silicon switches are selectable based on your needed voltage and current requirements. The SSR or silicon switch is wired in series with the load heater or fan.

Feedback Input: k-type thermocouples are largely used as a feedback device for temperature control. They are inexpensive and available in many configurations. Regardless of configuration, thermocouples work off a principle of two dissimilar metals connected together will produce a known voltage which changes with temperature. This change can be measured and converted into temperature data.

For this example we are going to use the REX C-100 PID controller but all PID controllers have the same basic functions and wiring.

The picture below is the wiring diagram for a REX C-100 controller with an SSR output.

REX C100 Pinout.jpg


Each number on the diagram corresponds to a screw on the back of the PID controller. The screws you can see in the picture are from top to bottom screw 1-5.

We will go through the wiring terminal by terminal.

1 - 2 AC Input: 120 VAC input (White - black or brown - blue wires for EU power cord) Polarity is not critical but you will have to pay attention when you wire in your SSR.

3 - No connection

4 - SSR out +

5 - SSR out -

6 - 7 Alarm relay contacts

8 - 9 Temperature input from resistive feedback device such as PT-100 probe

9 - 10 Temperature input from thermocouple feedback device

If you connect power and your thermocouple, you can now program and function test your controller. An LED on the front of the controller will tell you when the output is energized. If you set the temperature set point to 75 degrees F and grab and let go of the thermocouple, you can see the controller output LED turn on and off.

Next installment will cover wiring the PID controller to your AC power source, heating element, and SSR.

JC :emoji_cat:
 
Last edited:
Nice writeup.
And I even know what all the components are you mentioned. :emoji_astonished:
I used to be an electronic tech back in the day before I moved into software.
I don't have a clue as to how these things are made, after many messages back and forth with JC I asked him to start up a tutorial thread.
I think JC is going to help out a bunch of people, if not now, in the future.
I can't wait to try my hand at these PID gizmo's.
Electrical stuff has always been my kryptonite, so I'll be following his advice very closely, and asking way more question that he wants to answer. LOL!!!

Great write up JC, I'm waiting on the shopping list part, so I can order everything up.

Thanks a bunch, bruth'a.
Dan.
:emoji_fingers_crossed::emoji_thumbsup:
 
Nice writeup.
And I even know what all the components are you mentioned. :emoji_astonished:
I used to be an electronic tech back in the day before I moved into software.
I have done a bit of just about everything in electronics even a bit of programming. I even got a patent. It is for an incredibly boring generator synchronizer but it is there, lol. Now I am working as a bench tech.
 
I'm a PID believer and have written open source software for both smokers and kilns. Here's my offset stick burner's pid controller which uses a raspberry pi and no fans to control temps. It stays within a few degrees of the set point. Enjoy your cooks!

 
In this installment, I am going to cover the power wiring for a smoker heating element.

The photo below is a typical smoker heating element. (1200 Watts at 120VAC)

1689337101608.png


To understand how the control switch works in its most basic form, imagine the heating element connected directly to an AC power cord. To heat the smoker, you plug in the cord. When it is at your desired temp, you unplug the the cord. When the temp drops, you plug the cord back in. You repeat this over and over again until the cook is done.

To get better control, you want to add an SSR. In the photo below, the AC switch is on terminal 1 and 2 and the trigger is on terminals 3 and 4.


1689337800516.png


To wire the SSR to your power and your heating element, you want to run the SSR on the hot side of the AC supply. (white wire or brown for EU cord) To remember the EU cord colors, I always think of a Kentucky hot brown sandwich. :emoji_yum: :emoji_laughing:

Disconnect the hot wire from your heating element and connect it to terminal 1 on the SSR. Connect terminal 2 back to your heating element.

Now if you plug in the AC cord to the wall, power is available but the heating element is not drawing any current. This is because the SSR needs to be triggered with voltage on terminals 3 and 4.

To turn on the SSR, we grab a 9 volt battery we had laying around and connect the (+) to terminal 3 and the ( - ) to terminal 4. The SSR now turns on and the element starts to heat. To stop the current flow, simply remove the 9 volts from terminals 3 and 4. Be mindful of polarity on the trigger side of the SSR.

For safety, you should run no less than16 gauge wire for running 10 amps of current (1200 watts). I use 40 Amp Solid State Relay modules for my control switch. I would rather trip the breaker or blow a fuse than fry my SSR module so I spec it higher than what I need to just run the heating element.

Next installment will cover wiring the power section and control section together for automated control.

JC :emoji_cat:
 
Last edited:
I'm a PID believer and have written open source software for both smokers and kilns. Here's my offset stick burner's pid controller which uses a raspberry pi and no fans to control temps. It stays within a few degrees of the set point. Enjoy your cooks!

I just love the Raspberry Pi modules. A real genius invention.

JC :emoji_cat:
 
I have a couple Raspberry Pi 4's
Just use mine for Music servers though. Running Debian Linux 12 (Bookworm).
 
  • Like
Reactions: JC in GB
This installment will cover wiring the control and power sections together.

In the diagram below, the REX C-100 controller is interfaced with power, output, and feedback.

REX C_100 wring.jpg


Notice in the drawing above that AC hot (red line) is going to terminal 2 on the SSR then the heating element. (Yellow X lower right). In my prior explanation I suggested doing this in the opposite manner. This is not critical so either way will work. I chose terminal 1 as in and 2 as out for clarity.

The SSR trigger input, however, must be wired in the correct polarity.

The load attached to terminals 6 and 7 are for an alarm output. In this example, the alarm relay is switching line voltage through the load. You can run low voltage DC through the relay as well if desired.

The polarity on the thermocouple is also critical. Red to terminal 10 and blue to terminal 9.

The next installment will cover wiring the REX C-100 for running a blower fan.

JC :emoji_cat:
 
Last edited:
This installment will cover wiring the PID controller for use with a fan.

To run a blower for temperature control in the smoker, you can use the relay output to run your fan or you can use a silicon switch that is controlled by the SSR output of the PID controller.

With a relay set up, wiring is easier but using a silicon switch will likely increase the life expectancy of your controller.

The drawing below shows how to wire a REX C-100 controller with relay output for running a fan. Drawing is for European power 220 VAC 50 Hz but the design will work just as well using 120 VAC US power.

rex-c100_fan.jpg




Fan Driver.jpg


The drawing above is a simple ON/OFF silicon switch that acts in a similar fashion to a relay. The part values are not critical. Nearly any N-MOSFET that will handle the voltage and current will work. This circuit will only switch DC current.

The resistors fulfill the following functions.

R1 - Limits current into the MOSFET gate. This controls how fast the MOSFET turns ON and OFF.

R3 - Drains gate charge to ground turning off the MOSFET in the case of control output failure.

Below is a picture of a project board that could be used to make your DC switch.

1689597478183.png


The next installment will show a parts list and sourcing information.

JC :emoji_cat:
 
Last edited:
Where to get PID controller parts.

Most parts can be gotten off of Amazon but I usually like going through AliExpress because they have a larger selection of electronics parts and are usually less expensive. The downfall is delivery can be painfully slow at times.

PID controller:


This gives you the controller, thermocouple, and output solid state relay.

DC hook up wires:


This will give you easy to use connectors to power the PID controller and out put fan (if necessary) .

AC hook up connectors:


Quick connect (FastOn connectors)


Cable gland joints: For running cables into and out of enclosures


Aluminum project enclosure: (Suggest 150 or 200 mm length)


Blower fan assemblies:


Blower outlet tube:


Circuit project board:


Fan control MOSFET:


Resistor kit:





JC :emoji_cat:
 
Last edited:
Sheesh, at those prices, I might buy 1 or 2 just to play around with. :emoji_astonished:

Right you are. :emoji_sunglasses: A DIY for this kind of project has lots of inexpensive parts readily available.

I made my first controller right after recovering from the sticker shock of commercially available units.

JC :emoji_cat:
 
Right you are. :emoji_sunglasses: A DIY for this kind of project has lots of inexpensive parts readily available.

I made my first controller right after recovering from the sticker shock of commercially available units.

JC :emoji_cat:
Don't know if I did it right, but started a chat with you.
 
  • Like
Reactions: JC in GB
SmokingMeatForums.com is reader supported and as an Amazon Associate, we may earn commissions from qualifying purchases.

Latest posts

Hot Threads

Clicky