Notifications
Clear all

need help with sketch for an Arduino temperature controller.

65 Posts
5 Users
14 Likes
6,206 Views
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

I tried using sketches from other projects. Not exactly what was going to work. I understand how the code works but writing is the issue. 

So, I need the Arduino to read a 2 prong K type probe and turn on a relay and be able to adjust the temperature (buttons or pot) with a display.

 

Componentes:

Arduino Uno r3

I2c 20, 4 display

2 relay module, only need 1

MAX6675 K type

buttons and potentiometer

adafruit I2C multiplexer if needed 

most anything else that could be needed.

 

I have been working on this project for 4 weeks.

I am not stupid, I just say things that are.


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 
Posted by: @thenewdays

I tried using sketches from other projects. Not exactly what was going to work. I understand how the code works but writing is the issue. 

So, I need the Arduino to read a 2 prong K type probe and turn on a relay and be able to adjust the temperature (buttons or pot) with a display.

 

Componentes:

Arduino Uno r3

I2c 20, 4 display

2 relay module, only need 1

MAX6675 K type

buttons and potentiometer

adafruit I2C multiplexer if needed 

most anything else that could be needed.

 

I have been working on this project for 4 weeks.

@thenewdays Welcome to the forum.

I am unfamiliar to the K type probe, maybe a better description would help. 

I think you want to do several things,

1. Get temperature readings

2. Display the temp

3. Change the temp

4. Pick a relay that ?? raises/lowers the temp ??

Help us to understand you so we can help.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

 K type is a 2 wire probe, they also can be 3 wire. Think meat thermometer. Best example. Lol

The relay turns on the heat by making connection with 2 wires.

Yes you are correct, temp read, temp display, temp adjustment. If the temp is low it turns on the relay and back off when temp is reached.

 

I am not stupid, I just say things that are.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@thenewdays Ok, not sure why yo need buttons or multiplxer. Here is a possibility, all I did was google arduino controlled furnace.

https://smarthomeblog.net/smart-arduino-thermostat/

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1112
 
Posted by: @thenewdays

K type is a 2 wire probe

They look like the temp sensor I plug into my multimeter.  I've not tried using them with a microcontoller board but whilst I was googling to see what they are this youtube came up so I post a link in case it helps


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 
Posted by: @thenewdays

 K type is a 2 wire probe, they also can be 3 wire. Think meat thermometer. Best example. Lol

The relay turns on the heat by making connection with 2 wires.

Yes you are correct, temp read, temp display, temp adjustment. If the temp is low it turns on the relay and back off when temp is reached.

 

Here's a starter sketch to help you on your way. I've assigned realistic pins for the potentiometer (potPin), SDA and SCL for the I2C connection and pin 3 for the relay.

You'll need to assign pin numbers for CLK (clkPin), CS (spin) and MISO (misoPin) to match your system.

there is a value (CELCIUS) defined as true (because I'm in Canada) which will read values from the sensor in Celsius degrees. If you change this value to false, it will read Farenheit.

You will need to change the defined values potLow and potHigh to define the range of temperature (in your preferred units) that you want the pot to cover.

Setting the defined value DEBUG to true will result in messages passed to the serial port whenever something significant happens. Changing it to false will remove all of the support code and reduce the size of your compiled sketch.

I can't test this and I'm off this afternoon, so please accept this in the spirit of "sloppy but fast" 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

Thank you very much! 

I will test it and let you know. I have most everything setup. Celsius is OK I know how to use a calculator. Lol

I am not stupid, I just say things that are.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

@byron that is the same video I seen and made the decision to try the max6675. 

I am not stupid, I just say things that are.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 

@thenewdays 

As I said you can change to Fahrenheit just by setting the CELSIUS define to file.

Also, I forgot to mention that you'll need to use the Adafruit version of the MAC6675 library.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

ok thank you. in process of setting it all up.

I am not stupid, I just say things that are.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

getting the following errors.

 

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"

temp_con:45:38: error: no matching function for call to 'MAX6675::MAX6675(int, int, int)'
MAX6675 sensor(11, 13, 12); // Make temp sensor object
^
In file included from C:\Users\thene\Docs\Sketch\temp_con\temp_con.ino:40:0:
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:49:3: note: candidate: MAX6675::MAX6675()
MAX6675();
^~~~~~~
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:49:3: note: candidate expects 0 arguments, 3 provided
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:45:7: note: candidate: constexpr MAX6675::MAX6675(const MAX6675&)
class MAX6675
^~~~~~~
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:45:7: note: candidate expects 1 argument, 3 provided
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:45:7: note: candidate: constexpr MAX6675::MAX6675(MAX6675&&)
C:\Users\thene\Docs\Sketch\libraries\MAX6675/MAX6675.h:45:7: note: candidate expects 1 argument, 3 provided
C:\Users\thene\Docs\Sketch\temp_con\temp_con.ino: In function 'float getTemperature()':
temp_con:114:19: error: 'class MAX6675' has no member named 'readCelsius'
temp = sensor.readCelsius();
^~~~~~~~~~~
exit status 1
no matching function for call to 'MAX6675::MAX6675(int, int, int)'
Library is already installed: Adafruit BusIO:1.11.3

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I am not stupid, I just say things that are.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 

 

@thenewdays 

You need to use the Adafruit version of the MAX6675 library. You have chosen unwisely.

Screen Shot 2022 04 05 at 7.12.56 PM

 

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@thenewdays Follow the instructions at the end and compile again.Only show us the first error.

NEVERMIND, follow @will 's advice

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 

@thenewdays 

I found another oopsie in the sketch.

In the subroutine "void turnHeatOff()" near the end of the sketch

Change the line 

heaterOn = true;

to

heaterOn = false;

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@thenewdays)
Member
Joined: 2 years ago
Posts: 29
Topic starter  

compiled fine. I guess i got click happy with the library. lol uploading and testing.

I am not stupid, I just say things that are.


   
ReplyQuote
Page 1 / 5