Pages: [1]   Go Down
Author Topic: programming of an automatic system capable of controlling the temperature.  (Read 336 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

I'm new to the forum.

I'm confused and I do not know where to start with programming

I'm GEII license mauritius and I have a project on data acquisition. here is my project is to make the programming of an automatic system capable of controlling the temperature.

In a first time, I have to enter a desired setpoint temperature (setpoint).

A temperature sensor will give me the current temperature. Then there will be a dimmer controlled by PWM signal regularize the temperature with the aid of an immersion, based on the "gap between the setpoint and actual temperature.

Thank you in advance for your help.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 47
Posts: 3494
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You haven't said what you are controlling the temperature of? From your use of the word "immersion" I suspect it is water. If so, how big is the water container and what sort of immersion heater are you using? How much power does it use and what voltage does it work at. What are the required max and min temperatures.

If I was designing a water heater I don't think I would need to bother with PWM. Water doesn't heat up instantly and I suspect it would be sufficient to run the immersion at full power, monitor the temperature and switch off when the desired temperature is reached. Then switch on again when the temperature falls below the low temperature limit.

Of course, if I am wrong about water please provide the correct details.

What sort of temperature sensor are you thinking of using?

...R
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 48
Posts: 3392
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PID is a popular topic in the forum today - it would fit in nicely with your proposal to use PWM, though as already noted, PWM may well not be appropriate for your needs.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm GEII license mauritius
I'm confused and do not understand what this means.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Norway
Offline Offline
Jr. Member
**
Karma: 1
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm confused and I do not know where to start with programming

Start by googling, reading here on arduino.cc, and learning from examples in the Arduino-software you get for free at this site.

Quote from: The "Read this before posting..."-thread
4. Reference page

Many functions specific to the Arduino (like activating pins, reading analog input etc.) are documented on the reference page:

http://arduino.cc/en/Reference/HomePage
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

i trust all is well.

thanks you for you reply regarding the mentioned above subject.

Further to your reply concerning some missing information, kindly find below these missing point:

a)  we are controlling the temperature of a chemical substances.
b) the word of "immersion" is a flange heater .

The control temperature system of a chemical substances. The tank which contain the chemical substance is in a bigger tank which contain water.
In the chemical tank i have a sensor temperature of 0 to 5V, for a measuring range 0 to 100 degrees.
In the water tank i have a flange heater, which is a dimmer controlled by PWM signal (240VAC)

Firstly i  have to enter a setpoint adjust in the range for 25 to 75 degrees. Further to our setpoint, the dimmer controller will control the flange heater.
Then the temperature sensor will read the temperature .The temperature controller will measure  the gap between to set-point and reading.

Based on the calculated gap, the Temperature controller will control the dimmer.

Please note that it's only a theoretical project.The aim of the project is the programming

I would highly appreciate if you can help me..
Logged

Oregon, USA
Offline Offline
Edison Member
*
Karma: 35
Posts: 1537
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Please note that it's only a theoretical project.The aim of the project is the programming
Is this an assignment for a school class?
Logged

"It seems to run on some form of electricity"

Offline Offline
Jr. Member
**
Karma: 1
Posts: 99
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

input can be a potmeter from 0 to 100 celsius connected to A1
or if display is available use that one.
scale the inputs to 100%
the output is scaled from 100% to 0 to 255
now write your own PID program ! it means get the theory up and make a calculation for the P I and D action.
add them all up and divide by three.
output is pin13.
Logged

Norway
Offline Offline
Jr. Member
**
Karma: 1
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm confused. What parts do you need help with? What do you already know?

The program is not difficult to write. If you don't know anything about programming what so ever, start with the dim-heater. Make it work. Then read the temp-sensor, make it work. Then make them work together, i.e like this:
DIM = map((TemperatureSet - TemperatureRead), 0, 100, 0, 255).

This is easy stuff, it will take you far less time to actually learn and write this code than to wait here for help.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I need help with the programming. I had already start writing it, kindly see below:

int capteur_Niveau_Chimique = 3;   
int capteur_Niveau_Eau =4;
int sonde_temp_eau =A0;
int setpoint = A1;
int Thermo =A2;
int LED_Bleu =5;
int LED_Red =6;
int LED_Green = 7;
int LED_Erreur_consigne =8;
int LED_Indicateur_Chimique=8;
int LED_Indicateur_Eau=9;
int Ecart;
float Measure_reel;
float Consigne_reel;

int val_Niveau_Chimique = 0;
int val_Niveau_Eau = 0;
int val_Consigne= 64;
int val_Measure=0;

void setup() {
  pinMode(LED_Red, OUTPUT);  // declare the ledPin as an OUTPUT
  pinMode(LED_Bleu, OUTPUT);
  pinMode(LED_Green, OUTPUT);
  pinMode(LED_Indicateur_Chimique, OUTPUT);
  pinMode(LED_Indicateur_Eau, OUTPUT);
  pinMode (LED_Erreur_consigne, OUTPUT);
  }
 
  void loop() {
   
   int val_Niveau_Chimique = digitalRead(capteur_Niveau_Chimique);
   int val_Niveau_Eau = digitalRead (capteur_Niveau_Eau);
   int val_Consigne= analogRead (setpoint);
   int val_Measure= analogRead (sonde_temp_eau);
   
   if ( capteur_Niveau_Chimique == HIGH && capteur_Niveau_Eau == HIGH)
   {
   digitalWrite(val_Niveau_Chimique, HIGH);
   digitalWrite(val_Niveau_Eau, HIGH);
   
   if (setpoint <  val_Consigne)
   
   digitalWrite(LED_Erreur_consigne,HIGH);
   
   if (LED_Erreur_consigne == LOW);
   
   Consigne_reel = (100/255)* val_Consigne;
   Measure_reel = (100/255)* val_Measure;
   
    Ecart =Consigne_reel - Measure_reel;
   
   }
   analogWrite (Thermo,Ecart);
   
 
   
   
   
   
   }


I would highly appreciate if you can help. I'm using a potmeter for the setpoint.
Logged

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

Code:
if (LED_Erreur_consigne == LOW);
If the condition is true, do nothing ( ; ). Otherwise, do nothing. I give up. Why test the condition?

LED_Erreur_consigne looks like a pin number. The NUMBER will not normally be LOW.
Logged

Southeast US
Offline Offline
God Member
*****
Karma: 9
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm GEII license mauritius
I'm confused and do not understand what this means.
I am also curious what this means.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm GEII license mauritius
I'm confused and do not understand what this means.
I am also curious what this means.


I'm doing a BSC(Bachelor of science) in Electrical  in Mauritius island
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool, I was in Flic-en-Flac a few weeks ago.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Southeast US
Offline Offline
God Member
*****
Karma: 9
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another note is that I remember from one of my control system courses is that PID loops generally don't work very well with temperature.  The reason is that temperature response is generally asymmetric without some form of active cooling (Which maybe you can do, but would make the system more complicated).  Generally, you use PID loops to significantly increase the response time while minimizing the overshoot and reduce steady state error to zero.  However, you do not eliminate the overshoot completely, and without minimizing this, you could result in a huge temperature spike when you don't want it and no easy way to remove the heat.  That being said, the same system mechanics can be used to create a critically damped system, but it tends to negate the benefits of using something as complicated as the PID Loop.  The most basic control (And one often used by the cheaper HVAC or Water heater units I've seen (admittedly I have not seen that many)) is called Bang-Bang Control, where you set a lower and upper limit.  When the temperature is below the lower limit, you turn the heater on, you leave the heater on until the temperature exceeds the upper limit, then you turn the system off.  That means it will slowly bob between the upper and lower limits over time as the temperature increases and decreases.  However, it does not allow for fine control since the closer you bring the 2 limits together, the more often they turn on and off, which is often bad for such devices.

Don't forget that it takes time for temperature to spread through a fluid.  However, if your fluid is constantly moving, and thus being replenished by a fixed temperature source, then you need to account for this, as your cooling will be much faster, but Bang-Bang would be more realistic on a short time scale.  And if you are actually building this rather than a theoretical model, be careful about what materials you are using so nothing bad happens to your sensors.

And look closely at these two lines in the loop, You might notice something odd.

Code:
   
int val_Consigne= analogRead (setpoint);
//...
if (setpoint <  val_Consigne)
Logged

Pages: [1]   Go Up
Jump to: