Programmable Grow Controller - Arduino

Discussion in 'Growing Organic Marijuana' started by ChefZiggy, Jan 29, 2015.

  1. Has anyone ever played around with the Arduino or Raspberry Pi micro-controllers?  Been thinking about doing something for fan/light/heater control.  
     
    The problem for me is that most timers are either on or off.  Sometimes I'd like to stage things such that when the lights are on, the fan runs constantly, but when the lights are off I'd like to only run the fan for 30 minutes every couple of hours.
     
    Or, when the lights are on, the heater doesn't run, but does when it's off.  
     
    Doing all of that with a bunch of timers would be madness.  But I'm thinking about building a controller box that could do all of that and more.  Not only could I pretty much program any sequence for a set of outlets, but I could incorporate current sensors that would insure that I didn't overload my main supply.  
     
    Or add temperature and humidity sensors to control the heater and humidifier to maintain a near perfect environment.  Could have lights on and lights off temperature settings.
     
    Could possibly add watering controls and turn on a pump at predetermined intervals.  
     
    Thoughts?  Suggestions?  Other ideas?
     
    I guess I need to put together a parts list and see how much this would end up costing me.  If anyone else is interested I'll post my findings.  (I've found a grow room controller project that will give me a nice starting off point already.)

     
  2. Are you sure you don't want to run your fan constantly?  How else are you going to control odor?
     
    Run your lights on a timer.  Run your fan on a timer as well, very simple to program 1/2hr on 1/2hr off, if this is still a good idea. I'd also just run the heater on a timer...making it so it's only on for 11hrs of your 12hr night cycle so you don't overload your breaker. Or put the heater on a 30 dollar thermostat if you like.
     
    Watering...tropf blumat.  Or set up a drip system on a timer as well. 
     
  3. #3 BHamBudzNW, Jan 30, 2015
    Last edited by a moderator: Jan 30, 2015
    I run Titan Mercury 4 fan speed controllers, they are TITS. As for controlling everything else I use a Sentinel EVC-2. Those two things alone will run everything but your lights and watering system.

    Bham


    Sent from my iPhone using Grasscity Forum
     
  4. I've got a little fan speed controller not sure what brand...certainly helps keep temps where I want them.
     
  5. I haven't, but one of my old professors was raving about them when they first came out. Very powerful and very customizeable.
    This dude's got at least 15 apps published.
     
  6.  
    Odor isn't a huge concern for me.  Plus I have my room pretty tight.  The fan needs to run whenever the light is on for cooling the tube.  If it only ran 30 minutes every two hours overnight, that would give me air exchange, odor removal before it got too bad, and better heat retention.  It gets a bit cold in the basement overnight.  This would let the heater run less.
     
     
    I haven't looked at those, but I will.  Pretty sure I could get a fan speed control module for the Arduino.  I was just thinking on/off with a relay, but that's a real possibility right there.
     
    And I know there are water flower sensors, I bet there are solenoid valves to be had as well.
     
     
    And if one of these don't fit the bill, there's Raspberry Pi, BeagleBone, Intel Edison and others.  Heck, you can put a working computer (Linux) in an Altoids tin!
     
    AltoidsTinPC.jpg
     
  7. This may become something of a journal...
     
    I've decided to back off for my first project and make a Drying Tent controller.  I really have trouble keeping the RH and temps where I want them in my drying tent.  RH more so than temps.
     
    Today I ordered a starter kit so I could get familiar with the gist of things.  Once I'm comfortable with that, I'll start on the controller.  I want to do the following:
     
    • Monitor Temp & RH & Display on Screen
    • Monitor AC Current Use & Display
    • Log data to SD card for analysis
    • Set Temp dead-band - HEAT_On @ <70F - HEAT_OFF @ >75F - EXFAN_ON @ 80F - EXFAN_OFF @ <75F
    • Set RH dead-band - HUM_ON @ <40% - HUM_OFF @ >45% - EXFAN_ON @ 49% - EXFAN_OFF @ <45%
    • (Uses the exhaust as an additional mitigating device)
    • Set Exhaust Fan Timer - If no other activity in X time, run for 15 minutes every Y hours.(Odor control.)
    • Use WiFi dongle to retrieve data & program
    \nThe kit includes a few of these parts, but this is a general idea on the cost.  (The kit has the Uno, the LCD display shield and one 2 channel relay block.  I'll need another 2 channel block or get a 4 channel block.)
     
    • Arduino UNO - $25/$15 (OEM/Compatible)
    • 2 Duplex Outlets - $5
    • 1 Temp & Humidity Sensor - $5-10
    • 4-Channel Relay - $8
    • 1 Hall Effect Current Sensor to monitor current use - $3
    • LCD Display Shield - $12
    • Real Time Clock & Data logger - $12 (Requires SD card)
    • WiFi Dongle - $5
    • Box & Misc. - $10-15
    \n\nTotal, around $85 give or take a bit.  I suspect, that after prototyping, I could use a much smaller Arduino unit (The Mini) and save a few bucks there too.
     
    Thoughts?  Anything else I would want a drying controller to do?
     
    I've already got a HUGE jump on the code with this project I found.
     
  8. #8 StayLowGrows, Feb 5, 2015
    Last edited by a moderator: Feb 5, 2015
    I originally type a long message rambling on...I delete it obviously.
     
    I looked through the source code from the project you linked above. Looks like a great alternative to learning C and C++ as opposed to a game called "Hedgewars", http://www.hedgewars.org. What a steep curve there...whew!
     
    This is definetly what I needed. Happens that I wanted to attempt this idea many years ago but for numerous reasons was never able too. I am now.
     
    However, I don't own an arduino nor will I for atleast a couple months. I did work on setting up my development environment for arduino a few months back, so I just need to update everything.
     
    I don't frequent here too often anymore, but I will be back and am working on this. Anything to know in the meantime?
    Does the source code work with the UNO?
     
  9. #9 BirchPlease, Feb 5, 2015
    Last edited by a moderator: Feb 5, 2015
    Subbed in for this. I've been researching grow room automation lately. Can't wait to see how it comes out!

    Edit: in regards to the fan being either on or off, what I've been looking to do is set an idle speed and a temp threshold that kicks the fan into high speed for cooling, like what I think the Mercury controller does. Ideally - set the idle speed to what keeps my room at the temp I want, and have the high temp set more as an emergency override. Otherwise I'd be worried the fan would be constantly ramping up and down.
     
  10. #10 ChefZiggy, Feb 5, 2015
    Last edited by a moderator: Feb 5, 2015
    I don't have mine yet either, but it should be at home when I get there this afternoon. I do have the IDE loaded and have begun working on some changes to the code already. I'll upload a copy when I get happy with it.

    I have only had a little exposure with C/C++ quite a few years ago, but it's coming back. Having a good reference for both that and each of the parts you use is very helpful. The main Arduino site has lots of reference material.

    This code was written with the Uno in mind, but I think it is pretty universal other than maybe some of the pin numbers. And those may change depending on which shield you add. Not sure how that works just yet.
     
  11. Right on.

    I spent today being anal with configurations. Think I'm going to look at the eclipse plugin tomorrow but as long as the Arduino IDE will suffice, I'll keep a version with minimum changes running in the least.

    Where next?
     
  12. I've been working on an automation system for my closet. It uses both the R-Pi and the Arduino. The RPI does all the processing and the arduino reads the sensors and sends the readings to the R-PI over a serial connection.
     
    I modified a power-bar so each individual outlet is controlled by a relay, which will be controlled by the Pi.
     
    Currently, I'm programming which is by far the toughest part. The thing that's slowing me down is designing the program so it's expandable and modular so that making changes will be easy and straightforward as I add more sensors and equipment. I'm programming using Java by the way, since it's what I'm most familiar with.
     
  13. I'm doing a three stage heat control for the tent. If less than the minimum temp, heater comes on, if over max, heater off. If more than 5 degrees over, turn on exhaust. Again, this is for drying, so I don't want to pump out all the moisture I'm trying to keep since I normally have to deal with very low humidity. Similar thresholds on the humidifier.

    Will eclipse write to the controller? I admit I don't care for the Arduino editor, so I've been using Notepad++ for major editing.

    I'd love to see what you have so far.
     
  14. OK, I've been having too much fun.  Found the Fritzing software and even though I can buy this relay board ready to go, I had to have a play at it.  Here's a schematic and PCB layout (Top & bottom) for a fictional heavy duty relay board.  The relay has a 5VDC coil and contacts rated for 20A @ 250VAC.  I need a heavy one for running a heater.  Biggest single draw I've got to worry about in the drying tent.
     
    This is also opto-isolated to protect the controller board with an LED to show status of the relay signal.  All in a package measuring only 58x40mm.  (Surface mount components.)
     
    Cool, huh?  If I was actually going to make this, I could export all the needed files to have a board made for me. Or I could go old school and photo-etch them myself.  But then I wouldn't have the silk screen.
     
    Schem.png
     
    PCB_Top.png   PCB_Bottom.png
     
  15. Got to play around a little more today. Still working my way through the tutorials while I wait for the rest of my parts.
     

    Attached Files:

  16. Sorry for taking so long on getting back to this. Currently my grow controller project is on the back-burner, but I'll go through parts and sensors that I have to help give ideas.
     
    Raspberry Pi: This is the brain of my control system. I have a 7" touchscreen  that will provide a nifty GUI to toggle setting and what-not. The touchscreen isn't really required since you can remotely control the pi from any computer, it's just something cool. The Pi has internet access and acts as a database/server so I can make adjustments to the system from anywhere with internet access. The Pi directly controls my power-relays with its IO pins.
     
    Arduino uno: This is for reading the sensors. It sends a string of comma-separated values to the Pi once every second through the TX and RX pins. Theres a few reasons the Pi isn't reading the sensors directly: In order to filter out signal noise, many samples must be taken from each sensor and then averaged out. I don't want to tie up the Pi's computational resources with he sensor readings. As well, some digital sensors require very precise timing on signal reading, and the Pi can't guarantee proper timing with the other processes that will be running.
     
    8 channel ,120 V, 10-amp relay board. -A standard set of relays. To make the wiring less messy I combined it with a power bar, so each outlet is individually controllable. If you open up a power bar, you'll see 2 strips of metal going down each side for the prongs. I cut one of those strips into sections for each outlet, and soldered a wire to each piece. Then i hooked up the relays with one side of the switch hooked in parallel to the other relays and the intact strip, and then the other end of each switch to one of the pieces corresponding to each outlet.
     
    Linear resistor temperature probes: they cost less than $2 each and are fairly accurate. They are water-proof and can handle high temperatures, so they ca be used anywhere you want a temperature read.
     
    Humidity sensor: I use a DHT-11 or DHT-12 to read humidity, they cost about $10. It's a digital sensor, so getting a reading isn't as simple as getting the voltage from a pin. There's pre-made arduino programs for them, so it's easy to integrate into your setup.
     
    PH sensor/probe: One of the more expensive components at $60 for the board and probe, it's an analog sensor so reading it is simple- the datasheet comes with the formula to turn the micro-volt reading into a pH value.
     
    Water-level sensor: about $3-$5 each, it looks like a circuit board with long strips of exposed metal. I'll be using them to keep the water level in my bubble-buckets as well as quantify how much water the plants drink up (the Pi will be able to display graphs for things like this).
     
    Water-level switch: uses a float to turn a switch on and off, costs about $5 each.  good for controlling max/min water levels. They're more fail-safe than the sensors.
     
    Water-line solenoids - Basically these are relay switches for water, they cost ~$5 each. Look for them in plumbing stores, they're used for dishwashers and washing machines. If your grow has access to pressurized water lines, these will fill reservoirs or whatever for you without need for worry. Make sure to put a float-switch in series with the solenoid to avoid over-filling.
     
    Peristaltic pumps- Cheap and reliable low volume pumps that are perfect for pumping nutrient mixes as well as pH buffers. These will let you create tailor-made(exact ppm/ratio of each part) nutrient solution as needed with no work required by you.
     
     
    If you have more sensors than analog inputs (which will happen) get an 8 or 16 channel MUX (multiplexor) board. It'll use 3 or 4 digital pins, but it lets connect up to 16 sensors to one input. The digital pins are for pointing which sensor is being read. Simple for-loops can cycle through each input easily.
     
     
    So that's what I have for now. Programming is the tough part depending how in-depth you want to go with things.
     
  17. I've got nothing to offer here, just a cheap way to follow his thread, lol.

    I've long been interested in a DIY controller. I can't program at all so ive mostly thought about how i could use PIDs instead.

    I'm going to stay tuned!
     
  18. Im trying to make one myself... just dont have enough time to research how to do what I want... As for fan control, I plan to use a transformer to get mains down to about 6v, make a zero crossing detecting circuit, then use pwm for the clipping (wrong term but I think you know what I mean) signal to a triac.  obviously could easily use a pot, but by using the arduino and pwm, I basically have 254 levels of speed control, automated including ramp speed.  I was thinking of doing the CSV data transfer, but what about using the usb cable and freeing up a few pins.  I believe the pi can querry what it wants when it wants it, but of course have alarms set for the omega to send signals when something is out of spec.  I want to order a pt100 multiplexer and have sensors in each of my lights so know if the fan in moving enough air through all the lights to keep things from melting.  use an... aaaa... crap cant think of the name... little ic that uses i2c, can control all 8 channels of a relay board with only 3 pins from the arduino. (edit: shift register) I want to program it so the arduino does the bulk of the work, variables like times, temp set points etc are relayed via the pi.  Use the pi ethernet and run a gui and put it on a web server so I can monitor and change setpoints from my phone.  Sounds like a fun project but takes time to research everything.
     
  19. #20 StayLowGrows, Apr 9, 2015
    Last edited by a moderator: Apr 9, 2015

Share This Page