Go Down

Topic: Temeratures control with outputs (Read 2314 times) previous topic - next topic

kikitron

Hi,

Im new here and with arduino to :)
I have one question if it is possible to make program for arduino to control 3 temperature sensors on input and 3 loads on output with relays?

I have one project on work and I found arduino and I would like to try this project with him.

A have 8 pieces of heaters for hydraulic oil and all together have ca. 13kW of power. They are in 250l reservoar and will heat the oil.
And I have two hydraulic pumps with 0,37kW motors. The first reservoar with heaters need to heat another oil tank throu heat exchanger.
Now i have to control temperature in first and second reservoar and I have to turn on and off pumps....
First reservoar have to have 60°C and second 36°C. I would like to control contactors for two motors and one for 8 heaters.

Is this possible?

Thanke you in advance for your answers.

PaulS

Quote
I have one question if it is possible to make program for arduino to control 3 temperature sensors

No. The sensor is going to do what it will. You can read them.

Quote
and 3 loads on output with relays?

Yes.

Quote
Is this possible?

Yes.

Krodal

#2
Jan 24, 2013, 05:43 pm Last Edit: Jan 24, 2013, 05:49 pm by Krodal Reason: 1
Yes, yes and yes.

The Arduino is a good platform for this if you want to be able to control it yourself. This also makes it possible to connect an LCD display or even a webpage with the temperatures.
Others have made additional libraries, like a PID control.

With such big loads, you have to know about building something like that in a safe and secure way. I hope you are experienced in that.

Sometimes a library contains an error, and with new versions of the Arduino software, something might have been changed. If you are going to build a controller yourself, I suggest to first build a safety circuit that cuts off the power if the oil gets to hot.

Since this project is limited, It is easier to buy controllers for this. Some controllers contain Arduino compatible hardware inside.

kikitron

Thanke you for the answers.
I would like that if temperature in tank 1 is >60°C the it has to turn heaters off and pump 1 must be on. And if the temperature is >36°C in tank 2 then it has to turn heaters off and pump 2 to and so on... And for protection if temperature of oil in tank 1 is higher then 70°C then it have to stop.
I thought that i will add on digital output of arduino three relays and that relays will drive three contactors for pump 1, pump 2 and one for heaters.

To connect the heaters and motors in a safe way that wont be a problem, problem is only to program arduino controller  8)

I was looking to buy such controller but I didnt find it  :~
And I would like to learn how to program with arduino so i desided to use it.

Nick_Pyner


I would like to learn how to program with arduino so i decided to use it.


Good choice. Arduino is used a lot for this sort of stuff. for solar heating and the like, and the application is quite simple.  The programme runs runs in a loop checking the temperatures against fixed values.

"if temp>36 do this" 

If temps is not >36, the command is ignored.

You might look at the DS18B20 temperature sensor.

http://www.ebay.com.au/itm/280989134906?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

Some versions come with a plug installed.

kikitron

#5
Jan 25, 2013, 07:21 am Last Edit: Jan 25, 2013, 07:27 am by kikitron Reason: 1
Yes i would like to use 3 pieces of DS18B20 and yesterday I did the project with one DS18B20 from this page with LCD 1602, and it was working  :)
http://www.hacktronics.com/Tutorials/arduino-digital-temperature-sensor-tutorial.html

Is there any project with DS18B20 that has in program "if temp>XX do this" ... that I can learn it from there, because I dont know where to start  :~

Is it possible to use this project that I past the link and add "if temp>36 do this" or I have to start all from beginning?

UKHeliBob

You can use the project that you already have working as a basis for what you want to do.  The temperature in Centigrade, or at least the non decimal part of it, is in a variable Whole and the Farenheit conversion is in FWhole.  Comparing it with another value is easy.

The project reads the temperature using function getTemp and prints it using function printTemp.  You could add another function that compares the temperature with set values and makes things happen.  As a start try adding a new function, perhaps called tempAction called after printTemp that puts a message on the LCD if the temperature is out of range.  Then you can move on to making something happen.  Extending the program to read and deal with 3 sensors will be relatively easy once you understand what it is currently doing.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

kikitron

Thanke you for the answer.
This is exactly what I need compare the temperature with set values and making things happen. I will need only temperature in centigrade without farenheit.
Is there any manual with this functions that i can know how to add it?

UKHeliBob

You write your own function.  Something like this :

Code: [Select]
void tempAction()
{
  if (Whole > 60)
  {
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("High temp !");
  }
}


Look at the functions already in the program to see where to put it and how to call it.  If you don't know how to do this then I seriously suggest that you work through the examples provided with the IDE.  Instead of just putting a message on the LCD you will need to turn relays on/off.  There are examples of how to turn LEDs on and off which is fundamentally no different than turning relays on and off.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Nick_Pyner

#9
Jan 25, 2013, 03:10 pm Last Edit: Jan 26, 2013, 01:06 am by Nick_Pyner Reason: 1

Yes i would like to use 3 pieces of DS18B20 and yesterday I did the project with one DS18B20 from this page with LCD 1602, and it was working  :)
http://www.hacktronics.com/Tutorials/arduino-digital-temperature-sensor-tutorial.html

Is it possible to use this project that I past the link and add "if temp>36 do this" or I have to start all from beginning?


