Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: Shooting range controller on: September 09, 2013, 12:39:22 pm
Alright, I'm working on version 2 now. Gotta redesign the circuit and etch a new board.
The things ill inplement now is some extra capacitors, more diodes to remove feedback and use pull up resistors instead of pull down so there is less noise.
Will update when all is ready.

And the power supply is just a 12v wall wart, the diode is hooked up to Vin as a crude reverse current protection.
2  Using Arduino / Project Guidance / Shooting range controller on: September 08, 2013, 02:30:18 pm
So for my local shooting range I built a controller to move the targets around based on an Arduino Mega 2560.
Besides its purpose it comes down to 20 switches and 10 relays, the shield for the Arduino is basically a bunch of screw terminals (also includes the pull down resistors for the inputs and outputs and decoupling capacitors).

https://www.dropbox.com/s/kuissaxvp9fu81m/MainSchematic.png

To drive the relays I used some mosfets as the relays required 24v.

https://www.dropbox.com/s/qezvqpfmgnv4ib5/RelaySchematic.png

After testing it works fairly well except for some odd things:
First was that to one of the relay drivers i had to attach an additional 2k pull down resistor otherwise they would stay on.
And once in a while when one switch is triggered it randomly triggers another pin, as an example: a target would move forward and when it reached the front stop switch, it triggered the move button so it moved backwards again.

For problem 1 I'm kinda clueless as it seems that somehow its leaking current.
For problem 2 I assumed that as all pins are hooked up to the same ground line that when one pin is pulled high it leaks current to another pin.

I double checked all the traces and they seem to be fine.

So would the circuit be more robust using pull up resistors and letting the switch pull the pin low?
Or add diodes between the pull down resistor and ground line?

And something not very time crucial but the code is just a string of if statements ie.
Code:
var = digitalRead(switch);
if (var == 1) {
//do something funny
}

Is there a way to clean this up a little?
3  Community / Exhibition / Gallery / Re: Smart Home Manegment System on: May 28, 2011, 08:38:51 am
Hey man,

Sounds very interesting. But are you then planning on an Arduino in every room?
My quick thoughts are a separate arduino in each room with an ethernet shield. Ofcourse xbee is possible too but it would be fairly costly.

For the relay shield, I'm doing kind of the same to automate my greenhouse. Which is not too far off from your idea with controlling temperature, lights etc. I'm driving my relays with 12v, but as I had a pile of optocouplers at home I'm using those. In the past I used transistors which worked a charm.

Anyways I'm very interested about how you are going to make a system for the whole house.
4  Using Arduino / Installation & Troubleshooting / Re: External power supply usage? on: May 25, 2011, 11:30:35 am
Sounds good, ill already try it with a simple led sketch. External power and then hook up the usb.
Thanks for the tips!
5  Community / Exhibition / Gallery / Re: Greenhouse automation on: May 24, 2011, 08:04:37 pm
Hey Ben,
I was also thinking about doing that but as I don't have an ehternet shield and my friend didn't want to spend more money when he is only gonna look at the data at home.
Anyways that was my first goal, maybe even intergrate it with google charts but as it wasn't needed and costs more that option was deleted.

So to get back to the project, I redesigned the circuit to use a pair of shift registers for the control panel and due to that I decided to give the panel it's own voltage regulator so I wouldn't bother the Arduino too much.
Just to be sure I double checked the current tolerances on all the parts of the relay board, I just got a lamp and it draws 2.2A at 250V so that should easily work.
And I swapped the transistors on the relay board for optocouplers as I had a pile of them lying around the house. I checked the current limits and I have about 20mA overhead.

On the code side the only thing I have changed is in the interval.

Before:
  If (5 minutes have passed) {
    Check temp, humidity and soil moistness
  }
  If (temp > 28) {
     Turn fan on
  }
  etc......
Now:
  If (5 minutes have passed) {
    Check temp, humidity and soil moistness
    If (temp > 28) {
      Turn fan on
    }
  etc......

Just so the Arduino only waits for the 5 minutes and not for stats that don't change anyways.
Anyways here's the code and schematics. Parts are en route so physical photos this weekend I hope.
Code:

#include <Sensirion.h>
#include <Time.h>

//Temperature and Humidity sensor
const uint8_t dataPin  =  2;
const uint8_t clockPin =  3;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

//Temperature and Humidity interval time
long previousMillis = 0;
long interval = 300000;

//Soil moisture sensor
int moistureSensor = A0;
int moisture_val;

//Serial stuff
char buffer[5];

//Relay output pins
const int lightPin = 4;
const int waterPin = 5;
const int fanPin = 6;
const int humPin = 7;

//Control panel shift register pins and ON / OFF data string
int stats[15];
int previousstats[15];
const int data = 8;
const int clock = 9;
const int latch = 10;

//Light status
int lightstatus = 0;
int lastlightstatus = 0;

//Fan status
int fanstatus = 0;
int lastfanstatus = 0;

//Humidifier status
int humtime = 1000; //In milliseconds
int humstatus = 0;
int lasthumstatus = 0;

//Watering status
int watertime = 1000; //In milliseconds
int waterstatus = 0;
int lastwaterstatus = 0;

void setup()
{
  Serial.begin(9600);
  setTime(20,7,0,17,5,2011);
  pinMode(lightPin, OUTPUT);
  pinMode(waterPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(humPin, OUTPUT);
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(latch, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  time_t t = now();
  
  //Check Temperature.... and report every 5 minutes
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    
    tempSensor.measure(&temperature, &humidity, &dewpoint);

    moisture_val = analogRead(moistureSensor);
    
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.print(" C, Humidity: ");
    Serial.print(humidity);
    Serial.print(" %, Dewpoint: ");
    Serial.print(dewpoint);
    Serial.print(" C, Soil Moisture: ");
    Serial.println(moisture_val);
    Serial.print("#S|TEMPLOG|[");
    Serial.print(itoa((temperature), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((humidity), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((dewpoint), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((moisture_val), buffer, 10));
    Serial.println("]#");
    update();
  }
  
  
  /////Light trigger
  if((0 <= hour(t)) && (18 > hour(t))) { ///Between which hours on
    lightstatus = 1;
  }
  if((18 <= hour(t)) && (24 >= hour(t))) { ///Between which hours off
    lightstatus = 0;
  }
  //Light compare, set status and report
  if(lightstatus != lastlightstatus) {
    if(lightstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Light On]#");
    }
    if(lightstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Light Off]#");
    }
    digitalWrite(lightPin, lightstatus);
    lastlightstatus = lightstatus;
  }
}
  
  
  void update() {
  /////Fan trigger
  if(temperature <= 25 || humidity <= 60) { ///Turn off threshold
    fanstatus = 0;
  }
  if(temperature > 28 || humidity > 80) { ///Turn on threshold
    fanstatus = 1;
  }
  //Fan compare, set status and report
  if(fanstatus != lastfanstatus) {
    if(fanstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Fan On]#");
    }
    if(fanstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Fan Off]#");
    }
    digitalWrite(fanPin, fanstatus);
    lastfanstatus = fanstatus;
  }
  
  
  
  /////Water trigger
  if(moisture_val > 1000) { ///Turn off threshold
    waterstatus = 0;
  }
  if(moisture_val < 850) { ///Turn on threshold
    waterstatus = 1;
  }
  //Pump compare, set status and report
  if(waterstatus != lastwaterstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Pump On]#");
      digitalWrite(waterPin, waterstatus);
        delay(watertime);
        waterstatus = 0;
        Serial.println("#S|ACTIONLOG|[Pump Off]#");
        digitalWrite(waterPin, waterstatus);
        lastwaterstatus = waterstatus;
      }
   }
  
  
  
  ////Humidifier trigger
  if(humidity > 70) { ///Turn off threshold
    humstatus = 0;
  }
  if(humidity < 50) { ///Turn on threshold
    humstatus = 1;
  }
  //Humidifier compare, set status and report
  if(humstatus != lasthumstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Humidifier On]#");
      digitalWrite(humPin, humstatus);
        delay(humtime);
        humstatus = 0;
        Serial.println("#S|ACTIONLOG|[Humidifier Off]#");
        digitalWrite(humPin, humstatus);
        lasthumstatus = humstatus;
      }
   }
  
  
  
  /////Status LEDs
  ////These store the ON and OFF data in the 'stats' string to be used when shifting out
  //Temperature
  if((temperature < 22) || (temperature > 28)) {
    stats[2] = 0;
    stats[3] = 1;
  }
  else {
    stats[2] = 1;
    stats[3] = 0;
  }
  //Humidity
  if((humidity < 60) || (humidity > 80)) {
    stats[4] = 0;
    stats[5] = 1;
  }
  else {
    stats[4] = 1;
    stats[5] = 0;
  }
  //Soil
  if((moisture_val < 850) || (moisture_val > 1000)) {
    stats[6] = 0;
    stats[7] = 1;
  }
  else {
    stats[6] = 1;
    stats[7] = 0;
  }
  ////Checks if update to control panel is needed
  //And copies 'stats' string charachter by character to 'previousstats'
  if(stats != previousstats) {
    led();
    for(int z = 1; z<15; z++) {
      previousstats[z] = stats[z];
    }
  }
  
  
}


////Changes stats string to bits and shifts them out
void led() {
  byte bitBuffer1 = 0;
  bitWrite(bitBuffer1, 1, stats[1]);
  bitWrite(bitBuffer1, 2, stats[2]);
  bitWrite(bitBuffer1, 3, stats[3]);
  bitWrite(bitBuffer1, 4, stats[4]);
  bitWrite(bitBuffer1, 5, stats[5]);
  bitWrite(bitBuffer1, 6, stats[6]);
  bitWrite(bitBuffer1, 7, stats[7]);
  byte bitBuffer2 = 0;
  bitWrite(bitBuffer2, 1, stats[8]);
  bitWrite(bitBuffer2, 2, stats[9]);
  bitWrite(bitBuffer2, 3, stats[10]);
  bitWrite(bitBuffer2, 4, stats[11]);
  bitWrite(bitBuffer2, 5, stats[12]);
  bitWrite(bitBuffer2, 6, stats[13]);
  bitWrite(bitBuffer2, 7, stats[14]);
  digitalWrite(latch, LOW);
  shiftOut(data, clock, MSBFIRST, bitBuffer2);
  shiftOut(data, clock, MSBFIRST, bitBuffer1);
  digitalWrite(latch, HIGH);
}
Control Panel:

Relay board:



And Rob, I'm so sorry I haven't gotten around to putting any of your modifications in it. I've just been drawing and modifying the code in my lectures.
6  Using Arduino / Installation & Troubleshooting / Re: External power supply usage? on: May 24, 2011, 07:44:22 pm
Alright, I'm using an UNO. The reset thing just has to do with the fact that I'm keeping time without an RTC. If there's a power failure setting the time again is no big deal, but I'd rather not have to set the time every single time i hook up my laptop.
7  Using Arduino / Installation & Troubleshooting / External power supply usage? on: May 24, 2011, 06:49:27 pm
Just a quick question,
For my garden automation project (can be found in the exhibition section) I'm thinking of powering the arduino constantly with a wall wart but sometimes put my laptop on it to check on the progress.
Now the question is: if I run it constantly on the wall wart and then plug the usb into my laptop, will the arduino freak out because at has 2 power sources and will it reset the board?

Thanks
8  Community / Exhibition / Gallery / Re: Greenhouse automation on: May 18, 2011, 09:30:06 pm
Just another quick update,
it seems my buddy wanted to do a bit more than I posted yesterday including a humidifier and some error reporting on the control panel.
The error stuff I'm still working on but due to the lack of left over pins I had to use a shift register to do the control panel leds.
Besides that I cleaned up the code a little bit. Actual build pictures are coming soon, ordered the electronics and starting the physical build this week.

Code:

#include <Sensirion.h>
#include <Time.h>

//Temperature and Humidity sensor
const uint8_t dataPin  =  2;
const uint8_t clockPin =  3;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

//Temperature and Humidity interval time
long previousMillis = 0;
long interval = 300000;

//Soil moisture sensor
int moistureSensor = A0;
int moisture_val;

//Serial stuff
char buffer[5];

//Relay output pins
const int lightPin = 4;
const int waterPin = 5;
const int fanPin = 6;
const int humPin = 7;

//Control panel shift register pins and ON / OFF data string
int stats[15];
int previousstats[15];
const int data = 8;
const int clock = 9;
const int latch = 10;

//Light status
int lightstatus = 0;
int lastlightstatus = 0;

//Fan status
int fanstatus = 0;
int lastfanstatus = 0;

//Humidifier status
int humtime = 1000; //In milliseconds
int humstatus = 0;
int lasthumstatus = 0;

//Watering status
int watertime = 1000; //In milliseconds
int waterstatus = 0;
int lastwaterstatus = 0;

void setup()
{
  Serial.begin(9600);
  setTime(20,7,0,17,5,2011);
  pinMode(lightPin, OUTPUT);
  pinMode(waterPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(humPin, OUTPUT);
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(latch, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  time_t t = now();
 
  //Check Temperature.... and report every 5 minutes
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
   
    tempSensor.measure(&temperature, &humidity, &dewpoint);

    moisture_val = analogRead(moistureSensor);
   
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.print(" C, Humidity: ");
    Serial.print(humidity);
    Serial.print(" %, Dewpoint: ");
    Serial.print(dewpoint);
    Serial.print(" C, Soil Moisture: ");
    Serial.println(moisture_val);
    Serial.print("#S|TEMPLOG|[");
    Serial.print(itoa((temperature), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((humidity), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((dewpoint), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((moisture_val), buffer, 10));
    Serial.println("]#");
  }
 
 
  /////Light trigger
  if((0 <= hour(t)) && (18 > hour(t))) { ///Between which hours on
    lightstatus = 1;
  }
  if((18 <= hour(t)) && (24 >= hour(t))) { ///Between which hours off
    lightstatus = 0;
  }
  //Light compare, set status and report
  if(lightstatus != lastlightstatus) {
    if(lightstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Light On]#");
    }
    if(lightstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Light Off]#");
    }
    digitalWrite(lightPin, lightstatus);
    lastlightstatus = lightstatus;
  }
 
 
 
  /////Fan trigger
  if(temperature <= 25 || humidity <= 60) { ///Turn off threshold
    fanstatus = 0;
  }
  if(temperature > 28 || humidity > 80) { ///Turn on threshold
    fanstatus = 1;
  }
  //Fan compare, set status and report
  if(fanstatus != lastfanstatus) {
    if(fanstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Fan On]#");
    }
    if(fanstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Fan Off]#");
    }
    digitalWrite(fanPin, fanstatus);
    lastfanstatus = fanstatus;
  }
 
 
 
  /////Water trigger
  if(moisture_val > 1000) { ///Turn off threshold
    waterstatus = 0;
  }
  if(moisture_val < 850) { ///Turn on threshold
    waterstatus = 1;
  }
  //Pump compare, set status and report
  if(waterstatus != lastwaterstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Pump On]#");
      digitalWrite(waterPin, waterstatus);
        delay(watertime);
        waterstatus = 0;
        Serial.println("#S|ACTIONLOG|[Pump Off]#");
        digitalWrite(waterPin, waterstatus);
        lastwaterstatus = waterstatus;
      }
   }
 
 
 
  ////Humidifier trigger
  if(humidity > 70) { ///Turn off threshold
    humstatus = 0;
  }
  if(humidity < 50) { ///Turn on threshold
    humstatus = 1;
  }
  //Humidifier compare, set status and report
  if(humstatus != lasthumstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Humidifier On]#");
      digitalWrite(humPin, humstatus);
        delay(humtime);
        humstatus = 0;
        Serial.println("#S|ACTIONLOG|[Humidifier Off]#");
        digitalWrite(humPin, humstatus);
        lasthumstatus = humstatus;
      }
   }
   
   
   
  /////Status LEDs
  ////These store the ON and OFF data in the 'stats' string to be used when shifting out
  //Temperature
  if((temperature < 22) || (temperature > 28)) {
    stats[2] = 0;
    stats[3] = 1;
  }
  else {
    stats[2] = 1;
    stats[3] = 0;
  }
  //Humidity
  if((humidity < 60) || (humidity > 80)) {
    stats[4] = 0;
    stats[5] = 1;
  }
  else {
    stats[4] = 1;
    stats[5] = 0;
  }
  //Soil
  if((moisture_val < 850) || (moisture_val > 1000)) {
    stats[6] = 0;
    stats[7] = 1;
  }
  else {
    stats[6] = 1;
    stats[7] = 0;
  }
  ////Checks if update to control panel is needed
  //And copies 'stats' string charachter by character to 'previousstats'
  if(stats != previousstats) {
    led();
    for(int z = 1; z<15; z++) {
      previousstats[z] = stats[z];
    }
  }
 
 
}


////Changes stats string to bits and shifts them out
void led() {
  byte bitBuffer1 = 0;
  bitWrite(bitBuffer1, 1, stats[1]);
  bitWrite(bitBuffer1, 2, stats[2]);
  bitWrite(bitBuffer1, 3, stats[3]);
  bitWrite(bitBuffer1, 4, stats[4]);
  bitWrite(bitBuffer1, 5, stats[5]);
  bitWrite(bitBuffer1, 6, stats[6]);
  bitWrite(bitBuffer1, 7, stats[7]);
  byte bitBuffer2 = 0;
  bitWrite(bitBuffer2, 1, stats[8]);
  bitWrite(bitBuffer2, 2, stats[9]);
  bitWrite(bitBuffer2, 3, stats[10]);
  bitWrite(bitBuffer2, 4, stats[11]);
  bitWrite(bitBuffer2, 5, stats[12]);
  bitWrite(bitBuffer2, 6, stats[13]);
  bitWrite(bitBuffer2, 7, stats[14]);
  digitalWrite(latch, LOW);
  shiftOut(data, clock, MSBFIRST, bitBuffer2);
  shiftOut(data, clock, MSBFIRST, bitBuffer1);
  digitalWrite(latch, HIGH);
}

And as always all suggestions are welcome
9  Community / Exhibition / Gallery / Re: Greenhouse automation on: May 18, 2011, 10:35:33 am
Hey,
It is just two phase mains. And chose the 6A fuse as the max current for the relay is 7A. But I can always swap the fuse for a smaller one as the lights will probably draw a maximum of 1A. And the switches on the control panel are just a sort of kill switch just in case something like the water pump freaks out.
10  Community / Exhibition / Gallery / Greenhouse automation on: May 17, 2011, 08:25:53 pm
So I'm back after being long gone. Sick of internships hehehe
Anyways a friend just asked me to build him a greenhouse.
Now it seemed cool to automate it with Arduino.

So for some requirements:
*Measure temperature, humidity and soil moisture
*Control lights, fan and watersupply
*Simple overview of current conditions
*Graph conditions in Excel

Measuring temperature and humidity is simple with an SHT71 sensor
Controlling with a few relays
I'll be pulling log data over the serial connection and using Gobetwino to store them in as a .csv file

I had most schematics in my head but I drew them up for you guys.
Here are the two sensors, and yes the nail trick I "borrowed" from the Garduino instructable.


Here is the control panel which shows power, status of temperature, humidity and soil moistness. Whether lights, fan or pump are on and mains switches for lights, fan and pump.


And the relay board, and yes I have forgotten about the diodes in this drawing.


I also came up with some code
Code:

#include <Sensirion.h>
#include <Time.h>

//Temperature and Humidity sensor
const uint8_t dataPin  =  2;
const uint8_t clockPin =  3;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

//Temperature and Humidity interval time
long previousMillis = 0;
long interval = 300000;

//Soil moisture
int moistureSensor = 0;
int moisture_val;

//Serial stuff
char buffer[5];

//Relay output pins
const int lightPin = 4;
const int waterPin = 5;
const int fanPin = 6;

//Status LED pins
const int tempgoodPin = 7;
const int tempbadPin = 8;
const int soilgoodPin = 9;
const int soilbadPin = 10;
const int humgoodPin = 11;
const int humbadPin = 12;

////Lightstatus
int lightstatus = 0;
int lastlightstatus = 0;

//Fanstatus
int fanstatus = 0;
int lastfanstatus = 0;

//Watering
int watertime = 1000; //In milliseconds
int waterstatus = 0;
int lastwaterstatus = 0;

void setup()
{
  Serial.begin(9600);
  setTime(20,7,0,17,5,2011);
  pinMode(lightPin, OUTPUT);
  pinMode(waterPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(tempgoodPin, OUTPUT);
  pinMode(tempbadPin, OUTPUT);
  pinMode(soilgoodPin, OUTPUT);
  pinMode(soilbadPin, OUTPUT);
  pinMode(humgoodPin, OUTPUT);
  pinMode(humbadPin, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  time_t t = now();
 
  //Check Temperature.... and report every 5 minutes
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
   
    tempSensor.measure(&temperature, &humidity, &dewpoint);

    moisture_val = analogRead(moistureSensor);
   
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.print(" C, Humidity: ");
    Serial.print(humidity);
    Serial.print(" %, Dewpoint: ");
    Serial.print(dewpoint);
    Serial.print(" C, Soil Moisture: ");
    Serial.println(moisture_val);
    Serial.print("#S|TEMPLOG|[");
    Serial.print(itoa((temperature), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((humidity), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((dewpoint), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((moisture_val), buffer, 10));
    Serial.println("]#");
  }
 
 
  /////Light trigger
  if(0 <= hour(t)) {
    if(18 > hour(t)) {
    lightstatus = 1;
    }
  };
  if(18 <= hour(t)) {
    if(24 >= second(t)) {
    lightstatus = 0;
    }
  };
  //Light compare, set status and report
  if(lightstatus != lastlightstatus) {
    if(lightstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Light On]#");
    };
    if(lightstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Light Off]#");
    };
    digitalWrite(lightPin, lightstatus);
    lastlightstatus = lightstatus;
  }
 
 
 
  /////Fan trigger
  if(temperature <= 25) {
    fanstatus = 0;
  }
  if(humidity <= 60) {
    fanstatus = 0;
  }
  if(temperature > 28) {
    fanstatus = 1;
  }
  if(humidity > 80) {
    fanstatus = 1;
  }
  //Fan compare, set status and report
  if(fanstatus != lastfanstatus) {
    if(fanstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Fan On]#");
    }
    if(fanstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Fan Off]#");
    }
    digitalWrite(fanPin, fanstatus);
    lastfanstatus = fanstatus;
  }
 
 
  /////Water trigger
  if(moisture_val > 1000) {
    waterstatus = 0;
  }
  if(moisture_val < 850) {
    waterstatus = 1;
  }
  //Fan compare, set status and report
  if(waterstatus != lastwaterstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Pump On]#");
      digitalWrite(waterPin, waterstatus);
        delay(watertime);
        waterstatus = 0;
        Serial.println("#S|ACTIONLOG|[Pump Off]#");
        digitalWrite(waterPin, waterstatus);
        lastwaterstatus = waterstatus;
      }
    }
 
 
  /////Status LEDs
  //Temperature
  if(temperature < 22) {
    digitalWrite (tempgoodPin, LOW);
    digitalWrite (tempbadPin, HIGH);
  }
  else if(temperature > 28) {
    digitalWrite (tempgoodPin, LOW);
    digitalWrite (tempbadPin, HIGH);
  }
  else {
    digitalWrite (tempbadPin, LOW);
    digitalWrite (tempgoodPin, HIGH);
  }
  //Humidity
  if(humidity < 60) {
    digitalWrite (humgoodPin, LOW);
    digitalWrite (humbadPin, HIGH);
  }
  else if(humidity > 80) {
    digitalWrite (humgoodPin, LOW);
    digitalWrite (humbadPin, HIGH);
  }
  else {
    digitalWrite (humbadPin, LOW);
    digitalWrite (humgoodPin, HIGH);
  }
  //Soil
  if(moisture_val < 850) {
    digitalWrite (soilgoodPin, LOW);
    digitalWrite (soilbadPin, HIGH);
  }
  else if(moisture_val > 1000) {
    digitalWrite (soilgoodPin, LOW);
    digitalWrite (soilbadPin, HIGH);
  }
  else {
    digitalWrite (soilbadPin, LOW);
    digitalWrite (soilgoodPin, HIGH);
  }
}
I'm going to order all the parts this week so I'll be keeping you guys posted.
And ofcourse all suggestions are welcome!!
11  Using Arduino / Motors, Mechanics, and Power / Good old mechanical design on: March 15, 2011, 10:42:12 am
I came across some old videos on Engadget about old fashioned mechanical design.
This particular one is about some old balistics computer. And by using cams etc. it calculates quite a lot of things.
Anyways I thought it might be cool as most of us are quite spoiled with microcontrollers.
http://www.engadget.com/2011/03/14/us-navy-explains-basic-mechanical-principles-of-a-fire-control-c/
12  Topics / Interactive Art / Re: Domino Clock on: March 09, 2011, 09:25:15 pm
Hmmm alright, I'm drawing up some schematics as we speak. Regarding the LEDs, I used some tracing paper to cover the holes and during the day it was almost impossible to see the difference between on and off. Anyways I got some other stuff for my study to do now and just put together a new sort of bunk bed so didn't have that much time to continue this project.
13  Topics / Interactive Art / Re: Domino Clock on: March 06, 2011, 12:28:08 am
Hey guys!!
Wow this thing took off.
I was on a short internship so that's why I havent been online for quite a while.
Anyways i did have some trouble which had to do with the leds.
Basically they were not bright enough so I added two extra very bright leds but to no avail.
I added a voltage regulator to each board to deal with the current but F'ed them up aswell.
Either way I'll read through the thread and see if i can help anyone!!
14  Topics / Interactive Art / Domino Clock on: January 26, 2011, 02:50:54 am
Yeahhh!! First topic.

First of all I guess this will fit in here. And part 1 is now here: http://arduino.cc/forum/index.php/topic,6671.0.html

Well to continue:
Slapped the first layer of paint on the stones and lightly sanded it:

And to put it into perspective, I added a beer can oh and the circuit boards are done (will post the circuit and code when it's working nicely):


Onto something more electrical than wood and paint smiley
So I mounted the LEDs in short pieces of drain pipe:

And to close the back I used some aluminium foil (for our American buddies that is tin foil or aluminum foil smiley-wink ):


Looks like smooth sailing... well not really. The boards with the shift registers, in my finite wisdom I randomly wired the first one... doesn't sounds like a problem but with the whole dataArray stuff the all have to be wired exactly the same. Then there are the LEDs, the slight Dutchness inside me said: buy the cheapest, is best bro!! Now turns out is not best bro... They hardly give of any light, so had to order new bright ones. Either way progress is good, more updational goodness to come later today or tomorrow or whenever there is more to post.

Oh btw, I'm still not sure whether to make the stones clean black or roughen it up a bit for the aged look?? Any ideas??
15  Forum 2005-2010 (read only) / Interfacing / Re: Playstation 3 force feedback mod on: January 03, 2011, 04:41:14 pm
Alright,
I'm going to get some parts tomorrow and see if I can get it to work.
Hope it works, either way ill post an update ASAP.
Pages: [1] 2 3