Arduino Greenhouse

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Arduino Greenhouse

Postby BK1981 » Thu May 03, 2012 8:04 pm

Hi, everyone. I'm a student at Fab Academy building my final project, which is a press-fit acrylic greenhouse with an Arduino-controlled irrigation and vent system. I am looking at using the AM2302 temperature and humidity sensor, but am worried about running it along with a servo (for the convection vent) and solenoid water valve off the Arduino; I've been advised that the temp/humidity reading loop might conflict with the servo control script. Thoughts?
BK1981
 
Posts: 7
Joined: Thu May 03, 2012 7:40 pm

Re: Arduino Greenhouse

Postby tfunk10258 » Fri May 04, 2012 3:00 am

I suppose that depends on what you mean by conflicts. That sensor is very slow for reading from, roughly 250ms per read (temp and humidity) which means if you call a read of both, it will take roughly 500ms, time during which your arduino can't be doing other things. Depending on what else you're trying to accomplish, this may or may not be workable.
tfunk10258
 
Posts: 5
Joined: Mon Mar 05, 2012 1:36 am

Re: Arduino Greenhouse

Postby adafruit_support_bill » Fri May 04, 2012 5:11 am

I would not expect that your control loop timing constraints would need to be all that tight for a greenhouse application. Temperature and humidity don't change all that fast. And even if they did, you would not want to be opening and closing vents and valves every few seconds.

The only way I could see that it would interfere with servo timing would be if you were trying to do the servo PWM in software. If you use the Servo library, there is not need for critical servo timing in your code.
User avatar
adafruit_support_bill
 
Posts: 15962
Joined: Sat Feb 07, 2009 9:11 am

Re: Arduino Greenhouse

Postby adafruit_support_mike » Fri May 04, 2012 7:15 pm

On the software side, you'll probably have the best luck with a fairly slow polling loop that uses the Arduino's millis() function:

Code: Select all
void loop () {
    unsigned long startTime = millis();
    unsigned int temperature = readTheTemperature();

    if ( thisTempNeedsChanging( temperature ) ) {
        adjustTheVentsFor( temperature );
    }

    unisgned int humidity = readTheHumidity();

    if ( thisHumidityNeedsChanging( humidity ) ) {
        adjustTheIrrigationFor( humidity );
    }

    unsigned long currentTime = millis();

/* make each pass through the loop about 5 min long */
    while ( 300000 > (currentTime - startTime) ) { 
        delay (1000);
        currentTime = millis();
    }
}


As long as your total loop time is longer than your longest possible sensor/servo times, you won't have to worry about collisions.

You will need to protect against overflow conditions from millis() if you intend to run the controller for a long time though. The clock counter rolls over about every 50 days.
When you void a product warrany, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 1332
Joined: Thu Feb 11, 2010 1:51 pm

Re: Arduino Greenhouse

Postby BK1981 » Thu May 10, 2012 7:05 pm

Thanks, guys.

I've received the 2302 and am attempting to connect to it through my fabbed Arduino. I was previously successful in burning the bootloader through a FAB ISP and loading example sketches, but it's now giving me an ""avr-gcc: CreateProcess: No such file or directory" error.

I've tried the steps listed here (http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1238257341) with no joy. Thoughts?

B
BK1981
 
Posts: 7
Joined: Thu May 03, 2012 7:40 pm


Return to Arduino

Who is online

Users browsing this forum: No registered users and 8 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]