I found the Hacktronics tutorial the best, and I am running three DS18B20s based on it. I just slipped the code below into the loop as a test.  You can can have a command to start a pump instead of print to LCD

Code: [Select]

if ( InTemp > 30.00)
{
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("30+");
 lcd.setCursor(0,1);
 lcd.print(InTemp);
 delay(2000);
}


Veco

If you want to be fancy you could use the PID library to give this an element of smart control.

Perhaps overkill for relays, but it'll be accurate.

Library:
http://playground.arduino.cc//Code/PIDLibrary

Relay implementation:
http://playground.arduino.cc//Code/PIDLibraryRelayOutputExample

kikitron

I found great page with arduino project that Im looking for. I will need to change some lines and add extra sensor but can you please help me to display in Celsius and not in Fahrenheit on LCD?
Is it possible to do that, because i change from: (DallasTemperature::toFahrenheit(tempC)) to (DallasTemperature::toCelsius(tempC)) and the temperature on LCD is not correct  :~

A add correct addresses from DS18B20 so that is not a problem and I have pul-up resistor 4,7kohm.

The whole code is:
Code: [Select]
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int tank1BLED = 37;
int tank1GLED = 39;
int tank1RLED = 41;
int tank2BLED = 43;
int tank2GLED = 45;
int tank2RLED = 47;

// Data wire is plugged into pin 8 on the Arduino
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to
//communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.

DeviceAddress tank2Thermometer = { 0x28, 0x46, 0x3C, 0x16, 0x03, 0x00, 0x00, 0xA9 };
DeviceAddress tank1Thermometer = { 0x28, 0xDF, 0x21, 0x16, 0x03, 0x00, 0x00, 0x1E };

int tank1 = 31; // heater control pins
int tank2 = 33; // heater control pins

float tank1temp = 0;
float tank2temp = 0;

void setup(void)
{
  // Start up the library
  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(tank1Thermometer, 10);
  sensors.setResolution(tank2Thermometer, 10);
 
 
 
  pinMode(tank1BLED, OUTPUT); // Tank LED's
  pinMode(tank1GLED, OUTPUT);
  pinMode(tank1RLED, OUTPUT);
  pinMode(tank2BLED, OUTPUT);
  pinMode(tank2GLED, OUTPUT);
  pinMode(tank2RLED, OUTPUT);
 
  digitalWrite(tank1BLED, HIGH); // set Tank LED's off
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1RLED, HIGH);
  digitalWrite(tank2BLED, HIGH);
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2RLED, HIGH);
 

lcd.begin(20,4);
// columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear();
// start with a blank screen

pinMode(tank1, OUTPUT); // Tank heaters
pinMode(tank2, OUTPUT);

}

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  float t1tempC = sensors.getTempC(tank1Thermometer);
  float t2tempC = sensors.getTempC(tank2Thermometer);
  if (tempC == -127.00) {
lcd.print("Error");
} else {
// lcd.print(tempC);
// lcd.print("/");
tank1temp = (DallasTemperature::toFahrenheit(t1tempC));
tank2temp = (DallasTemperature::toFahrenheit(t2tempC));
lcd.print(DallasTemperature::toFahrenheit(tempC));
  }
}

void loop(void)
{
  delay(2000);

  sensors.requestTemperatures();
 
lcd.setCursor(0,0);
lcd.print("Tank 1: ");

printTemperature(tank1Thermometer);

lcd.setCursor(0,1);
lcd.print("Tank 2: ");

printTemperature(tank2Thermometer);



if (tank1temp <=178.9)
{
  digitalWrite(tank1, HIGH);
  digitalWrite(tank1BLED, LOW);
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1RLED, HIGH);
}

if (tank1temp >= 179 && tank1temp <= 181.9)

{
  digitalWrite(tank1GLED, LOW);
  digitalWrite(tank1RLED, HIGH);
  digitalWrite(tank1BLED, HIGH);
}

if (tank1temp >= 182)
{
  digitalWrite(tank1, LOW);
  digitalWrite(tank1RLED, LOW);
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1BLED, HIGH);
}




if (tank2temp <=178.9)
{
  digitalWrite(tank2, HIGH);
  digitalWrite(tank2BLED, LOW);
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2RLED, HIGH);
}

if (tank2temp >= 179 && tank2temp <= 181.9)

{
  digitalWrite(tank2GLED, LOW);
  digitalWrite(tank2RLED, HIGH);
  digitalWrite(tank2BLED, HIGH);
}

if (tank2temp >= 182)
{
  digitalWrite(tank2, LOW);
  digitalWrite(tank2RLED, LOW);
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2BLED, HIGH);
}




}


Original author: http://arduinotronics.blogspot.com/2011_05_01_archive.html

johncc

Since you called getTempC() to get the temperature, you don't need to convert it to C-- you already have it!

tank1temp = t1tempC;
tank2temp = t2tempC;
lcd.print(tempC);

kikitron

Of course it was convert option  :)
Thanke you @johncc


kikitron

I have another question about LCD that I have it 1602.
The text on it is realy hard to see (very dark), I can see it only from upper angle and on the front you cant see it. Backlight is working ok but text is realy bad.
Do I have to change something in the program that the text will be lighter?

I have QUAPASS 1602A bluescreen and I think that text should be white.

Go Up