PID Temperature Controller: Instructables
PID Temperature Controller: Instructables
by AdrienR
My friend is building a plastic extruder for plastic When I heard that he needed to by several PID
recycling (https://preciousplastic.com). He needs to controllers to control all these nozzle heater bands, it
control the extrusion temperature. For that purpose he immediately gave me the desire to try to make our
is using a nozzle heater band. In this nozzle, there is own.
a thermocouple and a heating unit which allow us to
measure the temperature and finally reach the
desired temperature (make a retroaction loop).
Tools
Material
Bakelite single side copper plate (60*35 mm minimum) (I ruined my saw buying the fiberglass one
so be careful: Bakelite)
Attiny45 microcontroller
LM2940IMP-5 voltage regulator
AD8605 operational amplifier
NDS356AP transistor
a bunch of resistors and capacitors (I have the SMT 0603 adafruit book)
230V-9V ac-dc transformer
1N4004 diodes
solid state relay
nail polish (optional)
I used my Proxxon MF70 CNC transformed and a machine, I cleaned the routes with a cutter and tested
conical end bit to mill the PCB. I think that any them with a multimeter.
engraving end bit would work. The Gcode file was
directly generated by eagle and the pcb-gcode plugin. Parameters: feed rate 150mm/min, depth 0.2mm,
Only three passes where done to ensure a good route rotation speed 20'000 t/min
separation but without spending hours milling all the
copper. When the PCB went out of the CNC
Download
http://www.instructables.com/ORIG/FXM/8C4H/JFX0FRXT/FXM8C4HJFX0FRXT.sch
…
With the tweezer and the soldering iron, place the 0.05mV for each degree. With the gain of 371, I
components at the right places and solder it using flux obtain 18.5mV per degree from the amplifier output
(it helps) and beginning with the smallest (0.05*371). I want to measure around 200°C so the
components. Again, check with a multimeter that you amplifier output should be around 3.7V (0.0185*200).
don't have any short circuits or unconnected The result should not exceed 5V because I use the
elements. 5V reference voltage (external).
You can choose the amplifier gain by choosing the The image correspond to the first (not working)
resistor you want (gain=(R3+R4)/R4). I took 1M and version I made but the principle is the same. In this
2.7k so in my case the gain equal approximately 371. first version, I used a relay and put it right in the
I can't know the exact value because I am using 5% middle of the board. As soon as I was switching with
tolerance resistor. high voltage, I had spikes who made the controller
reboot.
My thermocouple is a J type. It means that it gives
Using an arduino like in this instructables: You should put all the parameters to zero (P=0, I=0,
https://www.instructables.com/id/How-to-Program-a... D=0, K=0) in the arduino sketch. They will be set
you can load the code. during the tuning step.
I used a pro trinket with a FTDI-USB cable to program If you don't see smoke or smell burnt, you can jump
the Attiny 45 but this method is equivalent. I then to the next step!
plugged the pin PB1 and GDN directly into the RX
and GND of the FTDI-USB cable to receive the serial
data and be able to debug.
Download
http://www.instructables.com/ORIG/FN3/M037/JFX0FRXJ/FN3M037JFX0FRXJ.ino
…
Caution: Never plug the power supply and the 5V When the controller starts, it sends the value red by
from the programmer at the same time! Otherwise the internal thermometer of the chip. This is how I
you will see the smoke I was taking about in the compensate temperature (without using a dedicated
previous step. If you are not sure to be able to respect chip). It means that if the temperature changes during
that, you can simply remove the 5v pin for the the operation, it will not be taken in account. This
programmer. I let it because it was more convenient value is very different from one chip to another so it
for me to program the controller without power supply has to be entered manually in the
and to test the controller without having the heater REFTEMPERATURE definition at the beginning of
heating like crazy in front of my face. the sketch.
Now you can branch the thermocouple on the Before connecting the solid state relay, verify that the
amplifier and see if you are measuring something voltage output is in the range supported by your relay
(respect the polarity). If your heating system is at the (3V to 25V in my case, the circuit generates around
room temperature, you should measure zero. Heating 11V). (respect the polarity)
it with hand should already lead to some small
values. These values are not temperatures in degree or
Fahrenheit but the result of the analog to digital
How to read these values? Simply plug the pins PB1 conversion so they vary between 0 and 1024. I use
and GDN directly into the RX and GND of the FTDI- the 5V reference voltage thus when the amplifier
USB cable and open the arduino serial monitor. output is near 5V, the conversion result is near 1024.
When you want to control a process, you have the The integrator term is here to avoid permanent error
value you measure (analogData), the value you want (it integrates the error). Concretely, it is a counter that
to reach (tempCommand) and a way to modify the is incremented or decremented if the error is positive
state of that process (seuil). In my case it is done with or negative. Then the correction is increased or
the threshold ("seuil" in french but much easier to lowered according to this counter. It has no
write and pronounce (pronounce "sey")) which mechanical equivalency (or you have an idea?).
determine how long the switch will be on and off (the Maybe there is a similar effect when you bring your
duty cycle) thus the amount of energy put in the car to the service and the mechanic notice that the
system. shocks are systematically too low and decide to add
some more preload.
Kfinal=K*tempCommand*0.9/X
I had access to the Moscow fablab (fablab77.ru) and wood and the PCB with two screws. I soldered the
their laser cutter and I am grateful. This opportunity terminal block to wires and to the PCB, added the
allowed me to make a nice package generated in one switch between the transformer and the PCB power
click by a plugin who makes boxes of the wanted input, connected the led to PBO with a resistor (300
dimensions (h=69 l=66 d=42 mm). There are two Ohms) in series. I also used nail polish for electrical
holes (diam=5mm) on the top for the led and the insulation. After the last test, I glued the box. That's it.
switch and one slit on the side for the programming
pins. I secured the transformer with two pieces of