Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Programming Questions / Re: help with simple if..then program on: February 15, 2014, 10:31:37 am
Code:
[code]Thank's Wildbill, I was making things too complicated.
I changed the code to

if ( (temp >= 60 )
  {
  digitalWrite(outPin, LOW);
  Serial.println("Fan OFF");

}

  if  ( temp <50 )
  {
  digitalWrite(outPin, HIGH); 
  Serial.println("Fan ONN");

}


[/code]
2  Using Arduino / Programming Questions / Re: help with simple if..then program on: February 15, 2014, 09:41:16 am
Quote
How to ThermisterHIGH() and ThermisterLOW() differ from each other? Why do you need two identical functions?

ThermisterLOW()  is a return Thermister (there are two)  and has no function other than to see the returning water temperature.

Quote
Code:
  valHIGH=analogRead(0);      //Read the analog port 0 and store the value in val

  valLOW=analogRead(1);      //Read the analog port 0 and store the value in val

Notice the difference between your code and the comments. This may be your problem. This is why you shouldn't use magic numbers.

Sorry  should read
Code:
valLOW=analogRead(1);      //Read the analog port 1 and store the value in val

Quote
What value does Check contribute? You want to turn the fan on when one temperature is above 60 and off if another temperature is below 50. I can't see the logic in this. What happens of temp 1 is above 60 and temp2 is below 50? Should the fan be on or off?

No only one temperature. I want water heated when 50 or below up to 60  and then allowed to coll to 50 rather than the fan continuing switching on and off when at 60.1 and 59.9

I have streamlined the code to make more sence, I hope this helps make it clearer. THANK YOU FOR YOUR HELP AND LOOK FORWARD TO YOUR REPLY.
Code:
#include <math.h>         
int outPin = 13;
int Check = 0;
 
 
void setup() {           

 Serial.begin(9600);   
 pinMode(outPin, OUTPUT);   
}
 
double ThermisterHIGH(int RawADC) {  //Function to perform the fancy math of the Steinhart-Hart equation
 double TempHIGH;
 TempHIGH = log(((10240000/RawADC) - 10000));
 TempHIGH = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * TempHIGH * TempHIGH ))* TempHIGH );
 TempHIGH = TempHIGH - 273.15;              // Convert Kelvin to Celsius
 
 return TempHIGH;
}


 
 
  void loop() {           
  int valHIGH;               
  double tempHIGH;           
  valHIGH=analogRead(0);   
  tempHIGH=ThermisterHIGH(valHIGH); 
  Serial.print("HIGH");
 
  delay(500);           
 
  if ( (Check == 0) && (temp <= 60 ))
  {
  digitalWrite(outPin, HIGH);
  Serial.println("Fan ON");
  Serial.print("check=      ");
  Serial.println( Check);
}

  if  ( temp >= 60 )
  {
  digitalWrite(outPin, LOW); 
  Check = 1;
  Serial.println("Fan OFF");
  Serial.print("check=      ");
  Serial.println( Check);
}

if  ( temp <= 50 ) {
Check = 0;
}


}

3  Using Arduino / Programming Questions / help with simple if..then program on: February 15, 2014, 09:10:36 am
I have wired and written a program for temperature control. My aim is to control the fan burner. If fan is on it heats up and if off cools down. My parameters are if hotter than 60°C fan off, cool down to 50°C turn fan back on.

However I am getting random switching on and off with my 'Check' flipping around fro 1 to 0 when with in the 50 to 60° range.
All help appreciated, Here is my code;

Code:
#include <math.h>         //loads the more advanced math functions
int outPin = 13;
int Check = 0;
 
 
void setup() {            //This function gets called when the Arduino starts

 Serial.begin(9600);   //This code sets up the Serial port at 115200 baud rate
 pinMode(outPin, OUTPUT);   //This code sets up the Serial port at 115200 baud rate
}
 
double ThermisterHIGH(int RawADC) {  //Function to perform the fancy math of the Steinhart-Hart equation
 double TempHIGH;
 TempHIGH = log(((10240000/RawADC) - 10000));
 TempHIGH = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * TempHIGH * TempHIGH ))* TempHIGH );
 TempHIGH = TempHIGH - 273.15;              // Convert Kelvin to Celsius
 
 return TempHIGH;
}

