Author Topic: Water cooling thermometer  (Read 17280 times)

0 Members and 1 Guest are viewing this topic.

Offline YHB

  • VS Moderator
  • Posts: 905
Re: Water cooling thermometer
« Reply #20 on: December 14, 2016, 11:01:49 AM »

Bluc,

Typically;

I think you will find that you are not defining where to print lcd.print(SensorCondenserIn.getTempCByIndex(0));
this value will just be word wrapped after the previous print instruction where ever that happens to be.


SensorCondenserIn.requestTemperatures();
  lcd.print(SensorCondenserIn.getTempCByIndex(0));
  lcd.setCursor(0, 1);
  lcd.print("Conden In  c ");
  delay(50);

So add the red text.

SensorCondenserIn.requestTemperatures();
  lcd.setCursor(14, 1);
  lcd.print(SensorCondenserIn.getTempCByIndex(0));
  lcd.setCursor(0, 1);
  lcd.print("Conden In  c ");
  delay(50);

Hope that helps

very frustrating lol. I have tried another screen and another arduino the error is somewhere in the code..

Speaking from my own efforts, it usually is. :D

Toodlepip
Where Thrift Becomes An Art-Form

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #21 on: December 14, 2016, 11:51:07 AM »
Hats off to you yet again. That fixed it. Holefully i retain what i have learned will have to think of something else to build with arduino.
Thanks for all the help yhb couldnt have done it without you 8)

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #22 on: December 18, 2016, 12:48:50 PM »
Trying to add if and else statements for sensor error codes but cant get it working have been mucking round for days any ideas why they dont work? Here is the code.

Code: [Select]
include <OneWire.h>
#include <DallasTemperature.h>//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
float VapourTemperatureOne ;
float VapourTemperatureTwo ;
float VapourTemperatureThree ;
#define ONE_WIRE_BUS_CondenserIn 2
#define ONE_WIRE_BUS_CondenserOut 3
#define ONE_WIRE_BUS_ReCooled 1
// Setup Three oneWire instances to communicate with the Dallas sensors
OneWire oneWireCondenserIn(ONE_WIRE_BUS_CondenserIn), oneWireCondenserOut(ONE_WIRE_BUS_CondenserOut), oneWireReCooled(ONE_WIRE_BUS_ReCooled);


//DallasTemperature sensors(&oneWire);
DallasTemperature SensorCondenserIn(&oneWireCondenserIn), SensorCondenserOut(&oneWireCondenserOut), SensorReCooled(&oneWireReCooled);
//initilize screen and sensors
void setup(void)
{
 
  lcd.begin();
  lcd.backlight();
  SensorCondenserIn.begin();
  SensorCondenserOut.begin();
  SensorReCooled.begin();
  lcd.setCursor(2,1);                       //intro
  lcd.print(F("Cooling Temp by"));         //intro 
  lcd.setCursor(0,3);                       //intro
  lcd.print(F("Mal & Vissionstills"));            //intro 
  delay(3500);                              //intro
  lcd.clear();
 
}


void loop(void)
{
  VapourTemperatureOne = (SensorCondenserIn.getTempCByIndex(0));
  VapourTemperatureTwo = (SensorCondenserOut.getTempCByIndex(0));
  VapourTemperatureThree = (SensorReCooled.getTempCByIndex(0));
 
  SensorCondenserIn.requestTemperatures();
  lcd.setCursor(13, 0);
  lcd.print(SensorCondenserIn.getTempCByIndex(0));
   if (VapourTemperatureOne == -127) ;
{
  lcd.setCursor(0, 0);
 lcd.print("Sensor Fault");
}
else
{
  lcd.setCursor(0, 0);
  lcd.print("Conden In  c ");
}
 
  SensorCondenserOut.requestTemperatures();
  lcd.setCursor(13, 1);
  lcd.print(SensorCondenserOut.getTempCByIndex(0));
  if (VapourTemperatureTwo == -127);
{
  lcd.setCursor(0, 1);
 lcd.print("Sensor Fault");
}
else
{
  lcd.setCursor(0, 1  );
  lcd.print("Conden Out c ");
}
 
  SensorReCooled.requestTemperatures();
  lcd.setCursor(13, 2);
  lcd.print(SensorReCooled.getTempCByIndex(0));
 if (VapourTemperatureThree == -127);
{
  lcd.setCursor(0, 0);
 lcd.print("Sensor Fault");
}
 else
{
  lcd.setCursor(0,2);
  lcd.print("Re Cooled  c ");
  delay(1000);
}
 
  lcd.setCursor(3, 3);
  lcd.print("Cooling Temp ");
 
}

Offline wiifm

  • Posts: 351
Re: Water cooling thermometer
« Reply #23 on: December 19, 2016, 07:58:23 PM »
this might help bluc https://www.arduino.cc/en/Reference/Else

I am not sure what error you are getting or what results you are getting v what you are expecting

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #24 on: December 20, 2016, 05:50:06 AM »
was Just trying tro get it to print an error message "sensor fault" if the dallas sensor returned error "127". I get the error. I am getting "else without a previous if statement" error message..

Offline Eucyblues

  • Posts: 774
Re: Water cooling thermometer
« Reply #25 on: December 20, 2016, 06:19:11 PM »
bluc
A quick glance ...
lines 46,60, 74 "if (VapourTemperatureTwo == -127);"
dump the semi-colons from your if statements

 

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #26 on: December 21, 2016, 04:36:00 PM »
Will try tomorrow cheers eucy

Offline Edwin Croissant

  • Global Moderator
  • Posts: 428
Re: Water cooling thermometer
« Reply #27 on: December 22, 2016, 01:13:06 AM »
This compiles  ;D :

Code: [Select]
#include <OneWire.h>
#include <DallasTemperature.h>//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 20, 4);

float VapourTemperatureOne;
float VapourTemperatureTwo;
float VapourTemperatureThree;
#define ONE_WIRE_BUS_CondenserIn 2
#define ONE_WIRE_BUS_CondenserOut 3
#define ONE_WIRE_BUS_ReCooled 1
// Setup Three oneWire instances to communicate with the Dallas sensors
OneWire oneWireCondenserIn(ONE_WIRE_BUS_CondenserIn), oneWireCondenserOut(
ONE_WIRE_BUS_CondenserOut), oneWireReCooled(ONE_WIRE_BUS_ReCooled);

//DallasTemperature sensors(&oneWire);
DallasTemperature SensorCondenserIn(&oneWireCondenserIn), SensorCondenserOut(
&oneWireCondenserOut), SensorReCooled(&oneWireReCooled);
//initilize screen and sensors


void setup(void) {

lcd.begin(20, 4); // added parameters
lcd.backlight();
SensorCondenserIn.begin();
SensorCondenserOut.begin();
SensorReCooled.begin();
lcd.setCursor(2, 1);                       //intro
lcd.print(F("Cooling Temp by"));         //intro
lcd.setCursor(0, 3);                       //intro
lcd.print(F("Mal & Vissionstills"));            //intro
delay(3500);                              //intro
lcd.clear();

}

void loop(void) {
VapourTemperatureOne = (SensorCondenserIn.getTempCByIndex(0));
VapourTemperatureTwo = (SensorCondenserOut.getTempCByIndex(0));
VapourTemperatureThree = (SensorReCooled.getTempCByIndex(0));

SensorCondenserIn.requestTemperatures();
lcd.setCursor(13, 0);
lcd.print(SensorCondenserIn.getTempCByIndex(0));
if (VapourTemperatureOne == -127) {
lcd.setCursor(0, 0);
lcd.print("Sensor Fault");
} else {
lcd.setCursor(0, 0);
lcd.print("Conden In  c ");
}

SensorCondenserOut.requestTemperatures();
lcd.setCursor(13, 1);
lcd.print(SensorCondenserOut.getTempCByIndex(0));
if (VapourTemperatureTwo == -127)
{
lcd.setCursor(0, 1);
lcd.print("Sensor Fault");
}
else
{
lcd.setCursor(0, 1 );
lcd.print("Conden Out c ");
}

SensorReCooled.requestTemperatures();
lcd.setCursor(13, 2);
lcd.print(SensorReCooled.getTempCByIndex(0));
if (VapourTemperatureThree == -127)
{
lcd.setCursor(0, 0);
lcd.print("Sensor Fault");
}
else
{
lcd.setCursor(0,2);
lcd.print("Re Cooled  c ");
delay(1000);
}

lcd.setCursor(3, 3);
lcd.print("Cooling Temp ");

}

I had to change lcd.begin(); in lcd.begin(20,4); and I did what Eucyblues suggested.

Edit: it seems that lcd.begin(20,4) is not needed when I look at the examples in the library.
« Last Edit: December 22, 2016, 02:58:02 AM by Edwin Croissant »

Offline Edwin Croissant

  • Global Moderator
  • Posts: 428
Re: Water cooling thermometer
« Reply #28 on: December 22, 2016, 02:23:30 AM »
I made this using my Single DS18B20 library, it compiles ;D, not sure if it works  ;D

Code: [Select]
#include <Arduino.h>
#include <OneWire.h> //https://github.com/PaulStoffregen/OneWire
#include <SingleDS18B20.h> //https://github.com/EdwinCroissantArduinoLibraries/SingleDS18B20
#include <LiquidCrystal_I2C.h>

#define ONE_WIRE_BUS_CondenserIn 2
#define ONE_WIRE_BUS_CondenserOut 3
#define ONE_WIRE_BUS_ReCooled 1

// Setup oneWire instances to communicate with the Dallas sensors
OneWire oneWireCondenserIn(ONE_WIRE_BUS_CondenserIn), oneWireCondenserOut(
ONE_WIRE_BUS_CondenserOut), oneWireReCooled(ONE_WIRE_BUS_ReCooled);

// Setup SingleDS18B20 instances and pass our oneWire references.

SingleDS18B20 sensorCondenserIn(&oneWireCondenserIn), sensorCondenserOut(
&oneWireCondenserOut), sensorReCooled(&oneWireReCooled);

// Setup an instance of the liquid crystal libray

LiquidCrystal_I2C lcd(0x27, 20, 4);

// Declare variables

unsigned long LastSensorUpdate;

struct sensors {
bool CondenserInOk;
float CondenserInTemperature; // in C
bool CondenserOutOk;
float CondenserOutTemperature; // in C
bool ReCooledOk;
float ReCooledTemperature; // in C
} Sensors;

// Helper function to call a function at a certain interval

void doFunctionAtInterval(void (*callBackFunction)(), unsigned long *lastEvent,
unsigned long Interval) {
unsigned long now = millis();
if ((now - *lastEvent) >= Interval) {
*lastEvent = now;
callBackFunction();
}
}

// Helper function to initialize the sensor and start the conversion
// Useful when multiple sensors are used

bool initDS18B20(SingleDS18B20* sensor) {
if (sensor->setResolution(SingleDS18B20::res12bit)) {
return sensor->convert();
} else
return false;
}

//The setup function is called once at startup of the sketch
void setup() {
//initialize the sensors
Sensors.CondenserInOk = initDS18B20(&sensorCondenserIn);
Sensors.CondenserOutOk = initDS18B20(&sensorCondenserOut);
Sensors.ReCooledOk = initDS18B20(&sensorReCooled);
LastSensorUpdate = millis();

//initialize the liquid crystal display
lcd.begin(20, 4); // added parameters
lcd.backlight();

// intro
lcd.setCursor(2, 1);
lcd.print(F("Cooling Temp by"));
lcd.setCursor(0, 3);
lcd.print(F("Mal & Vissionstills"));
delay(2000);
lcd.clear();
}

// The loop function is called in an endless loop
void loop() {
doFunctionAtInterval(readSensors, &LastSensorUpdate, 1000);
}

void readSensors() {
if (Sensors.CondenserInOk && sensorCondenserIn.read()) {
Sensors.CondenserInTemperature = sensorCondenserIn.getTempAsC();
Sensors.CondenserInOk = sensorCondenserIn.convert();
} else Sensors.CondenserInOk = initDS18B20(&sensorCondenserIn); // Oops, we lost a sensor, try to reconnect

if (Sensors.CondenserOutOk && sensorCondenserOut.read()) {
Sensors.CondenserOutTemperature = sensorCondenserOut.getTempAsC();
Sensors.CondenserOutOk = sensorCondenserOut.convert();
} else Sensors.CondenserOutOk = initDS18B20(&sensorCondenserOut); // Oops, we lost a sensor, try to reconnect

if (Sensors.ReCooledOk && sensorReCooled.read()) {
Sensors.ReCooledTemperature = sensorReCooled.getTempAsC();
Sensors.ReCooledOk = sensorReCooled.convert();
} else Sensors.ReCooledOk = initDS18B20(&sensorReCooled); // Oops, we lost a sensor, try to reconnect

// output the values
lcd.setCursor(0, 0);
lcd.print(F("Conden In  c "));
lcd.setCursor(13, 0);
if (Sensors.CondenserInOk) lcd.print(Sensors.CondenserInTemperature);
else lcd.print(F("Error"));

lcd.setCursor(0, 1);
lcd.print(F("Conden Out c "));
lcd.setCursor(13, 1);
if (Sensors.CondenserOutOk) lcd.print(Sensors.CondenserOutTemperature);
else lcd.print(F("Error"));

lcd.setCursor(0, 2);
lcd.print(F("Re Cooled  c "));
lcd.setCursor(13, 2);
if (Sensors.ReCooledOk) lcd.print(Sensors.ReCooledTemperature);
else lcd.print(F("Error"));

lcd.setCursor(3, 3);
lcd.print(F("Cooling Temp "));
}

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #29 on: December 22, 2016, 06:12:31 AM »
Thanks edwin I did what eucy suggested and mine works fine heres the code
Code: [Select]
#include <OneWire.h>
#include <DallasTemperature.h>//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
float VapourTemperatureOne ;
float VapourTemperatureTwo ;
float VapourTemperatureThree ;
#define ONE_WIRE_BUS_CondenserIn 2
#define ONE_WIRE_BUS_CondenserOut 3
#define ONE_WIRE_BUS_ReCooled 1
// Setup Three oneWire instances to communicate with the Dallas sensors
OneWire oneWireCondenserIn(ONE_WIRE_BUS_CondenserIn), oneWireCondenserOut(ONE_WIRE_BUS_CondenserOut), oneWireReCooled(ONE_WIRE_BUS_ReCooled);


//DallasTemperature sensors(&oneWire);
DallasTemperature SensorCondenserIn(&oneWireCondenserIn), SensorCondenserOut(&oneWireCondenserOut), SensorReCooled(&oneWireReCooled);
//initilize screen and sensors
void setup(void)
{
 
  lcd.begin();
  lcd.backlight();
  SensorCondenserIn.begin();
  SensorCondenserOut.begin();
  SensorReCooled.begin();
  lcd.setCursor(2,1);                       //intro
  lcd.print(F("Cooling Temp by"));         //intro 
  lcd.setCursor(0,3);                       //intro
  lcd.print(F("bluc & Vissionstills"));            //intro 
  delay(3500);                              //intro
  lcd.clear();
 
}


void loop(void)
{
  VapourTemperatureOne = (SensorCondenserIn.getTempCByIndex(0));
  VapourTemperatureTwo = (SensorCondenserOut.getTempCByIndex(0));
  VapourTemperatureThree = (SensorReCooled.getTempCByIndex(0));
 
  SensorCondenserIn.requestTemperatures();
  lcd.setCursor(13, 0);
  lcd.print(SensorCondenserIn.getTempCByIndex(0));
   if (VapourTemperatureOne == -127)
{
  lcd.setCursor(0, 0);
 lcd.print("Sensor Fault");
}
else
{
  lcd.setCursor(0, 0);
  lcd.print("Conden In  c ");
}
 
  SensorCondenserOut.requestTemperatures();
  lcd.setCursor(13, 1);
  lcd.print(SensorCondenserOut.getTempCByIndex(0));
  if (VapourTemperatureTwo == -127)
{
  lcd.setCursor(0, 1);
 lcd.print("Sensor Fault");
}
else
{
  lcd.setCursor(0, 1  );
  lcd.print("Conden Out c ");
}
 
  SensorReCooled.requestTemperatures();
  lcd.setCursor(13, 2);
  lcd.print(SensorReCooled.getTempCByIndex(0));
 if (VapourTemperatureThree == -127)
{
  lcd.setCursor(0, 2);
 lcd.print("Sensor Fault");
}
 else
{
  lcd.setCursor(0,2);
  lcd.print("Re Cooled  c ");
  delay(1000);
}
 
  lcd.setCursor(3, 3);
  lcd.print("Cooling Temp ");
 
}

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #30 on: December 22, 2016, 06:14:46 AM »
next step switch a rely on and off to operate a thermo fan from the condenser out output..

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #31 on: December 22, 2016, 04:49:29 PM »
So I had an exciting/fulfilling day I learnt to get a second screen working without direct help and I also merged my parrot and my thermometer into one sketch/one arduino with dual displays  ;D here is a shot of when the penny dropped on getting the second display to work

http://i975.photobucket.com/albums/ae237/blucmal/Home%20brew/Resized_20161223_152420.jpeg
Water cooling thermometer


and here is a shot with the eparrot by shifu merged with my thermometer sketch.

http://i975.photobucket.com/albums/ae237/blucmal/Home%20brew/Resized_20161223_160210.jpeg
Water cooling thermometer


As always her is my sketch: (See below attachment)...

Still mostly copy and pasting but learning how the code works and the correct punctuation. Without shifu's eparrot code and everyone else's help that helped with my thermometer project it wouldn't have happened thanks to everyone. I want to get the splash screens synced so they start and last the same time. Then I will work on getting a relay working ;D

Offline Eucyblues

  • Posts: 774
Re: Water cooling thermometer
« Reply #32 on: December 22, 2016, 05:35:13 PM »
Well done bluc  :)

Getting something working is very gratifying

Addictive little hobby this............... ::)

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #33 on: December 23, 2016, 06:20:31 AM »
Never ceases to amaze me that you can talk, via code, to electronics and they do stuff for you. Just a matter of learning their language :D

Offline YHB

  • VS Moderator
  • Posts: 905
Re: Water cooling thermometer
« Reply #34 on: December 26, 2016, 11:40:44 PM »
Don't know how I missed this one!!

I have thought about two or more screens before and after seeing these then I think I may look at it again.

Impressive stuff.

 /thumbsUp
Where Thrift Becomes An Art-Form

Offline Eucyblues

  • Posts: 774
Re: Water cooling thermometer
« Reply #35 on: December 27, 2016, 02:37:14 AM »
bluc - you've caught the old 'zip file redirect' bug - there's a trick to uploading zip files so others can download - YHB amd wiifm have posts on it - I can't recall atm what the steps are 

Offline YHB

  • VS Moderator
  • Posts: 905
Re: Water cooling thermometer
« Reply #36 on: December 27, 2016, 02:44:47 AM »

bluc - you've caught the old 'zip file redirect' bug - there's a trick to uploading zip files so others can download - YHB amd wiifm have posts on it - I can't recall atm what the steps are 



Attach the ZIP file but, do not press the "Insert Attachment" link

This will place the link at the bottom of the post and everything works fine ;)
Where Thrift Becomes An Art-Form

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #37 on: December 27, 2016, 06:17:34 AM »
bluc - you've caught the old 'zip file redirect' bug - there's a trick to uploading zip files so others can download - YHB amd wiifm have posts on it - I can't recall atm what the steps are

Thanks for the heads up i will fix it as soon as I get home. Out and about atm

Offline ShiFu

  • eParrot.org
  • Admin
  • Posts: 1984
Re: Water cooling thermometer
« Reply #38 on: December 27, 2016, 06:37:57 AM »
Thanks for the heads up i will fix it as soon as I get home. Out and about atm

I fixed it for you.
The zip should download now.
Stay calm and follow the screaming people.

Offline bluc

  • Posts: 208
Re: Water cooling thermometer
« Reply #39 on: December 27, 2016, 07:52:15 AM »
Thanks shifu  :) I have been playing around with the delay function but cant work out how to get the dispalys syncronised any ideas? Seems to load one then the other..