Kirjoittaja Aihe: Mehiläispesän talvi-lämmittimen suunnittelua  (Luettu 11325 kertaa)

qwerty

  • Administrator
  • *****
  • Viestejä: 185
Mehiläispesän talvi-lämmittimen suunnittelua
« : Huhtikuu 20, 2013, 12:53:25 ap »
Tässä aiheessa olisi tarkoitus käsitellä mehiläispesään tulevaa talvi-lämmitintä.

Mehiläispesään alempaan osastoon tulee molemille äärilaidoille kaksi lämpölevyä joita lämmitetään talvisenvuorokauden kylmimpinä jaksoina.

Tästä saisi hyötyä etenkin talveutettua vaikkapa kolme yhdyskuntaa samassa tornissa.

Automatiikka toteutetaan Arduino Megalla


Tomask

  • Vieras
Vs: Mehiläispesän talvi-lämmittimen suunnittelua
« Vastaus #1 : Toukokuu 30, 2013, 09:17:43 ap »
Lämmitin on toteutettu seuraavilla osilla:
- Purettu Motonetin 12V penkinlämmitin
- Arduino (tässä ohjeessa Mega)
- Meisei PS-5 Rele ( http://www.partco.biz/verkkokauppa/product_info.php?products_id=11331 )
- 12V Akku lämmittimelle
- Arduinolle joko oma akku tai muuntaja 12V->5V

Arduinon sisäisen kellon puutteen vuoksi lämmitin  laskee tunteja ennustaakseen vuorokauden kylmimmät tunnit.
Lämpötilaa mitataan minuutin välein, ja saaduista arvoista lasketaan jokaiselle tunnille keskiarvo.
Lämpötilan noustessa verrattuna kahteen edelliseen tuntiin, laitetaan odotustila päälle, jonka aikana mitataan lämpötilaa.
Tässä ohjelmassa odotusaika on 20 tuntia.
Odotuksen päättyttyä kytketään lämmitin käyettäväksi.
Lämmitin lämmittää kuusi minuuttia tunnissa kuuden tunnin ajan.
 

Penkinlämmittimestä irroitettiin lämmityselementit.

Lämmittimen virtajohdon ja piirilevyn väliin laitettiin rele, jota arduino ohjaa.

Releen pinnit kytkettiin seuraavasti:
-Releen pinni 1: Arduinon pinni 53
-Releen pinni 10: Arduinon pinni GND
-Releen pinni 3: Virtajohto akulta
-Releen pinni 4: Virtajohto lämmittimeen
  (katso datalehti: http://www.partco.biz/verkkokauppa/datasheet/meisei_ps5.pdf)

Lämpöanturin kytkentä (DS1820):
Anturin pinnit 1 ja 3 kytkettiin yhteen ja johdotettiin Arduinon GND pinniin
Anturin pinni 2 kytkettiin arduinon pinniin 2, josta 4,7k ohmin vastus +5V pinniin
 (Katso piirros viestin lopusta)

Lämmitimeen koodi vaatii toimiakseen arduinon tavallisen asennuksen lisäksi kolme erillistä kirjastoa, löytyvät liitteinä tämän viestin lopusta: Average.zip, dallas.zip, OneWire.zip


Tämä ohjelma tulostaa minuutin välein lämpötilan sarjaportille, lämmityksen ohella, joten sitä voi käyttää ohjelman jatkokehittelyynkin.

Käytimme projektissa Coolterm -sarjaporttiohjelmaa, josta saa datan helposti talteen.

Koodia: [Valitse]

// Project needs three libraries that are not part of arduino install.
#include <Average.h>
#include <OneWire.h>
#include <DallasTemperature.h>

//Define used variables

#define MLuku 60 // The amount of minutes in an hour
#define TLuku 24 // The amount of hours in a day
#define WLuku 6  // The amount of hours to warm
#define HLuku 6  // The amount of minutes to warm
#define ONE_WIRE_BUS 2 // Data wire is plugged into pin 2 on the Arduino
#define Rele 53 //Pin for the relay

float Minuutti[MLuku];  // Slot to hold the measuring data for the minutes
float Tunti[TLuku];     // Slot to hold hourly data
float TempKA;           // Variable for Average amount
int LEsto = 0;          // Variable to indicate blocking of heating
int EstoAika = 15;      // Variable to hold the time of blocking of heating
int Timma;              // Variable to store the hour
int z = 0;              // Counter for the heater
long lastminute = 0;
long minute = 59700;      // Variable for the delay time, a minute for this project
boolean Warn;           // Variable for enabling the heater

void setup()
{
  // start serial port
  Serial.begin(19200);
  pinMode(Rele, OUTPUT);
 }

void loop()
{
  for (int j=0; j<TLuku; j++){  //
   
  Mittaus(); // Jump to the measuring part
  TempKA = mean(Minuutti,MLuku);  // Measure the average temp of the minutes
  Serial.print("Tunti: "); 
  Serial.print(j);
  Serial.print("  Avg: ");
  Serial.print(TempKA);
  Serial.print("\n");
  delay(100);
  Reset1();     //Reset the temp of the stored minutes
  delay(100);
  Tunti[j] = TempKA;   //Store the average temp of the minutes to the Vector
                      //Serial.print("Hourly averages's check \n");
                      //Serial.print(Tunti[j]);
                      //Serial.print("\n");
                      //Serial.print(Tunti[j-1]);
                      //Serial.print("\n");
                      //Serial.print(Tunti[j-2]);
                      //Serial.print("\n");
  Serial.print(LEsto);
  Serial.print(" Estobitti\n");
  Serial.print(EstoAika);
  Serial.print(" Eston tunti \n");
  Timma = j; //Store the number of the current hour
  NoWarm();  //Check if the 20 hour delay has passed
  if (LEsto == 0 && Tunti[j-1] != 0 && Tunti[j-2] != 0) //If the restrictor of the heater is not on, enable the heater
  {
    Warm();
  }
  if (Tunti[j-1] > Tunti[j-2] && Tunti[j] > Tunti[j-1] && Tunti[j-2] != 0 && Tunti[j-1] != 0 && z >= 6) {
    //If current hours temp has risen since the two ones before: delay heating for 20h
   if (LEsto == 0) {
    LEsto = 1;    //Set blocking on
    EstoAika = j; //set the hour of the blocking
    z=0;          //reset the counter
   Warn = false;  //disable the heater
       Serial.print("No Warming for 20h");
       Serial.print("\n ");
   }
   }
        else if ( Tunti[j-1] == 0 && Tunti[j-2] == 0) {  //If the hour counter goes from 23 -> 0 the check needs to be done slightly different.
        Serial.print("\n Midnight \n");
        if (Tunti[TLuku-1] > Tunti[TLuku-2] && Tunti[j] > Tunti[TLuku-1] && z >= 6) {
                   Serial.print("\n ");
                   if (LEsto == 0) {
                    LEsto = 1;
                    EstoAika = j;
                    z=0;
                   Warn = false;
                   Serial.print("No Warming for 20h");
                   Serial.print("\n ");
                   }   
                   }
                   }
  }

} // End of the main loop



void Mittaus()
{
  for (int i=0; i<MLuku; i++){  //for 60 times
   
  OneWire oneWire(ONE_WIRE_BUS);        //Enable the OneWireBus
  DallasTemperature sensors(&oneWire);  //Enable the Dallas Library
  sensors.begin();                      //Start the bus 
  delay(10);
  sensors.requestTemperatures();        //Request temp from the sensor
  delay(10);
  Minuutti [i] = sensors.getTempCByIndex(0); //Get and store the value from the first (and only) sensor on the bus
 
  Serial.print(Minuutti[i]);
  Serial.print("\n");
  if (i < HLuku && Warn == true)    //If usage of heater is enabled: switch it on
 {
  Serial.print(" Warn ");
   digitalWrite(Rele, HIGH); //Modify this to control the relay
 }
 else
 {
   digitalWrite(Rele, LOW);
 }
  delay(minute);
}
}

int NoWarm()  //Count when the 20 hours have passed
{
 if ( EstoAika == 0 && Timma == 20 ) LEsto = 0;
 if ( EstoAika == 1 && Timma == 21 ) LEsto = 0;
 if ( EstoAika == 2 && Timma == 22 ) LEsto = 0;
 if ( EstoAika == 3 && Timma == 23 ) LEsto = 0;
 if ( EstoAika == 4 && Timma == 0 ) LEsto = 0;
 if ( EstoAika == 5 && Timma == 1 ) LEsto = 0;
 if ( EstoAika == 6 && Timma == 2 ) LEsto = 0;
 if ( EstoAika == 7 && Timma == 3 ) LEsto = 0;
 if ( EstoAika == 8 && Timma == 4 ) LEsto = 0;
 if ( EstoAika == 9 && Timma == 5 ) LEsto = 0;
 if ( EstoAika == 10 && Timma == 6 ) LEsto = 0;
 if ( EstoAika == 11 && Timma == 7 ) LEsto = 0;
 if ( EstoAika == 12 && Timma == 8 ) LEsto = 0;
 if ( EstoAika == 13 && Timma == 9 ) LEsto = 0;
 if ( EstoAika == 14 && Timma == 10 ) LEsto = 0;
 if ( EstoAika == 15 && Timma == 11 ) LEsto = 0;
 if ( EstoAika == 16 && Timma == 12 ) LEsto = 0;
 if ( EstoAika == 17 && Timma == 13 ) LEsto = 0;
 if ( EstoAika == 18 && Timma == 14 ) LEsto = 0;
 if ( EstoAika == 19 && Timma == 15 ) LEsto = 0;
 if ( EstoAika == 20 && Timma == 16 ) LEsto = 0;
 if ( EstoAika == 21 && Timma == 17 ) LEsto = 0;
 if ( EstoAika == 22 && Timma == 18 ) LEsto = 0;
 if ( EstoAika == 23 && Timma == 19 ) LEsto = 0;
}


void Warm()
{
  z=z++;
 
 if (z >= WLuku) { //Warming has been on for the desired time (6h)
   Serial.print("\n No Warming (6h full) \n");
   Warn = false;   //disable warming
 }
 else if (z < WLuku) { //Warming hasn't been on for the desired time (6h)
   Warn = true;
   Serial.print(" \n ..Warming.. \n");
 }
}




void Reset1()  //Reset the temps stored on the minutes vector
{
  for (int y=0; y<MLuku; y++){
    Minuutti[y] = 0;
  }
}





Kuvia aiheesta: