12-29-14, 11:10 AM | #61 |
Administrator
Join Date: Aug 2008
Location: Germantown, WI
Posts: 5,525
Thanks: 1,162
Thanked 374 Times in 305 Posts
|
I find it odd that your sensors are so far off. When I tested mine, they were pretty accurate.
__________________
Current project - To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. & To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. |
12-29-14, 10:08 PM | #62 |
Master EcoRenovator
Join Date: Aug 2012
Location: Toronto
Posts: 958
Thanks: 40
Thanked 158 Times in 150 Posts
|
You might want to increase the turn on dT to about 6-8C. Turn off can be 4c. The reason is quite simple, the panel will start at a perceived temp but within in few seconds of flow that temp will change, either up or down depending on conditions. With a small dT, the pump will be on and off too often and it will be hard to get a constant flow.
|
01-01-15, 06:42 AM | #63 |
Lurking Renovator
Join Date: Dec 2014
Location: USA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
What I ended up doing is modifying the readings:
Ssensor += analogRead(SsensorPin) / 2.5; and the temps are where I would expect them to be. |
01-01-15, 11:31 AM | #64 |
Administrator
Join Date: Aug 2008
Location: Germantown, WI
Posts: 5,525
Thanks: 1,162
Thanked 374 Times in 305 Posts
|
nkuck, I would suggest a static offset to correct things. Say your sensor reading is off by 10F, just add 10 to the Ssensor variable. With the current way you're doing it, it may read normal at the temperatures you're reading, but as you get farther from those temperatures your readings will get farther and farther off.
Here is what I would do: Code:
// read sensor inputs, convert to degrees, and assign to variables Counter = 0; while(Counter < SensorReadings) { Ssensor += analogRead(SsensorPin) / 2; Tsensor += analogRead(TsensorPin) / 2; Counter++; digitalWrite(ledPin, HIGH); Delay(250); digitalWrite(ledPin, LOW); Delay(250); } // calculate average temp from sensor inputs Ssensor = Ssensor / SensorReadings; Tsensor = Tsensor / SensorReadings; // calibrate sensors Ssensor = Ssensor + 10; Tsensor = Tsensor + 13; This is just an example. Replace the 10 and 13 with whatever the readings seem to be off by. This will create a linear offset that won't drift as the temperature varies.
__________________
Current project - To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. & To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. |
01-01-15, 11:48 AM | #65 |
Lurking Renovator
Join Date: Dec 2014
Location: USA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
Good idea. Thank you. Happy New Year.
|
01-02-15, 08:58 AM | #66 |
Lurking Renovator
Join Date: Dec 2014
Location: USA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
Here is my current sketch and most everything is working fine, except:
When I activate the external relay (a Reeed Relay Shield) both the Ssensor and the Tsensor temps rise 10-20 degrees and stay high until the relay disengages. Could there be some internal heat being generated by the load? Doesn't seem like it would be high enough to make a difference. Thanks for all of your support and patience. // Pins int SsensorPin = 4; // the pin to read solar panel temperature int TsensorPin = 5; // the pin to read water tank temperature int RelayPin = 7; // the pin to control the pump relay int ledPin = 13; // led pin to verify relay on condition int vref; // Variables int Ssensor = 0; // holds the value from SsensorPin int SensorOnDiff = 0; // holds the Ssensor value plus on differential (OnDiff) int SensorOffDiff = 0; // holds the Ssensor value plus off differential (OffDiff) int Tsensor = 0; // holds the value from TsensorPin int SensorReadings = 5; // number of sensor readings to take int Counter = 0; // sensor readings loop counter int OnDiff = 4; // temp diff that must exist to turn pump on (dec F) int OffDiff = 2; // temp diff that must exist to turn pump off (deg F) // initialize the library with the numbers of the interface pins #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { pinMode(SsensorPin, INPUT); pinMode(TsensorPin, INPUT); pinMode(RelayPin, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); digitalWrite(RelayPin, LOW); // turn pump off // set up the LCD's number of columns and rows: lcd.begin(16,2); } void loop() { // read sensor inputs, convert to degrees, and assign to variables Counter = 0; while(Counter < SensorReadings) { Ssensor += analogRead(SsensorPin) / 2; delay(50); Tsensor += analogRead(TsensorPin) / 2; delay(50); Counter++; digitalWrite(ledPin, LOW); delay(250); } // calculate average temp from sensor inputs //Ssensor = (500.0 * Ssensor / SensorReadings) / 1024; // Tsensor = (500.0 * Tsensor / SensorReadings) / 1024; Ssensor = Ssensor / SensorReadings; Tsensor = Tsensor / SensorReadings; // calibrate sensors Ssensor = Ssensor - 15; Tsensor = Tsensor - 16; // add temperature difference to Ssensor value SensorOnDiff = Ssensor - OnDiff; SensorOffDiff = Ssensor - OffDiff; // Print temps to the Computer Serial.print("Solar temp= "); Serial.println(Ssensor); Serial.print("Tank temp= "); Serial.println(Tsensor); // Print temps to the LCD // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 0); lcd.print("Solar="); lcd.print(Ssensor); delay(50); lcd.print((char) 223); lcd.print("F"); lcd.setCursor(12, 0); lcd.print("Pump"); lcd.setCursor(0, 1); lcd.print("Tank ="); lcd.print(Tsensor); delay(50); lcd.print((char) 223); lcd.print("F"); // if heat source is warmer than heat sink sensor, enable relay if (SensorOnDiff > Tsensor) { digitalWrite(RelayPin, HIGH); digitalWrite(ledPin, HIGH); lcd.setCursor(13, 1); lcd.print("ON "); delay(500); } // if heat source sensor is cooler than heat sink sensor, disable relay if (SensorOffDiff < Tsensor) { digitalWrite(RelayPin, LOW); digitalWrite(ledPin, LOW); lcd.setCursor(13, 1); lcd.print("OFF"); delay(500); } } |
01-02-15, 09:58 PM | #67 |
Administrator
Join Date: Aug 2008
Location: Germantown, WI
Posts: 5,525
Thanks: 1,162
Thanked 374 Times in 305 Posts
|
That sounds like a very odd problem. It also sounds more like a wiring problem. Can you describe your setup and possibly provide a wiring diagram?
__________________
Current project - To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. & To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. |
01-04-15, 07:54 PM | #68 |
Lurking Renovator
Join Date: Dec 2014
Location: USA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
I don't have a drawing worked up, but I'm thinking...is there a possibility that the way I am using the digital pins and analog pins, with the serial and lcd display, that there is a conflict going on? The wiring is OK per the pins that I have selected. Thank you for looking at this.
|
01-05-15, 03:34 AM | #69 | |
Apprentice EcoRenovator
Join Date: Jul 2014
Location: Finland
Posts: 125
Thanks: 5
Thanked 35 Times in 34 Posts
|
Quote:
Have I read that correctly? If so, are you sure you can do that? Do you really have it wired up that way? |
|
01-05-15, 05:37 AM | #70 |
Lurking Renovator
Join Date: Dec 2014
Location: USA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
That's precisely my question. I am tryi g to use the analog pins 4 & 5 for the temp inputs amd the digitals for the lcd, but I am not sure if I am setting them up properly and calling them correctly. That may be the reason for my weird readings
|
Tags |
arduino, controller, differential, thermal |
|
|