# arduino k type thermocouple

It will also have an LCD and some sort of control in order to be able to set your temperature value and also an Arduino inside that will create the PID algorithm. But before we do that, we first have to understand how temperature PID controller works. So today, we’ll build our own PID controller for temperature. Here I have a commercial PID controller, but this one is based on a relay. So is that that precise, because it will only turn on and off on a certain range and that will result in an oscillating value, but I want to build today it’s a fully PID controller for a very precise rate control. So today we will see how to read the temperature value using a k, type thermocouple, and then we will generate the PD algorithm inside of the arduino and apply a pitiable signal to a MOSFET in order to control the power plight or heating element for today’s project. I would use the nozzle from a 3d printer, since it already has the heating element inside, so it would be a great example in order to learn how PID controller works for temperature, so guys let’s get started Music. This project is brought to you by jl CPCB, which is a manufacturer of quick, PCB prototypes for more than 10 years, and is the site that i use for all of my PCBs. Once design applied, your Gerber files on the GLC PCB site get a full review of the PCB, select your desired settings and order.

The PCB for amazing prices, i’ve ordered ten of my prototype PCBs for only 2 and receive those in six days, crazy right so order. Your quality PCB and make your projects look a lot more professional what’s up. My friends welcome back. What I want is this block to have let’s, say exactly 100 degrees. I will control the real temperature using this thermocouple to read the data. I will use the max 60 675 module and control the PID algorithm with an Arduino finally to apply power. We will make a small circuit using a MOSFET or maybe a triac in case of high AC voltages. This will be a closed loop. The thermocouple measures the real values, the Arduino, creates the signal applied to the MOSFET, and this transistor will control the power of the heating element inside of the aluminum block and once again the thermocouple will measure the real value that’s why it is a closed loop. So the first thing is to understand how PD temperature control will work, as in any PD system, we need to define the final process in our case will be the final temperature that we want to achieve. In order to control this temperature, we will need a feedback, so any PID control will have some sort of feedback. In our case, that feedback is made using a k, type thermocouple that will measure the real temperature of the system. This type of control we’ll also need a set point which in our case, is the desired temperature.

The system will make the difference between the desired value and the feed from the output and using three constants, the proportional, the integral and derivative. We can change the output. According to the feedback, so if we want the heated block to have exactly 100 degrees, what we will do first, it supply power to it. This will start heating up by the time it reaches the setpoint value, which in this case is 100 degrees. The feedback will inform that to the PID control and this will start lowering the power applied to the heating element and in our example, that will be made using a PWM signal applied to a MOSFET that will control the voltage. That goes to the heating element. Inside of this aluminum block, so it is obvious if the real temperature is higher than the setpoint will lower the power value, but if the real temperature is lower than the setpoint well, we increase the power till it reaches the desired value. If we do just that, this is called a peak control or proportional control, and it will end up in a temperature oscillation between certain values and it will very difficult or never be stable. For that we add a D control or derivative. This kind of control will react to the speed of temperature change, so, for example, if I blow air on the aluminum block, the derivative will fast push the power to maximum in order to keep the same temperature.

Finally, we have the I or integral this will sum. The error on each loop, getting bigger and bigger, with each loop or in case of negative error, getting lower and lower the sum of all these parts. The P the I and the D makes a PID control. It is our job to find the correct constants for each of these PID elements, so guys let’s start building this project. The first thing that we will do is to see how to read the real temperature. This is a k, type thermocouple, and this is the max 66 75 breakout module. This will amplify and compensate the voltage created by the thermocouple. It has an SP communication, so we will have to connect these pins to the Arduino. Spi port now use these connections and let’s test it out on the breadboard. I connect the Mac 66 75 and the thermocouple be careful. The thermocouple has polarity so connect the positive to positive and negative to negative, now, connect the SP pins to the Arduino and also supply 5 volts and ground now upload this next code to the Arduino Uno. You can find the code below in the description and it is called thermocouple read: example: code: this code will just read the SPI data from the module, and that gives us the real temperature we print the value on this LCD screen. I hid the thermocouple with a lighter and there you go. I have the real value on the LCD by the way this LCD screen has I squared C communication, so you don’t need a lot of wires, just the data pin and the clock.

It starts to womble around and by that, maintaining the temperature, as you can see, if I try to cool down the heating element by blowing air with this tube, the pwm signal gets lower in order to keep the same value, so the control works. Now all the system needs is some sort of control, together with the LCD screen in order to view and also be able to set the desired temperature value. As this commercial PID controller has the set up and down buttons. For that, I will use this rotary encoder. It has a push button integrated, so I can use it to enter the setpoint menu and increase or decrease the value. This is the final schematic of this project. We have an LCD screen to print the values: the rotary encoder with push button inside for control, the thermocouple with the Max 60 675 module, the MOSFET and the BJT as a driver circuit that will control the power and the heating element make sure that the thermocouple Is touching the heating element in order to know the real value? I mount everything on the breadboard and now let’s test the new code which, by the way, you could also download from a link below and it is called PD temperature control code. The default value is now zero degrees press. The set button of the rotary encoder rotate the encoder in order to increase or decrease the temperature value. Now press the set button once again and now you can set the P constant for the PID control press.

It once again and select the I value finally press the button again and select the D value now, press the button and exit the menu and the new settings are stored. I set it once again to 100 degrees and now, as you can see, the real temperature starts increasing till it reaches the desired value and then it stays there. When we reach the desired value, you can see the P mm signal wombling in order to maintain the same value. So there you go, the PT of temperature works. I could 3d print a case for this project, just as the commercial one has, but since I will use this project for my soldering station in a future tutorial, I won’t do that now in that future project. I will use this Tony for what soldering iron with a thermocouple inside and make my own solder extension so stay tuned. For that guys have in mind that today’s project is only for DC power control, so only DC heating elements will work in the future. I will also make a tutorial on temperature PID control, but for AC 220 volts voltage using a track control, as in my past, trying to toriel. This here are 220 volts heaters, and I will use this to build my own filament, extruder and recycle. All of my bed 3d printed parts, but that is for another future video. If my videos helped you – and you would like to help my projects, I have a patreon campaign.

The link is down below. As always, I will really appreciate that guys and it will help my workshop for new projects and keep this channel going by the way. Thanks to all my patrons, I hope that you enjoyed this small tutorial on PID control. If so, don’t forget to click the like button like crazy and share this video with your friends. If you have any question about this video or any other, just leave it in the comment section below or on my QampA page also don’t forget to subscribe and watch all of my other great to Tory Alandra member.

# arduino k type thermocouple Social

official.arduino
2019-10-02T19:32:52+0000

👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
official.arduino
2019-10-02T19:08:01+0000

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself: http://bit.ly/2oC6L0Q

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr

Widget Construction

Thermocouple Sensor Module (SPI)

Originally posted 2016-06-05 23:10:35.

(Visited 250 times, 1 visits today)

## Comment (24)

1. كاش حاجة كاش حاجة says:

good job thanks, مشكور

2. كاش حاجة كاش حاجة says:

wen the video of dc pid?

3. Jack KraWatt says:

good work

4. peter holz says:

How did you power the DC heater and the Arduino? Did you use one or more power sources? If you only used one, would it work with two? I would like to use a Peltier-Element instead of the DC heater and my power source should be batteries. Since the Peltier-Element requires a lot of power and it is actually impossible to operate everything with one or two batteries, I wanted to use a battery for the Arduino and install a battery after the MOSFET as a power source for the Peltier-Element. Is this completely wrong and do you have any other ideas without using hundreds of batteries?

5. Benjamin Tourret says:

can you do something similar with air pressure? (PSI sensor) opening solenoid valve to reach desired PSI ? ability to demand 55 psi inside a cylinder , solenoid valve opens until psi is reached, closes after on its own.

1. Electronoobs says:

Hmmm I will look into that

2. Benjamin Tourret says:

@Electronoobs looking forward

3. Benjamin Tourret says:
6. Gior Soros says:

hey one question, is mosfet or triac the best control signal amplifier ?
or do you have a list of another choices?

7. JULIO ALEJANDRO VALDEZ says:

Podrias ponerlo en tu canal en español, o podrias ponerle subtitulos en español, por favor

8. Conor O'keeffe says:

Awesome Video!! I’m planning to use this to heat a water bath so will be measuring the temperature of the water, not the heating block. Do I need to tune the controller in these conditions or is it a case of once it’s tuned it’s tuned for all environments? Appreciate any help!!

1. DSLRinBUDGET says:

Hey man i want it for the exact same reason !! In case you figure it out can you let me know please ?

9. Rezo Kobaidze says:

how do you exclude room temperature error for thermocouple

10. Asanka Lakmal Morawaka says:

Great explanation, easy to understand..

11. Lenson Chian says:

WOW!! Really nice !! Hmmm, what other heating element i can used? my project is to heat water and maintain its temperature.

12. Mustafa Balcilar says:

Should the PID constants change if the setpoint is higher, like 200 or 300 degrees C?

13. ronc1357 says:

What change in the code needs to be made to read from Celsius to Fahrenheit

14. Visal Yim says:

Hello brother, I want to control voltage and feedback by voltage sensor
. I should to use MAX6675 or not?

15. Lucas Pollet says:

A big thank you! I eventually managed it..a lot of noobs error..that I overcomed! Could you do or suggest an explanation/tutorial on how to integrate the PID autotune function to the code you have here?

16. Harsh Parikh says:

Did anyone notice his t-shirt? Waba laba dub dub

17. peter holz says:

Do i need a 12V Power source or can i use less power like for example 5V?

18. peter holz says:

Where can i buy the breadboard? I cant find it anywhere pls help

19. steveeb says:

I haven’t even watched the video and I gave you a Thumbs Up. I hope this is exactly what I need to control my burnout oven.