Pages: 1 [2]   Go Down
Author Topic: Relais and Temperture  (Read 1253 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
is this clear for u?
The parts that you have described, yes.

What kind of switch is it? Momentary contact push button? Toggle switch? Slide switch?

Quote
Afther a few day's  it seems that the Fan is not working anymore
How is that hardware problem going to be addressed in software?

We're struggling here to understand what the code needs to do.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, PaulS

If i will put the comlete code here, i get to many questions what this is and what for. u will understand.
Quote
That can't be your entire code, you need to post all for someone else to find mistakes.
All my other code is working fine, so i dont need to post.

i tought to put a part and working code in the post to get some help how i can solve this protection.


I dont understand all the questions i get.
I just have a simple on / off switch http://www.rc-point.nl/N_frame.html?http://www.rc-point.nl/schakelaar-toggle-2-standen-ON-OFF-6-polig--nr.-70721-Bubble-N_art_65233.php
+5v = HIGH & gnd = LOW (analog input pin 5)

and want to switch on with the code a relais. this is not the issue, toggle the relais on and off.

i just want to switch the relais (digital output pin 5) automatic off and stay off when the temperture reach the >100 celsius. this can only happend when there a problem with the cooling fan.
it must never switch on again unless we manual the switch first off and then back on afther we have repaired the cooling fan. The fan has it's own control in the code, using for example the LM35 and has nothing to do with this relais issue.


i wanna thank u for the help so far. i hope u still can.
if u want i can send u by email the complete project.

Thank u in advange.
ed.
« Last Edit: September 22, 2013, 08:49:39 am by Midway » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I just have a simple on / off switch
The picture shows a double pole, double throw switch. That is hardly a "simple on/off switch".

A schematic would be good.

Quote
i just want to switch the relais automatic off and stay off when there is a problem.
it must never switch on again unless we manual the switch first off and then back on afther we have repaired the cooling fan.
Code:
boolean aProblemOccurred = false;

void loop()
{
   if(aProblemOccurred)
   {
      // Turn relay(s) off
   }
   else
   {
   }
}

In the else block, you need to detect a transition from not pressed to pressed to turn the relay on, and a transition from pressed to not pressed to clear the aProblemOccurred flag.

You really must keep track of the previous state of the switch, in order to detect the transitions.

How do you detect that a problem occurred? Is that when the temperature rises over 100 degrees?

Is the fan supposed to be turned on when the temperature is above 50? Is it to be turned off when the temperature is below 50?
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3693
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The reason that you're getting so many questions is that you have a clear idea of what your hardware is and what you need. We really didn't. I'm still curious about why the system has to stay off once it overheats. Normally, I'd expect to turn it on again when it cools down.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Normally, I'd expect to turn it on again when it cools down.
I think that the idea is that someone goes and looks at the site, to try to determine what caused the system to overheat, before the system is turned back on.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How do you detect that a problem occurred? Is that when the temperature rises over 100 degrees?
yes.

Quote
Is the fan supposed to be turned on when the temperature is above 50? Is it to be turned off when the temperature is below 50?
The Fan is seperate controlled by a sensor and speeding from slow to fast when the temperture rises. it will only stop cooling when the temperture is for example <25 celsius
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I think that the idea is that someone goes and looks at the site, to try to determine what caused the system to overheat, before the system is turned back on.

Absoluut right
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
yes.
Code:
if(temperature > 100)
  aProblemOccurred = true;

The rest, then, is just a matter of detecting the transition from pressed to released (clear the flag) or from released to pressed (activate the relay(s)) and read the temperature and control the fan.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3693
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Without any real data to back this up, I'd be more inclined to software as the cause of your fan problems. From those pictures, the fan appears to be a piece of PC cooling equipment and it looks as though it would be easy enough to swap out to test the theory.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So lets start again, i am a little confused right now.

this is the working code so far. in this code i need to add this protection.

Code:
const int Bias_Switch = A5;                                              // the number of the Bias switch analog input pin A5.    
const int Bias_Relais = 2;                                               // the number of the Bias_Relais digital output pin 2.

boolean mySet = false;
boolean Bias;


void setup() {
  pinMode(Bias_Switch, INPUT);                                           // sets analog pin 5 for input.
  digitalWrite(Bias_Switch, LOW);                                        // turn on pullup resistors
  pinMode(Bias_Relais, OUTPUT);                                          // set the digital pin as output.
}
void loop() {
  Bias = digitalRead(Bias_Switch);                                       // read the value DUMMY.
  Bias = digitalRead(Bias_Switch);                                       // read the value from the Bias_Switch.

  if (Bias==HIGH) mySet = true;                                          // set bolean to true    
  else
    mySet=false;

  digitalWrite(Bias_Relais, mySet);
}

i have test this sketch and it work!.

Now we need to add the to high temperature protection.

status normal operational:
Bias = HIGH
Bias_Relais = HIGH

My temperture sensor named in the code: tempC

status when there is a "to heat" problem.
tempC>100
Bias = HIGH
Bias_Relais = must be switched automatic to LOW and stay LOW. When the problem on site is fixed, I have to reset manual the BIAS switch to LOW and switsch on back to HIGH.

hope i have explain it a little better now.



« Last Edit: September 22, 2013, 09:40:02 am by Midway » Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3693
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
const int Bias_Switch = A5;                                              // the number of the Bias switch analog input pin A5.     
const int Bias_Relais = 2;                                               // the number of the Bias_Relais digital output pin 2.
const int MaxTemp = 100;

boolean Bias;
boolean OverTemp=false;  // Did the temp go over MaxTemp since bias_switch has been HIGH?
int tempC;

void setup()
{
pinMode(Bias_Switch, INPUT);                                           // sets analog pin 5 for input.
digitalWrite(Bias_Switch, HIGH);                                        // turn on pullup resistors
pinMode(Bias_Relais, OUTPUT);                                          // set the digital pin as output.
}

void loop()
{
Bias = digitalRead(Bias_Switch);                                       // read the value from the Bias_Switch. Once is enough
if(Bias)
  {
  //Read temp here if it isn't already freshly read
  if(tempC > MaxTemp)
    {
    OverTemp=true;
    }
  if(OverTemp)
    {
    digitalWrite(Bias_Relais,LOW);
    }
  else
    {
    digitalWrite(Bias_Relais,HIGH);
    }
  }
else
  {
  OverTemp=false;  // Bias switch is off, we can reset the OverTemp flag.
  digitalWrite(Bias_Relais,LOW);
  }
}

In my own code, I would not have put in curly braces for the single line if blocks, but folks here like (justifiably) to see them in example code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@ wildbill

Thank u very much for the solution and code.

I have tested it in the project and now everything is working as planned.

regards,
Ed
Logged

Pages: 1 [2]   Go Up
Jump to: