Pages: [1]   Go Down
Author Topic: Greenhouse automation  (Read 751 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all!

I've got a project that I'm working on and wondered if the people of this forum could shed some light.

I basically want to open the vent on a greenhouse if the temperature reaches a set point. This will drive a bi directional motor. There will be two limit switches to ensure that the vent is completly open.

When the temperature drops back below another set point I would like the motor to drive in the opposite direction closing the vent untill both limit switches are in the oppose state.

I've attached a basic schematic of the system. Any help, guidance or information would be greatly apreciated.


* window open system.jpg (30.34 KB, 806x576 - viewed 36 times.)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


can be done relative easily

a starter how to set things up, some functions are incomplete that need still to be re written. (check tutorial section)

Code: ( partial code)

int highLimit = 25;
int lowLimit = 23;

int switchTop = 4;  // pin
int switchBottom = 5; // pin

void setup()
{
  Serial.begin(115200);   // for some feedback
  Serial.println("greenhouse 0.1");
}

void loop()
{
  int val = getTemperature();

  if (val > highLimit )
  {
    do
    {
      motorUP(1); // run motor for one second
    }
    while ( digitalRead(switchTop) == LOW);
  }

  if (val < lowLimit)
  {
    do
    {
      motorDown(1); // run motor down for one second
    }
    while ( digitalRead(switchBottom) == LOW);  // assume HIGH when at the end
  }
}

int getTemperature()
{
  return 10;
}

void motorUP(int t)
{
   delay(t*1000UL);
}

void motorDown(int t)
{
   delay(t*1000UL);
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

Thats brilliant. Thanks very much.

All of that can be done with an Uno board?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

easily.

take care that the motor(s) need a separate power supply (connect GNDs for common reference)
and the motors need a diode against induction...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

Yeah cheers. Pretty apt with the electronics. Im an instrumentation technician by trade and did an electrical/electronic apprenticeship.

For testing purposes could I not just get a small voltage DC motor that can be supplied via the Arduino?
Logged

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

Hi all. Just thought I would give a quick update on this project.

I have myself an Uno and a few components. For the temperature sensor I decided to go with a AD22100STZ. Its quite user friendly, it does all the linearisation on the chip so all I have to use is an equation given by the manufacturer on the data-sheet. I get about 0.2 DegC sensitivity due to the -50 to 150 and 10bit ADC ranges. I have here a quite precise stand alone temperature probe that I am going to carry out some comparison tests with which I will post when I have the results. I may be able to tweak the equation to get better accuracy.

The code is coming along nicely with some variable integer and floats. I am communicating and printing through the serial port. I have some if statements based on my required temperature setpoints which are currently just controlling a digital output which I will soon change to a PWM output to my servomotor which I just need to sort a power supply out for.

Code:
//temperature readout code

int outputpin = 13;
int inputpin = 1;
int inputmemory = 0; //use for the serial read
float tempout = 0;  //use for temperature out
float setpointhigh = 26.00; //high temperature setpoint
float setpointlow = 25.00; //low temperature setpoint

void setup()
{
  Serial.begin(9600);
  pinMode(outputpin, OUTPUT);
}

void loop()

{
  inputmemory = analogRead(inputpin); //read analogue pin on pin 1
 
  tempout = ((inputmemory*(5.0 / 1024))- 1.375) / 0.0225;
 
  Serial.print ("Temperature: ");
  Serial.println(tempout); //print temperature value to serial
 
  Serial.print ("ADC value: ");
  Serial.println(inputmemory); //print ADC value to serial
 
  if (tempout >= setpointhigh) digitalWrite(outputpin, HIGH); //high setpoint
 
  if (tempout <= setpointlow) digitalWrite(outputpin, LOW); //low setpoint
 
  delay(1000); //delay 1 second before next read

}

The forum is rubbish for uploading pictures so I will also be doing a blog over at http://partecsolutions.blogspot.co.uk/ if you want to check that out.

Any constructive criticism would be cool so just drop a message on here!
Logged

Pages: [1]   Go Up
Jump to: