Pages: [1] 2   Go Down
Author Topic: Relais and Temperture  (Read 1097 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
I just want to learn more :)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I have the following question:

i have a Temperture controlled relais.
When my Bias_Switch = HIGH and the temperture are below <50 Celsius the relais are switches to HIGH (on).
When the temperture reached >50 the Bias_Relais must switches to LOW.

The problem i have is howto get the Bias_Relais LOW until i have maual switch the Bias_Switch to LOW and then back to HIGH.


Code:
Bias = digitalRead(Bias_Switch);                                         // read the value DUMMY.
      Bias = digitalRead(Bias_Switch);                                         // read the value from the Bias_Switch.

      if (tempC<50  &&  Bias == HIGH)                                          // read two status.

        Bias = HIGH;                                                           // PA is switched ON.

      digitalWrite(Bias_Relais, Bias);

      if (tempC>50  &&  Bias == HIGH)                                          // read two status.

        Bias = LOW;                                                            // PA is switched OFF cozz of HIGH Temperture.

      digitalWrite(Bias_Relais, Bias);

Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 42
Posts: 1488
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.

That can't be your entire code, you need to post all for someone else to find mistakes.

If your question is about how to prepare, you'd do that in the function void.setup().
There you can preset a defined value before it is actually read by the loop function.

Hope that answers your question.
If not, please post your entire sketch.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The problem i have is howto get the Bias_Relais LOW until i have maual switch the Bias_Switch to LOW and then back to HIGH.
Set a boolean flag, beenLow to false. When the switch is LOW, set the flag to true.

When the switch BECOMES HIGH, set another flag to true, indicating that the relays can now be triggered.

You might explain why this is necessary, though.
Logged

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

thanks for the answers.

i will try this tomorrow.


Quote
You might explain why this is necessary, though.

I just want to build a safety that it cannot destroy my expansive ATV RF Power Module.
If it reach this very high temp>100 , the problem are the FAN to cool down the RF Power Module.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I just want to build a safety that it cannot destroy my expansive ATV RF Power Module.
If it reach this very high temp>100 , the problem are the FAN to cool down the RF Power Module.
So, unless you toggle the switch to LOW and then HIGH, it's OK to burn up the power module? I don't get it.
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

This is part of a Amateur Television repeater controller, located on top of a building.

Dont worry, i know what Im doing or creating with electronics.

Half year ago, i have found the Arduino and this is really nice to create projects for my hobby.

It is sometimes only hard to understand how to write some code, but I am doing well so far and most projects are very nice working.

Thats why i have asked here some help, so i can understand how to do.

Any examples are offcourse welcome.


regards,
Ed.

Logged

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

Quote
Set a boolean flag, beenLow to false. When the switch is LOW, set the flag to true.

is this what u mean ?

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==true) mySet = true;                                          // set bolean to true     
  else
    mySet=false;

  digitalWrite(Bias_Relais, mySet);
}
« Last Edit: September 22, 2013, 06:39:03 am by Midway » Logged

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

I have only to add the safety protection in the code

Code:
tempC>100

then it must switch off and stay off until i toggle the switch.

but how?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  Bias = digitalRead(Bias_Switch);                                       // read the value DUMMY.
  Bias = digitalRead(Bias_Switch);
Why are you reading the switch twice? Since so little time elapses between readings, the odds are you are going to always get the same value. Does it matter if the readings are different, since the first value is overwritten?

You may be thinking of analogRead(), where, depending on the impedance of the connected device, it may be necessary to read twice, and discard the first value.

Reading a digital device twice, and discarding the first value is never necessary.

Code:
  if (Bias==true) mySet = true;                                          // set bolean to true     
The digitalRead() function returns HIGH or LOW, not true or false.

No, that is not how I was thinking of using mySet. If the switch becomes HIGH, and mySet is false, ignore the switch. If the switch becomes LOW, and mySet is false, set mySet to true. If the switch becomes HIGH, and mySet is true, then you want to read the temperature and toggle the relay as needed.

Of course, in order to determine that the switch becomes something, rather than is something, you need to keep track of the previous state. Look at the state change detection example.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like what you want to do is pretty simple, but from the foregoing explanations, I'm not able to understand the requirement. Can you give a bit more detail about what you're switching and why? I'm guessing its a power supply and equipment that heats up and can stay on until the temp is 50 degrees. If 100 degrees is reached (how? because it was turned off at 50) a fan comes on and everything else must be off?
Logged

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

@wildbill
Quote
If 100 degrees is reached (how? because it was turned off at 50) a fan comes on and everything else must be off?
the code i had written was >50 and must be original >100 celsius. u right i made a type mistake.

again the explanation where i want to use this for.
I just want to build a safety that it cannot destroy my expansive Amateur TV RF Power Module.
If it reach this very high temp>100 , the problem are the FAN to cool down the RF Power Module.
This is part of a Amateur Television repeater controller, located on top of a building. and not at home.

@ paulS
Quote
Why are you reading the switch twice?
i have read more values in my project, when i do not double readings it affecting the actual reading from other inputs / sensors.

ok, i ll now try to change some code to get this protection work.
« Last Edit: September 22, 2013, 07:21:24 am by Midway » Logged

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

like this ?

Code:
 Bias = digitalRead(Bias_Switch);                                       // read the value DUMMY.
  Bias = digitalRead(Bias_Switch);                                       // read the value from the Bias_Switch.

  if (Bias==HIGH) mySet = false;                                          // set bolean to
  else  
    mySet=true;
  digitalWrite(Bias_Relais, mySet);
  
  if (Bias==LOW) mySet = false;                                          // set bolean to
  else  
    mySet=false;
  digitalWrite(Bias_Relais, mySet);
  
  if (Bias==HIGH) mySet = true && tempC>100;                                          // set bolean to      
  mySet = false;
      digitalWrite(Bias_Relais, mySet);
}
« Last Edit: September 22, 2013, 07:54:03 am by Midway » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
like this ?
Not even close.

You keep saying that the purpose behind this code is to turn a relay, that controls a fan, on when the power supply gets too warm. Fine. But what is this switch for? Why do you want to turn the relay on, to cool off the power supply, only if this switch has been slid back and forth. That's the part I don't understand. That is not any kind of safety.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does the relay control the "expansive Amateur TV RF Power Module" or does it control the fan?
Logged

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

ok, Im sorry. i try to explain.

This project i am working on is a Hamradio, Amateur Television Transmitter "Radio Frequency Power moduul" that transmit TV signals so people (Hamradio users) can receive it from a large distance.

The equipement are to far away from our hand to control it.
So, to put the device operational it has a switch to turn it on (the relais turn the power on, on the RF moduul). now this part of the equipement is operational. we go home now.

Afther a few day's  it seems that the Fan to cool down the RF module, is not working anymore, maybe we have buy a cheap one,,
This Fan is cooling the RF module from the transmitter. When this module is to high temperture it will be destroyed.

1, the on/off switch outside the 19" cabinet must toggle the relais on
2, the fan has it's own control in the code, using for example the LM35

is this clear for u?

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

Pages: [1] 2   Go Up
Jump to: