# Need Help with the Arduino using a relay and a temprature switch

**URL:** <https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147>\
**Category:** General Guidance\
**Created:** [December 16, 2022, 9:37am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147 "2022-12-16T09:37:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 9:37am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/1 "2022-12-16T09:37:10Z")

</div>

Hello I was looking to build a overheating circuit using the Arduino, a temprature switch and a relay. Help needed.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 9:37am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/2 "2022-12-16T09:37:49Z")

</div>

Welcome to the forum

What code have you written so far ?

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 9:39am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/3 "2022-12-16T09:39:20Z")

</div>

I have not really written any of my own code. Would you maybe be willing to help me

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [December 16, 2022, 9:41am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/4 "2022-12-16T09:41:19Z")

</div>

Hello [themianer](https://forum.arduino.cc/u/themianer)

Provide a list of hardware used.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 9:43am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/5 "2022-12-16T09:43:13Z")

</div>

You will get plenty of help here once you have written some code

- have you looked at and tried the examples in the IDE ?
- exactly what type of temperature probe do you have ?
- can you read the temperature from it ?
- can you print the the temperatures to the Serial monitor ?
- can you turn the relay on and off under control of the Arduino ?

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 9:43am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/6 "2022-12-16T09:43:34Z")

</div>

For the moment i just want to test if the arduino can cut out a circuit if tempratures reach a 109 degrees celcius

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [December 16, 2022, 9:44am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/7 "2022-12-16T09:44:52Z")

</div>

yes

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 9:49am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/8 "2022-12-16T09:49:42Z")

</div>

Is there a way that we can talk on another platform, because I really think my idea has merit and I want to tell you the full story and idea without possible copy cats

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 9:51am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/9 "2022-12-16T09:51:52Z")

</div>

It sounds like you want to build a thermostat. If so, then it is hardly revolutionary so why all the secrecy ?

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 9:58am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/11 "2022-12-16T09:58:27Z")

</div>

Your first post in this topic described a thermostat  
You have had confirmation that an Arduino can read a temperature probe and control a relay based on the temperature

Please give us a clue to what you really want to know

If you are willing to pay for help then this topic can be moved to a more appropriate forum category. Please let me know if you would like me to do this

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 9:58am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/12 "2022-12-16T09:58:39Z")

</div>

Okay my idea is to build a car overheating circuit since the Arduino can run on 12 volt and car companies do not have something that can cut out the ignition at 109 degrees celcuis

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 9:59am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/13 "2022-12-16T09:59:56Z")

</div>

As I suggested, it is a thermostat and a simple one at that

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 10:01am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/14 "2022-12-16T10:01:19Z")

</div>

Okay now will you be willing to help me and if so will you be willing to do it for free or for payment and if so how much

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 10:02am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/15 "2022-12-16T10:02:16Z")

</div>

Will you be willing to help me

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [December 16, 2022, 10:03am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/16 "2022-12-16T10:03:17Z")

</div>

I, and others here, will certainly help you for free, but that implies some input from you

So, back to my earlier questions

> [@UKHeliBob](#):
>
> - have you looked at and tried the examples in the IDE ?
> - exactly what type of temperature probe do you have ?
> - can you read the temperature from it ?
> - can you print the the temperatures to the Serial monitor ?
> - can you turn the relay on and off under control of the Arduino ?

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 10:06am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/17 "2022-12-16T10:06:30Z")

</div>

Give my an hour and then I will come back to you

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [December 16, 2022, 10:29am UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/18 "2022-12-16T10:29:01Z")

</div>

What equipment do you have to do this thing?

MCU?

Temperature probe?

Which Relay?

Do you want help or do you want someone to just do it for you?

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 12:13pm UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/19 "2022-12-16T12:13:11Z")

</div>

Sorry for only coming back to you know I think I know how to build the first prototype.  
I want to make the onboard LED on pin 13 go LOW if a potentiometer reaches 5 K. I found a video witch helped me with this code, but I need your help adjusting it:

// C++ code  
//  
int sensorValue = 0;

void setup()  
{  
pinMode(A0, INPUT);  
pinMode(LED\_BUILTIN, OUTPUT);  
}

void loop()  
{  
// read the value from the sensor  
sensorValue = analogRead(A0);  
// turn the led off  
digitalWrite(LED\_BUILTIN, HIGH);  
// pause the program for milliseconds  
delay(sensorValue); // Wait for sensorValue millisecond(s)

```
sensorValue = analogRead(A0);

```

// turn the led off  
digitalWrite(LED\_BUILTIN, LOW);  
// pause the program for milliseconds  
delay(sensorValue); // Wait for sensorValue millisecond(s)  
}

---

<div class="post-metadata">

**Author:** ![themianer](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@themianer](https://forum.arduino.cc/u/themianer)\
**Post date:** [December 16, 2022, 12:15pm UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/20 "2022-12-16T12:15:19Z")

</div>

Sorry for only coming back to you know I think I know how to build the first prototype.  
I want to make the onboard LED on pin 13 go LOW if a potentiometer reaches 5 K. I found a video witch helped me with this code, but I need your help adjusting it:

// C++ code  
//  
int sensorValue = 0;

void setup()  
{  
pinMode(A0, INPUT);  
pinMode(LED\_BUILTIN, OUTPUT);  
}

void loop()  
{  
// read the value from the sensor  
sensorValue = analogRead(A0);  
// turn the led off  
digitalWrite(LED\_BUILTIN, HIGH);  
// pause the program for milliseconds  
delay(sensorValue); // Wait for sensorValue millisecond(s)

```cpp
sensorValue = analogRead(A0);

```

// turn the led off  
digitalWrite(LED\_BUILTIN, LOW);  
// pause the program for milliseconds  
delay(sensorValue); // Wait for sensorValue millisecond(s)  
}

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [December 16, 2022, 12:22pm UTC](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147/21 "2022-12-16T12:22:31Z")

</div>

Are you unable to use code tags with your postings?

Do you know about IF's?

```arduino
if ( potValue > IsToHigh )
{
do the thing
}

```

> **[W3Schools.com](https://www.w3schools.com/cpp/cpp_conditions.asp#:~:text=Use%20the%20if%20statement%20to%20specify%20a%20block,to%20be%20executed%20if%20the%20condition%20is%20true)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

Even though its perfectly fine in this application to use delay() it might be better for you to get right into millis()

Look at File|Examples|02.Digital|BlinkWithoutDelay to use millis() for timing instead of delay().  
[![](https://europe1.discourse-cdn.com/arduino/original/4X/7/2/5/72550a1f51f79bb8abb5708c6ae664717cc765b5.jpeg) ](https://europe1.discourse-cdn.com/arduino/original/4X/7/2/5/72550a1f51f79bb8abb5708c6ae664717cc765b5.jpeg)

> [@](#):
>
> Info about multi-things

> [@Demonstration code for several things at the same time](https://forum.arduino.cc/t/demonstration-code-for-several-things-at-the-same-time/217158):
>
> NOTE for newcomers. The demo is entirely contained in this Post and Reply #1. There is no need to read further unless you are interested. ...added 25Sep2014 There have been a few occasions recently where newcomers seemed to have difficulty applying the "blink without delay" and "state" concepts to a sketch that is intended to manage a number of concurrent actions. Its very time consuming to respond with suitable code examples - particularly as every case is a little different. I have prepared…

> [@](#):
>
> Finite State Machine

> **[The Finite State Machine](https://majenko.co.uk/blog/our-blog-1/the-finite-state-machine-26)**

```arduino
// C++ code
//
int sensorValue = 0;
int SomeValue = 1023/2;
void setup()
{
pinMode(A0, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  if ( analogRead(A0) > SomeValue )
  {
   digitalWrite(LED_BUILTIN, HIGH); 
  } else {
    digitalWrite(LED_BUILTIN, LOW);
  }
// read the value from the sensor
//sensorValue = analogRead(A0);
// turn the led off
//digitalWrite(LED_BUILTIN, HIGH);
// pause the program for milliseconds
//delay(sensorValue); // Wait for sensorValue millisecond(s)

//sensorValue = analogRead(A0);
// turn the led off
//digitalWrite(LED_BUILTIN, LOW);
// pause the program for milliseconds
//delay(sensorValue); // Wait for sensorValue millisecond(s)
} //loop()

```

[Next page](https://forum.arduino.cc/t/need-help-with-the-arduino-using-a-relay-and-a-temprature-switch/1066147.md?page=2)