double ThermisterLOW(int RawADC) {  //Function to perform the fancy math of the Steinhart-Hart equation
 double TempLOW;
 TempLOW = log(((10240000/RawADC) - 10000));
 TempLOW = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * TempLOW * TempLOW ))* TempLOW );
 TempLOW = TempLOW - 273.15;              // Convert Kelvin to Celsius
 
 return TempLOW;
}
 
 
  void loop() {             //This function loops while the arduino is powered
  int valHIGH;                //Create an integer variable
  double tempHIGH;            //Variable to hold a temperature value
  valHIGH=analogRead(0);      //Read the analog port 0 and store the value in val
  tempHIGH=ThermisterHIGH(valHIGH);   //Runs the fancy math on the raw analog value
  Serial.print("HIGH");
 
  delay(500);            //Wait half second before getting low value
 
  int valLOW;                //Create an integer variable
  double tempLOW;            //Variable to hold a temperature value
  valLOW=analogRead(1);      //Read the analog port 0 and store the value in val
  tempLOW=ThermisterLOW(valLOW);   //Runs the fancy math on the raw analog value
  Serial.print(tempLOW);   //Print the value to the serial port

  delay(500);            //Wait half second before getting low value
 
  if ( (Check == 0) && (tempHIGH <= 60 )) {
  digitalWrite(outPin, HIGH); Serial.println("Fan ON");Serial.print("check=      ");Serial.println( Check);
}

  if  ( tempHIGH >= 60 ) {
  digitalWrite(outPin, LOW);  Check = 1; Serial.println("Fan OFF");Serial.print("check=      ");Serial.println( Check);
}

if  ( tempHIGH <= 50 ) {
Check = 0;
}

}
4  Using Arduino / General Electronics / Re: Reading temperature on: February 15, 2014, 07:16:37 am
Sorry for being a bit thick but what does NTC stand for?
5  Using Arduino / General Electronics / Reading temperature on: February 15, 2014, 07:00:14 am
I am trying to record temperature using a thermistor but I am getting a 5°C fluctuation for a non varying set temperature.
I have used a 10K Ohm Resistor, would changing this value help?
This is how I have set it up
6  Using Arduino / Installation & Troubleshooting / Upload error on: January 23, 2014, 08:18:48 am
When I try to upload I get an error that reads in red text;

avrdude: stk500_getsync(): not in sync:  resp=0x30

I am a novice with arduino but this my second uno:  I  am using this uno straight out of sealed packaging. Is it faulty or have I forgotten something?

All help appreciated.
7  Using Arduino / Project Guidance / Re: Connecting to GPS antenna on: October 27, 2013, 09:11:01 am
Sorry but I am more into programming than elactronics
8  Using Arduino / Project Guidance / Re: Connecting to GPS antenna on: October 27, 2013, 09:08:10 am
I do mean antenna, so do I need a unit in between antenna and PC
9  Using Arduino / Project Guidance / Re: Connecting to GPS antenna on: October 27, 2013, 09:01:05 am
Just checked, I was wrong it has a co-axial connection.
10  Using Arduino / Project Guidance / Re: Connecting to GPS antenna on: October 27, 2013, 08:46:36 am
Yes the Trimble is serial, I was hope to link up to the computer to do some algorithms . May be via the UNO is not the way to go.
11  Using Arduino / Project Guidance / Connecting to GPS antenna on: October 27, 2013, 08:35:19 am
Hi, I don't know if this is the right section of the forum for this post?

I have read some where that you cannot connect a gps antenna to a UNO and a computer to the USB port of the UNO at the same time, is this true?

Also I have a Trimble antenna that I wish to use, would this be feasible to connect to the UNO?

Thank's in advance for any replies.
12  Using Arduino / General Electronics / Re: Opto couplers and relays - please clarify on: April 22, 2013, 12:59:17 am
HI Papu
I have recently used the opto coupler that came in the kit. I did not use the arduino as this was a separate project. I was wanting to change a very low amperage 12v supply to a higher amperage 12v. I used the opto with a 220ohms resistor between the +12v low supply and anode. The cathode to 0v. the higher amperage 12v to the collector. With power on the input side the emitter went high 12v.

So yes you can use an opto instead of a relay.
13  Community / Website and Forum / Re: Inserting serial monitor in the forum on: October 30, 2012, 04:37:30 am
Quote
Actually have been programming since I was 9 years old.
That really doesn't tell us much.
  Does this mean that you remember CP/M? ... Maybe PC-DOS?
  Does this mean that you remember that the eight function keys belong at the left end of the keyboard, opposite the numberpad?


Don
Yes I remember now but have been using Windows for too long now
14  Using Arduino / General Electronics / Re: Hall effect sensors on: October 23, 2012, 02:01:18 am
Hey,
I suggest that you do not use the attach interrupt function at all,try using the pulseIn function,as what you want the is the pulse,whenever the magnetic fields react with the sensor.
What do others think?

Is it possible to add another interrupt function, again RPM but for a slow shaft speed (circa 50 to 100 rpm)?
15  Using Arduino / General Electronics / Re: Hall effect sensors on: October 22, 2012, 01:09:10 am

Can you explain the *4 and the *10 ?    Looking at the code I expected other result (a growing value for smoothrpm).

The out put was a 1/4 of the RPM; example
Code:
rpm 3703   smooth rpm 925
so I added *4, the 10 was to try and get an even more average.
Pages: [1] 2 3 4