# Arduino Controlled Grow and PC Program - Work In Progress



## AdvancedNewbie (Apr 15, 2012)

Hey everybody, first post, first ever grow. I have a simple ebb and flow setup, and everything is going great. While buying everything necessary for the grow, and having some background in controllers, programming and computers in general; when I found that 24 hour / 15 minute interval timer costs me about $20, a thermostat with 120V plug costs ~$70, a pH/PPM meter and all this stuff that didn't talk to each other and say 'hey, mix some new nutrients, and start the fan it's too hot in here!' I thought to myself, "Really???"

So I bought 2 timers, a pH pen, a pump, a rubbermaid container, a cheap plastic table and a 1000W ballast with a HPS bulb; just to get me started.

Well, all I can say is everything's great - my babies are beautiful and my setup is VERY analog and yet VERY simple. ( I like simple - but something can be made that's just as reliable and does a better job... )


But, still - I wanted to later on upgrade my system with time, and that just means forking out the money on the control units, etc, right? WRONG.

If you've never heard of an Arduino, it's basically a C++ based development platform, but is VERY comparable to a 'PLC'.
From Wikipedia, the free encyclopedia:
_"A *programmable logic controller* (*PLC*) or *programmable controller* is a digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, amusement rides, or light fixtures. PLCs are used in many industries and machines. Unlike general-purpose computers, the PLC is designed for multiple inputs and output arrangements, extended temperature ranges, immunity to electrical noise, and resistance to vibration and impact. Programs to control machine operation are typically stored in battery-backed-up or non-volatile memory."

_- I'm using an Arduino Duemilanove for this project - with 5 Analog Pins and 13 digital pins - 2 of which are needed for communication
- The PC Program is coded in VB.NET

So let's compare some costs of some hardware, starting with the consumer available product first, then compared to the Arduino route (5v PLC, basically):
120V 24-hour / 15 minute timer: $24
25A SOLID STATE RELAY 4-32VDC INPUT 48-660VAC: $15

4 Timers: 4 * $24 = $96
4 Channel DC30V 10A AC250V 10A: $12

Temperature/Humidity Display: ~$15
I got 5 temperature/humidty Sensors on ebay for: $1.57 (the value from this can be used to control a 120V or up to 660VAC - thereby eliminating the cost of a $70 120V thermostat)

pH pen: ~$30
pH sensor: $20, and Adapter: $15 - a little over the price of the pen here, but does the pen log the data? Can it turn on and off anything? Tested: I got it to match the value of my pH pen +/- 0.03

Ethernet Shield for Arduino: $15

Wireless (up to ~100m): 2 for $6 (one to transmit, one to receive)

5V (control) 120V (operation) Solenoid Valves: $5 - $45 (probably best go with a reliable one)

Submersible Pump: ~$25

Yadda, yadda, yadda...

Anyways, I've loaded my Arduino up with the Firmata example sketch ( comes with arduino software = no coding for me ); although I did change the code just a little bit to get the analog I/Os working.
Next I started coding up a VB.NET that I've dubbed, "ArduinoFirmata_Lab" - originally it was "ArduinoFirmata_Grow", but I thought I might be able to use this for controlling other things later on, and didn't want the program to be associated with "growing" <--- You guys are lucky however to see the growing part associated with the project...

The control software, right now, can control all pins and get all analog raw data (0V - 5V reading computer reads as 0 - 4096 (I think) ) so the raw data gets punched though a calculation (which can be calibrated) and output anything you want (if it's a pH sensor, then use the pH calculation).

What works so far:
1) all readings from sensors (analog i/o)
2) all digital outputs (to control 5V pin off of controller, which in turn could run anything you can think of; in this case a relay to control something that is 120V or 240V or what-ever...)
3) all graphs / guages
4) all water timers (with any interval you want ---> think 15 minute water cycle is too much? Customize!)
5) light timer
6) history log - really an alarm log, I guess (pH too high, pH too low, High Humidty, Low Humidity, High Temp, Low Temp, and anything else you can think of - reservoir temp, plant temp, lumens, whatever!)

Currently working on (Busy right now - give me a week and a half )
1) pin configuration (add/remove sensor, relay, etc or change pin)
2) user log
3) Customizable interface ---> add a tab for each room and the associated stuff you want to control in that room. - right now you can add an image or button and move them anywhere you want and label the button anything you want it to and, instead of adding individual images, you could just take a picture of your whole room and load it as a background and just add buttons on top of that image
4) Still can't save settings / extra pages / button, image locations
5) Email Alert
6) Maybe I'll add webcam support - but there's already so many apps that already do this and probably more securely.
7) Waiting for my ethernet module and wireless modules to arrive
 Might need to add an SD card for a log / settings - ~$15
9) I'll add wifi later when I need it (maybe a couple years down the road when I have the setup I really want - I don't want to go overkill on a simple ebb and flow setup for now; just set myself up for what I really want later...) <-- Range? Up to you really - repeaters, internet, etc....
10) Maybe a phone web interface? We'll see, a little overkill right now.

So there you have it, a look inside my brain a little bit. I'm still waiting on most of the parts, so I'll keep you guys posted as the work continues (a little busy right now). The "to-do-list" is pretty easy stuff and half programmed already - won't take long at all... The next thing I'm going to do though, is update the arduino code so the arduino does not need the PC to run, but rather use the PC to connect up to the arduino and change its settings (then you won't need to run your PC all the time) - also, while not being fed with a 9V wall adapter, it can use a 9V battery as backup power - thereby never losing its settings.

Pics:


----------



## rmx (Apr 15, 2012)

Hey AdvancedNewbie,

That looks amazing! Major kudos on your work so far, and coming up with the idea in the first place! I dabble in programming and software development, but nothing as advanced as this. Brilliant stuff. I've not done a search, but is there anything similar out there? If not, you could be onto something here! This seems like it could be universally handy for all sorts of indoor growing, not just the mj scene. Huge potential audience out there if you were to release this as 'shareware' - I hope your idea comes to fruition, very cool! Will definitely keep an eye on this.

Great lookin' green there too


----------



## psari (Apr 15, 2012)

sub'd 

Curious on how you'll keep the PH measurements actually in check over time etc. Should be interesting if you're willing to keep this thread up to pace with the progress.

Thanks in advance for the efforts.


----------



## AdvancedNewbie (Apr 15, 2012)

Well, so far I've tested different water samples with pH up and pH down added, and compared the values to a pH pen I had bought... But I have ordered some buffered pH solution to calibrate with later on. But the sensor does seem to be agreeing with the pen. In the last screenshot, there is a calibrate column and in each cell there's a button so you can put in your formula (in a new window). I looked on the datasheet for the sensor (just googled it) and found there was a suggested formula to use when converting the raw signal value into a useable value. This is common with other sensors too, like thermistors, etc. I did however find that I needed to tweek the formula a little, but got it working pretty quick using their forumla as a general baseline.

@ rmx: I haven't found anything as cheap as this just some updates I want to straighten out first and I'll probably post the code somewhere... But I did find a program (and hardware) called, 'Growtronix'... It's a pretty similar design concept as what I'm buidling, but I'm trying to stay free and open source... I think people should have the right to add a feature if they think of something that's missing... and that missing thing is usually different for every user.


----------



## psari (Apr 16, 2012)

AdvancedNewbie said:


> ... *but I'm trying to stay free and open source*... I think people should have the right to add a feature if they think of something that's missing... and that missing thing is usually different for every user.


On the PH its more sensor drift over time. Obviously this isn't a leave it for 60 days approach or anything. Just figuring it will suffer the same slings and arrows all the pens do with needing calibration/drifting/etc. 

And of course, I cant double rep you for this alone. I'll just make sure that when I can I do. I spend time on that side of the fence as well so I'm really looking forward to this. Especially since I hate origin work. 

"*

You must spread some Reputation around before giving it to AdvancedNewbie again.





*


----------



## AdvancedNewbie (Apr 16, 2012)

If you were to leave for 60 days, you could re-mix nutes automatically and compare the pH value to what it usually is after a remix? That would let you know approx. how much the pH value is off (if your concerned while monitoring remotely), other than that calibration is always a necessity. - No real plans to have a robotic arm or something dip into calibration pH buffered solution or anything like that though....

As I posted on another thread:
View attachment 2124524

Edit: You would need a one way valve comming off that pump so when the pump turns off the nutes don't backflush through the pump.


----------



## The Scooby Master (Apr 16, 2012)

Sweet. I was just looking through the forums to see if anyone had experimented with this in the past. It is nice to come across an active thread that is just beginning.

In building a new grow room, I was thinking about putting together an arduino based data collection system and using a Rainbird sprinkler controller to control hvac. But now I am thinking I will build exactly what you did. Consider me subscribed and when you are ready for "beta-testing" keep me in mind.


----------



## AdvancedNewbie (Apr 16, 2012)

You bet Scoob', I just finished the e-mail alert function, cleaned up the 'design-your-own-interface' code up a little bit too, and everything seems to be working great. What kind of arduino do you have? I'm interested to see if the code's compatible with more than my Duemilanove.

I'm hoping to release a beta here pretty quick.


----------



## AdvancedNewbie (Apr 18, 2012)

I'll post some code either later today or on the weekend.


----------



## AdvancedNewbie (Apr 19, 2012)

Everything has been posted to: http://sourceforge.net/projects/arduinovblab/

Download page: http://sourceforge.net/projects/arduinovblab/files

Merry 420.

Edit: Don't get too excited though, it's still in alpha stages


----------



## The Scooby Master (Apr 21, 2012)

AdvancedNewbie said:


> You bet Scoob', I just finished the e-mail alert function, cleaned up the 'design-your-own-interface' code up a little bit too, and everything seems to be working great. What kind of arduino do you have? I'm interested to see if the code's compatible with more than my Duemilanove.
> 
> I'm hoping to release a beta here pretty quick.


Havent bought anything yet. What would you recommend and from where?


----------



## AdvancedNewbie (Apr 21, 2012)

I just received some relays off eBay, one rated for 30A 240VAC that I was going to use to control two 120V outlets (should be good for up to 2 ballasts - approx 2 x 8.5A) The problem with these relays, I've heard, is that the voltage spike when the light turns on can cause the contact to stick in the relay like a tack-weld so to avoid this from happening you need a relay with zero voltage turn-on, where it waits until the AC wave goes to zero, then switches. So I have ordered another relay that's not so 'cheap' but still fairly inexpensive. Just look for a solid state relay with zero voltage turn-on that has an switching voltage in the range of 5v... Mine has an 4-32VDC input, 48-660VAC 25A output for $16. I also bought a 4-channel relay module as well - this was also bought on eBay; just look up, "Arduino relay" and you'll see the boards. Keep in mind though, these are fairly cheap relays, but should work fine for things like pumps, oscillating fans, etc. However, the lights and exhaust fans might need a zero voltage turn on depending on the initial spike in voltage. Keep in mind you can wire up more that 1 plug to 1 relay, as long as you keep your relay's capacity in mind. pH sensor was off eBay "ph replacement probe" <--- they're blue from Hong Kong... hah - cheap, but what the hell, we'll see how it works, my tests in solution were pretty good. The connection from the pH sensor has a BNC plug which requires a module to interface with the arduino, I got the Phidget ORP/pH Adapter from some 'robot' store online a couple years back, so I couldn't tell you where from exactly. All of the electrical parts including the plastic outlet box was bought at home depot. Make sure you get the right electrical cable for the job, and keep all plugs and cables within their limitations. I bought regular wall electrical cable rated up to 300V - but I'm only running 120V - everything is three plug with ground. Temperature/Humidity sensors are Hong Kong specials too - eBay... hah, what the hell, with electronics stuff their eBay stuff usually works... My search was "Temperature Humidity sensor". I haven't messed around with solenoid valves and doubt I will, but you could make modifications to the program to auto-mix nutrients or anything else you wanted to do... Just a matter of setting up a sequence of events with 'stopwatches'...

EDIT: I bought my Arduino off SparkFun a few years back, but I wouldn't necessarily recommend SparkFun; I find their prices a little high. I'm developing this project for my Arduino Duemilanove, so I guess you could search for it somewhere, but eventually I'd like to maybe get a Netduino or something similar, but I'll stick to what I have I guess.

Anyways, *alpha 6 is up* and I changed some stuff around, a bit easier to understand the code now - I think... Still working on it.


----------



## AdvancedNewbie (Apr 21, 2012)

This site (http://www.mikerags.com/node/24) contains quite a bit of useful information about wiring outlets and controlling them with the arduino.


----------



## ElginAgain (Apr 22, 2012)

I've been planning on setting up a Arduino controlled grow, but haven't really gotten started yet. So need less to say I was very excited to see that you are working on doing the same thing. I'd like to be able to control; lights, ebb and flow pumps, PH/PPM measurements (and eventually adjustment via dosing pumps), temperature measurement of room/reservoir/ballasts/etc, and control of room/reservoir temperature, smoke detection and fire suppression control, entry to the room via RFID tag and linear actuator, and the list goes on. I've got a little bit of experience with arduino, from building my Reprap 3D printer, but not a whole lot. My growing experience is somewhat extensive as I've played a major role in the setup and success of two indoor grows. I've got a good grip on what needs to be measured/controlled and therefore definitely see the advantage in using an arduino to handle these tasks. 

Firmata is something completely new to me and I'm having a bit of trouble figuring out how to get your program to run. I've downloaded the files from your Sourceforge site, but I can't seem to figure out how to get the firmata application to run. I looked thoroughly for an executable file to run, but found nothing. What do I need to do to get the program to run?

I would like to help contribute to the project in any way possible. My first contribution will be trying to run in on an Arduino Mega 2560 as I ordered one of those off ebay for $31 and it should be here early next week.


----------



## AdvancedNewbie (Apr 22, 2012)

The program is coded in VB.NET 2008 - if you downloaded the code and want to change it you'll need VB.NET 2008; I have Visual Studio 2008. The zip that's available for download also includes a folder called 'Arduino Source' inside that folder is a file called, "StandardFirmata_Modified_ALL.ino" That file, you'll have to open with the Arduino Development Environment. (http://arduino.cc/hu/Main/Software). From in the Arduino IDE program, you'll have to upload the modified firmata code onto the arduino. As for all the ideas you have in mind are very much possible; I have a RFID reader right now that I haven't used in a while and I found it to be a little bit a work to get it working... But none the less, it worked. I have also seen some cheap magnetic door locks good for up to 1200lbs, and ones stronger than that even, and they require 5v to activate them. But if you know of any cheap linear actuator style locks, I think I'd be more interested in those as they don't rely on magnets. (even though when the power is off to a magnetic door lock they stay locked) The RFID reader I got was off eBay, "Arduino RFID module Kit 13.56 Mhz with Tags" I had no trouble modifying their sample code to get to work. I have not messed around with it in respect to getting it to talk through the Arduino and then to the PC, but it should be possible. The code would have to be re-written for the arduino to accomidate the reader, as (if I recall correctly) the RFID reader uses a UART style transfer method and I can't really picture that working without rewriting the arduino code... Hmm, but you got me thinking. I was thinking it would be easier to use your phone to unlock as this could be code on the PC code, but it would suck to be locked out of your room because your phone's not charged, or the Internet > PC > Arduino > Lock 'hops' didn't work out somewhere along the way... If I knew the mega's were that cheap on eBay I probably would have waited for on of those to arrive to play with it instead. Please let me know if you're able to get up and running. I'd like to support all Arduinos. I might also incorporate shift registers to get more outputs, but this would take some rewriting of arduino code too.

Edit: If you want to try out the compiled binary, you'll have to dig deep... In the zip: ArduinoFirmataVBExtended > bin > Release > ArduinoFirmataVBLab.exe


----------



## AdvancedNewbie (Apr 23, 2012)

All done my relay box:


----------



## ElginAgain (Apr 24, 2012)

This looks like a cool app you've got going here. I've got a copy of Visual Studio 2008 Professional Edition and my Dad is a wiz with programing of all sorts, so he should be able to offer some help with this project. Only problem is that Dad knows very little about Arduino or electronics in general, he's purely a software guy. Myself on the other hand, I'm a hardware guy so in therory we should make a great team.

I also found the Arduino sketch, but have yet to upload it. The Arduino Mega 2560 (compatible, A.K.A. Knock-off) arrived in the mail today. Here's the link to the one that I bought off Ebay, the seller ID is wadirect, they didn't have the cheapest price @ $31.90, but they were the closest seller to my house, I ordered it on Friday and it arrived Monday, so it was definitely worth the extra $6 not to have to wait for one to be shipped from China.

I started playing with it a little bit and got some of my Dallas (DS18B20) temperature sensors to work with the example code provided with the "Dallas Temperature Control Library". 

After doing some research today, I'm not convinced that FirmataVB is compatible with the Mega 2560. Luckily I've got an old Duemilanove laying around that will definitely be compatible with firmata and the program the you've written. Although I am going to dig a little bit deeper and test to see if I can get firmata to work with the new Mega 2560.

Do you think that I will be able to get the DS18B20 (One-wire) Temp sensors to work with Arduino Firmata VB Lab?

I've also been looking at getting an Atlas Scientific pH kit which communicates with the Arduino via the UART (RS232 Rx/Tx Pins) and seams like it would be much easier to calibrate than the Phidgets unit, because it has all the calibration features built in and you just send commands to it via the serial monitor. Atlas Scientific also makes a Conductivity Kit which measures E.C., T.D.S., and Salinity. Which could be used to measure PPM of the nutrients. The conductivity kit also communicates via UART (RS232). Granted these are probably not the cheapest solution to measuring PH and PPM, but it seams like they might be the easiest to setup, configure, and calibrate.

Do you think that it will be possible to get these Atlas Scientific sensors to work with Arduino Firmata VB Lab, without too much trouble? One issue that I see might be a problem is that the Duemilanove has only one set of Rx/Tx pins (the Mega 2560 has 3 sets). I'm not sure if it is possible to assign some of the other digital pins to function as UART (RS232 Rx/Tx) or if you are stuck with just the two digital pins 0 and 1, labeled Rx and Tx.


----------



## AdvancedNewbie (Apr 25, 2012)

I looked up some info on those one-wire devices. It seems that each one has an address, and multiple sensors can be ran with having one master and the rest run as slave. I found some example code on the arduino website (http://arduino.cc/playground/Learning/OneWire). I don't think I'll be doing this, just because everything is setup for a 3 wire right now and there are enough pins on the Arduino to not require assigning more addresses. Keep in mind though that with a three wire system you can run a everything off the same ground and everything off the same 5V source (check current draw to make sure you don't exceed whatever your Arduino is rate for) but have each output signal go to a serperate pin on the Arduino. It would be neat if you could search for all the sensors by searching through the addresses for responses though. I might incorporate shift registers a little later which increases the total number of outputs and, if I'm not mistaken, every sensor gets its own address as well. (The three wire sensors have to be cheaper as they are just the sensing circuit minus the send/recieve/multiple address circuit that is required to run them). Maybe there is something else I do not know about them... After getting the program GUI a little nicer, I think I'm going to end up changing the Arduino code to do all the timers and alerts for me so the Arduino can become independent and think on its own. I would like my program to 'come up' with the new Arduino code, then upload the code to the Arduino and still have it controllable through the PC (but not necessary). But that's a little later. I like those Atlas-Scientific sensors though; they look pretty professional. Conductivity is next for me; everything on that site looks like a BNC connector; those BNC breakout boards are cheap and work good (that's what I'm using for my pH probe). One of these days it'll be my random $100 purchase of the month.

*Update: Alpha 7 now up*
What works so far:
1) All Readings from sensors (analog i/o)
2) All Digital Outputs (to control 5V pin off of controller, which in turn could run anything you can think of; in this case a relay to control something that is 120V or 240V or what-ever...)
3) All Graphs / Gauges
4) All Water timers (with any interval you want ---> think 15 minute water cycle is too much? Customize!)
5) Light Timer
6) Alarm Log (pH too high, pH too low, High Humidty, Low Humidity, High Temp, Low Temp, and anything else you can think of - reservoir temp, plant temp, lumens, whatever!)
7) Pin Configuration (add/remove sensor, relay, etc or change pin) - including device calibration formula - ex: 1.728x^2 + 0.85x + 10 --> program subs in raw analog value for x
 Email Alert
9) Customizable Interface ---> add a tab for each room and the associated stuff you want to control in that room. - can add Button, Label, StatusLabel, Gauge, Graph, Image
10) Can Import a new tab now, working on the export ---> 4/25/2010 (save a page with gauges, buttons, etc and open later, or by default)

11) Relay/Interface Box done - might add some acrylic to make it look special

 Currently working on

1) User log
2) Maybe I'll add webcam support - but there's already so many apps that already do this and probably more securely.
3) Waiting for my ethernet module and wireless modules to arrive
4) Might need to add an SD card for a log / settings - ~$15
5) I'll add wifi later when I need it 
6) Maybe a smart-phone web interface? We'll see, a little overkill right now.
7) Independent Arduino Code
 Manage Events (Add,Remove,Create)?
9) Export Tab - save the layout of all controls


----------



## AdvancedNewbie (Apr 27, 2012)

*Alpha 9 is now available for download*

Seems like we're getting pretty close to the beta stages here now, all timers are working great;
You can choose On Time / Off Time Timer, On Time / For Duration Timer (and set which days each timer is active)
There are setpoints now, if you setup a temperature sensor for example, then you you could set 'if the temperature goes above 27 degrees Celsius, turn on a pin' (which could be a fan)
All alerts with email are working - they are based on StatusLabels MinValue/MaxValue.
Importing Tabs is easy, and everything is stored in an Access Database which can be 'hacked' at will. (There's an included example for Ebb and Flow)

*https://sourceforge.net/projects/arduinovblab/

*


----------



## AdvancedNewbie (Apr 28, 2012)

ElginAgain said:


> Do you think that I will be able to get the DS18B20 (One-wire) Temp sensors to work with Arduino Firmata VB Lab?
> 
> I've also been looking at getting an Atlas Scientific pH kit which communicates with the Arduino via the UART (RS232 Rx/Tx Pins) and seams like it would be much easier to calibrate than the Phidgets unit, because it has all the calibration features built in and you just send commands to it via the serial monitor. Atlas Scientific also makes a Conductivity Kit which measures E.C., T.D.S., and Salinity. Which could be used to measure PPM of the nutrients. The conductivity kit also communicates via UART (RS232). Granted these are probably not the cheapest solution to measuring PH and PPM, but it seams like they might be the easiest to setup, configure, and calibrate.
> 
> Do you think that it will be possible to get these Atlas Scientific sensors to work with Arduino Firmata VB Lab, without too much trouble? One issue that I see might be a problem is that the Duemilanove has only one set of Rx/Tx pins (the Mega 2560 has 3 sets). I'm not sure if it is possible to assign some of the other digital pins to function as UART (RS232 Rx/Tx) or if you are stuck with just the two digital pins 0 and 1, labeled Rx and Tx.


I just found some information regarding UART on any pin, one wire addresses, and shift register addresses, all is possible - but you have to designate your pins in the arduino code.


----------



## curiositykilledthecat (Apr 30, 2012)

Nice work - and good hit on the one-wire. I've been planning on using one-wire for temperature and recently found ones for humidity. That and an LCD screen for the local-access - and maybe an ethernet shield for remote as well. SSRs

For the relays - if you run them well under capacity you should be fine. Also if they're rated for motor start the specs will tell you - that is if you can get specs. 

If you switch to SSRs be sure to properly heat sink them. Perhaps more a note to others that might not know. That 30A SSR is probably only rated at that with a decent heat sink. Not a bad deal - but it's probably only good for 5A (100% duty) w/o heat sink. Also for SSRs (which I didn't see in your wiring box photo) remember that they also can fail shorted / closed circuit. In fact - I've had two PID controllers on epoxy curing ovens go open-loop. Alarm lights blinking on the controller all the while the embedded SSR was letting everything run. Not fun when the wife mentioned "Honey, you might want to look at this, you've got smoke coming out of your curing oven"  Too close to having a fire. Fool me twice and now I use a water heater safety thermostat. If you look at your top element - there's an extra red button. That is a 180F safety cut off. If it cuts off - it requires manual reset. Since it's not normally switching it doesn't wear out either. Good safety. And still it's tripped for me too - like when I was too clever and added a 7W "always on inspection light" that - very slowly - got the temps high and the PID controller wasn't in that loop . Look for all traps! So relay or SSR - anything with heat add something with a manual reset hard cutoff. If you want - put a very low wattage bulb in parallel with it and it'll be your "oh-crap" indicator

Good work - and keep it up. At this point I'll probably end up using 80-90% of your work.


----------



## AdvancedNewbie (May 2, 2012)

Glad you like you the work so far. I haven't had much time to work on it lately, but hopefully I'll update it again here this week. There's a few little bugs I squashed already, but not much for a new release. So maybe the weekend?

Cheers.


----------



## AdvancedNewbie (May 4, 2012)

*Alpha 10 up*
- Load all Email Settings, Devices, SetPoints, Timers
- Diagnostic Analog Values Fixed


----------



## AdvancedNewbie (May 5, 2012)

*Alpha 11 up*
- Auto Load Settings fixes some issues.
- Fixed Status Labels
- Minor changes


----------



## psari (May 6, 2012)

Still following. Been looking through my stuff for some electrostatic mass flow meters and pressure gates I've used for controls to see what I might do here. Worse case its inspiring me that all those things that had to be checked from simple serial daisy chains of past can now be sent to a phone etc. Thankfully its simple serial outs of the couple that have the ability. 

Course I need to find the time as well ...

Cheers.


----------



## torrezzz (May 6, 2012)

Great work! Your project finally pushed me over the edge. I've been wanting to experiment with room automation using arduino for awhile, just started ordering parts. Awesome job, keep it up!


----------



## AdvancedNewbie (May 6, 2012)

Thanks for the support guys... It seems to be coming along pretty good.

*Alpha 12 up
-* Can Load / Save Settings
- Fixed 'second' timers


----------



## AdvancedNewbie (May 6, 2012)

psari said:


> Course I need to find the time as well ...


True 'dat'


----------



## banditos701 (May 6, 2012)

Dude this is amazing, will read the whole post !


----------



## Bob Smith (May 6, 2012)

Great thread man, really selfless stuff you're doing for others - great karma to you, friend


----------



## Slixxor (May 6, 2012)

Interesting, I'm using an arduino ethermega board myself and bought some 2.4ghz transceiver modules, real time clock module, a ph sensor and some opamps to increase the ph sensors v range. My biggest debacle is getting auto mixers / pumps to do the auto mixing job. I figure I will keep it purely diagnostic except for the light schedules. Not sure about building in http firmware or not or do I keep it USB and let my vb.net app do all the work.


----------



## AdvancedNewbie (May 8, 2012)

I've coded up a web server that displays all the sensor values and can be ran on any port but have not added control buttons for the webpage yet. I understand your reasoning to keep the coded mostly on the arduino itself but I also like the fact of being able to do a little more with a PC... I might release that version sometime soon, but I have mostly coded the project during a break in my schedule and don't know if I'll have much time to update as often as I'd like. None the less, the project is in working condition; but you'll probably have to end up hacking the settings and lab databases in Access.


----------



## AdvancedNewbie (May 10, 2012)

*Alpha 13 up*
- Added a webserver that displays all sensor values.

Warning: Alpha 14 will include the ability to change the webserver options, but right now it is setup to automatically run upon starting the program on port 8091.

Too see your sensor values just goto: http://127.0.0.1:8091


----------



## highinatree (May 11, 2012)

This is awesome! I just got my first arduino and an ethernet shield this week. I can't wait to start playing.


----------



## AdvancedNewbie (May 11, 2012)

I also received an ethernet shield this week. lol Since the firmata source is made for serial communication I have yet to try and 'port' it for ethernet comm's. But I briefly looked through the ethernet library's available and they have similar commands. Should be fairly easy. Ordered up a mega too... $30, why not?


----------



## Bob Smith (May 11, 2012)

AdvancedNewbie, is there any possibility that a total programming idiot like myself could get anything out of this?

I write VBA pretty well for Excel and have some SQL experience, but the shit I read in this thread is so far over my head it's ridiculous.

Is there any way that you (or someone else, perhaps) could point a tard like me in the direction of what I would need to buy and what programs I would need to understand? Perhaps an "Arduino for Dummies" type book to get me up to speed?

Really interested in this technology and the ability to control my grow remotely but don't even know where to get started.


----------



## AdvancedNewbie (May 11, 2012)

Well, if you're not into editing code, the download includes the program itself so you can just run the program. As for the arduino; I'm not really sure... Sometimes I check youtube for anything similar to what I'm doing but it usually doesn't explain very well, but atleast it gives you ideas. There are other sites... But the arduino code is C++ and any book you find on C++ will basically be the same. C++ for dumimes is even a good start. As for Visual Basic, I would recommend downloading some simple programs off of www.planet-source-code.com or a similar site, but that VBA experience should help. I use Visual Studio 2010 to code, so a copy of that would help. As for programming the arduino, there's an programming environment on arduino's website you can download. Again, whenever I want to know something specific I just google it.

The arduino has Digital Pins which are like light switches, 'on' or 'off'. When they're on, the pin supplies 5V. With this 5V you can do anything from lighting up an LED to switching a 120V relay to blowing up fireworks.

The analog pins are like your inputs. A sensor usually has three wires and acts like a resisitor; varying the the amount of resistance changes the voltage. The three wires are ground, 5V and then the output which would go to an analog pin. The analog pin reads the voltage 0V to 5V and this varying voltage corresponds to a sensor value which could be something like "530" when it's 3V (don't know for sure). Since sometimes, say, a temperature sensor might return 2V when it's 70 degrees, and 4V when it's 90 degrees (and all variances in between). That is why a calculation is required to convert the raw analog signal values into something usable like a temperature read-out. This is basically what my program does, then does operations based on the post-calculated value. So "If the Temperature Sensor value goes over 82 then switch digital pin 1" (which is hooked up to a 120V relay, which is hooked up to an 120V outlet, which a fan is plugged into) or whatever you want really. 

This is just a crude explanation; but I hope it gets you started.


----------



## highinatree (May 11, 2012)

AdvanacedNewbie, Great explanation! I'm certainly a newbie at this level of diy electronics, but not to hardware design. I have 23 years experience laying out circuit boards. My electrical engineering resources are endless. 

I'm certain I'll refer to your work from the start. Thanks for sharing your experience and knowledge with us all. 

Regards


----------



## AdvancedNewbie (May 11, 2012)

Reading a message like that never gets old... It's no problem. I'm glad I can help.  I just can't believe a simple environment controller costs over $800. Especially when you can build one with more features for ~$120. Thanks for the support guys - its what keeps a project going.


----------



## AdvancedNewbie (May 12, 2012)

Yeah, yeah, I didn't turn my lights my off and some are blurry.



22 Days = 3.142857142857143 weeks in!


----------



## psari (May 12, 2012)

AdvancedNewbie said:


> 22 Days = 3.142857142857143 weeks in!


Darnit, now I'm hungry for pastries.


----------



## AdvancedNewbie (May 12, 2012)

That reminds me of Brian Regan when he talks about moving to New York, or Boston, or somewhere like that and his room mate asks if he wants to go "halfers on a pie" and he has no idea what he's talking about and they end up with a half Hawaiian half baked apple


----------



## Airheadnobody (May 14, 2012)

man I could really use some pointers from u using visual studio and usb serial to my uno r3


----------



## AdvancedNewbie (May 14, 2012)

Maybe this weekend I'll make a video or something showing you my screen and walking though step by step... I think it might help more people get started.


----------



## AdvancedNewbie (May 16, 2012)

Got my mega 2560 and 16x2 LCD screen. $35 and now I have 15 analog inputs (for sensors) and 53 digital outputs... Damn this thing is a beast.


----------



## NewGrower2011 (May 16, 2012)

Another fellow .NET developer here... never done much hardware integration other than a serial thing years ago... Will be watching...


----------



## AdvancedNewbie (May 18, 2012)

*Alpha 14 up*
- Lots of fixes
- Scrapped the webserver idea; now the program exports all the sensor values to an HTML file which can be hosted by something secure like Apache
- Optimized the GUI for use on a tablet pc as a touchscreen interface

Download here: http://sourceforge.net/projects/arduinovblab/


----------



## AdvancedNewbie (May 19, 2012)

*For everybody that's not a programmer: I've uploaded a simple setup program so anybody can try it now. It includes all the dependencies of the program, in case you were getting errors before.*


----------



## CaliCaretaker (May 19, 2012)

this is awesome, i've never seen anything like it.

has anyone ever tried this with a soil grow that you know of?


----------



## AdvancedNewbie (May 19, 2012)

CaliCaretaker said:


> this is awesome, i've never seen anything like it.
> 
> has anyone ever tried this with a soil grow that you know of?


Not that I know of, the project start date was 4-18, so it hasn't exactly been out that long. 

This current version seems to be much more stable. I'm going to work on the range of the graphs so you can set a duration (last 24 hours, last 12 hours, last hour, last 10 minutes, etc...) I noticed the memory the program's using slowly increases over time; this is because the graphs don't discard any data and the data refreshes as fast as your computer can loop the update command and as fast as the arduino can send back a response (which happens pretty fast). My plan is to log the data on the harddrive at some interval, say once every 10 seconds (changeable), and discard the information in the graphs to free up system memory. This will also serve as a backlog of your data - that's when it gets really interesting, because then you have some sort of 'scientific' data that you can compare you changes to the 'system' for optimal tweaking and yields! Woo!

Edit: *Make sure you run the program as administrator - this will allow the program to update the Values.html file from within the Program Files directory.*


----------



## Airheadnobody (May 21, 2012)

AdvancedNewbie said:


> Not that I know of, the project start date was 4-18, so it hasn't exactly been out that long.
> 
> This current version seems to be much more stable. I'm going to work on the range of the graphs so you can set a duration (last 24 hours, last 12 hours, last hour, last 10 minutes, etc...) I noticed the memory the program's using slowly increases over time; this is because the graphs don't discard any data and the data refreshes as fast as your computer can loop the update command and as fast as the arduino can send back a response (which happens pretty fast). My plan is to log the data on the harddrive at some interval, say once every 10 seconds (changeable), and discard the information in the graphs to free up system memory. This will also serve as a backlog of your data - that's when it gets really interesting, because then you have some sort of 'scientific' data that you can compare you changes to the 'system' for optimal tweaking and yields! Woo!
> 
> Edit: *Make sure you run the program as administrator - this will allow the program to update the Values.html file from within the Program Files directory.*


wow man im really impressed cant wait to try it and im blown away by the specs of your mega2560 lol whered you get that beast and for only $35!?

JUST DOWNLOADED AND RAN UPDATED PROGRAM LOOKS AND RUNS GOOD SO FAR BUT BARELY BRUSHED THE SURFACE FOR NOW BTW I FIGURE ITS JUST A CERTIFICATE THING BUT HAVE YOU GUYS SEEN THIS...
 HAPPENED UPON RUN AFTER DL.


----------



## AdvancedNewbie (May 22, 2012)

Airheadnobody said:


> wow man im really impressed cant wait to try it and im blown away by the specs of your mega2560 lol whered you get that beast and for only $35!?
> 
> JUST DOWNLOADED AND RAN UPDATED PROGRAM LOOKS AND RUNS GOOD SO FAR BUT BARELY BRUSHED THE SURFACE FOR NOW BTW I FIGURE ITS JUST A CERTIFICATE THING BUT HAVE YOU GUYS SEEN THIS...
> View attachment 2178880 HAPPENED UPON RUN AFTER DL.


Thank you for this; feedback always helps to make a better program - and screenshots are even better . I guess I'll have to add that as a dependency for the next installer. That error probably means the program isn't reading the databases at all and you'll have issues... I'll fix it this weekend. 

The mega was found on eBay ---> "*bryl_tech*" was the store.


----------



## FAT QK (May 23, 2012)

ok, so I'm starting out on this, is there some kind of tutorial u can make for the rest of the noobs out there? thnx man  . ps hope I'm not asking 4 much! kiss-ass


----------



## AdvancedNewbie (May 23, 2012)

I have a busy week ahead, but I'll try my best... I will definitely try to update those dependencies this weekend though.


----------



## AdvancedNewbie (May 23, 2012)

Airheadnobody, do you get that message on every startup? I'm guessing you're running a 64-bit machine. Please let me know - thanks.

EDIT: I have uploaded this installer as a *potential *fix: <removed>

Please let me know if this fixes your issue, then I will make this the default download. You're going to have to uninstall then reinstall. If you could let me know it would be much appreciated - thanks.

EDIT: *Tried it on my 64-bit laptop; same error message so I took the install down.*


----------



## Airheadnobody (May 26, 2012)

yeah the one i have has error everytime but i havent downloaded the new one yet...
but it seems to run fine i just havent tryed to use it...


----------



## requiemflow (May 26, 2012)

This is ur first real post


----------



## requiemflow (May 26, 2012)

This is ur first real post


----------



## AdvancedNewbie (May 27, 2012)

requiemflow said:


> This is ur first real post



If you're talking to me...? then I'm assuming you say that because there's an installer for this one?


----------



## Airheadnobody (May 29, 2012)

AdvancedNewbie said:


> If you're talking to me...? then I'm assuming you say that because there's an installer for this one?


looks like spam to me bra lol anyway did you ever figure out the problem??? I keep watching your thread but no news and ive been working on mine but havent uploaded any new info. I found a power wheels jeep and im attaching it soon... let me know whats goin on...


----------



## Skutch (May 29, 2012)

Hi,
I've been "playing" with an arduino for a while, grow on soil and am building a hobby related data-logger.

Project is far from ready, I'd guess a zillion sub-projects are possible, emphasis (for me...) should be reliability. I wouldn't want a light/pump to stay on since my program got stuck in an unforeseen loop. So far I store soil-wetness, humidity and temperature at regular intervals to SD and/or serial port. I've programmed a daily timer for the 5 pins I had left to operate relays.

Anyway, I have only glanced at the firmata examples of arduino and processing (IDE similar to arduino for PC) and still know little about firmata, I'm also more an electronics kind of guy as PC-programmer. One thing I do wonder about is setting up an arduino as intelligent firmata-device.

Correct me if I'm wrong, as far as I understand one now uses the PC to read sensors/control devices with firmata. Should the PC, for whatever reason, stop sending firmata-info, the arduino's silent as well ? The firmata-code on the arduino isn't that big and I wondered whether you've thought of writing/merging autonomous code for the arduino as well. For example to read an real time clock-chip and still be able to switch lights/pumps on/off should the PC not respond.

I like what you're doing with your project, personally I wouldn't mind using the PC as little as possible though. It's a great tool, but it uses a lot of energy I'd rather invest in a clones-/seedlings-box. I've also seen a few BSODs too many to think of a pc as reliable. 

By the way, has anyone seen http://www.420magazine.com/forums/do-yourself/153079-arduino-based-room-controller.html, it's a different approach, also not completely ready yet, but quite interesting.


----------



## AdvancedNewbie (May 29, 2012)

Yes, I have thought about this and eventually I would like the program to be more or less a settings changer for the arduino. The program would have the same interface, but instead of doing the 'thinking' the AI will be left to the arduino. I was thinking of scrapping the whole project and making it completely arduino-based with a LCD - screen for options, etc... But I guess you could say I'm in the same "mood" as you... I think I'd like to control fans, nute mixing, etc... (and data logging and remote monitoring), but I think I'm going to leave my lights and pumps on the good ol' trusty mechanical timers. I think I was going a little over board with trying to make this so universal that I forgot the fact that a good system usually is comprised of sub-systems that do ONE thing and do that ONE thing PERFECT everytime. The arduino should be able to handle the lights n' things - but simple is better and find the mechanical timers very simple and, given my current grow, have proven themselves. But I think I'll do more complex things like nutrient mixing with the arduino but I'd still like to be able to change the settings via PC for the nute mixing, intake/extra exhaust fans (would keep the carbon filter fan plugged in at all times - no arduino), AC Control, Humidity Control, etc

I've been so busy and feel bad for letting this project down really, but I think you're right about keeping the code on the arduino. I can imagine if Windows went to sleep or 'windozed' off. The whole grow would be crap.

So for now, it's going to have to wait; but I will be working on it when I get the time - data logging, remote monitoring via PC or Smartphone, settings change via PC.

Edit: I would think that having a button to have to manually start the auto-nute mixing would be good too... I don't really want to have it mixing unless I'm observing.

Edit2: I think I'm going to scrap firmata too and program the communications myself - especially if I'm going to be changing the settings remotely - firmata doesn't do that sort of thing


----------



## AdvancedNewbie (May 29, 2012)

Skutch;

I'd probably stay away from "processing apps" like your friend their has suggested for use on the PC. Do you have any code right now? I'd love to hack away at it and make a nice 'historical' type datalog interface. I think that's all this project is really lacking. I'm really feeling bummed out about scrapping everything - but it's time for some Spring cleaning I think. Everything must be kept simple and clean.

May the most simple and effective tools win!


----------



## Afistakis (May 29, 2012)

Please don't give up yet! I have all my arduino mega gear already on the way in the mail. I have been salivating since you started this project. I joined here just so that I could lurk and follow this thread! I played with arduino quite some time ago in college and recently with quadcopters. I am most interested in the data logging and remote monitoring. I appreciate the work you have already done and it seems that it is only a few tweaks away from being reliable and operational. Monitoring/logging vital information, even with mechanical timers for everything, will give me a much greater sense of security while away. 

I can control my multiwii arduino flight controller with my phone to read and upload new settings over bluetooth with an app. Something stand alone like that would be legit even using wireless with a computer while keeping processing on board. 

I am excited to play with this next week when my stuff finally makes it here, if I am to trust the Chinese shipping companies. 

Thanks for the hard work and initiative!


----------



## AdvancedNewbie (May 29, 2012)

I'm not giving up yet, lol... But yes, processing must be done on the board. I might be able to tweak the arduino code a bit and still use some of the code from the VB.NET app - so it's not a complete loss. I can't wait to see what my mega can do. It would be nice to have something similar to an iPonic in the end.


----------



## Afistakis (May 29, 2012)

AdvancedNewbie said:


> I'm not giving up yet, lol... But yes, processing must be done on the board. I might be able to tweak the arduino code a bit and still use some of the code from the VB.NET app - so it's not a complete loss. I can't wait to see what my mega can do. It would be nice to have something similar to an iPonic in the end.


I think that the IPonic is an over glorified home thermostat and $1200 seems a little spendy. I think that there is much more room for customization and control vs their hard wiring on the board and limited power control. The only nice piece of candy is the nice interface but there are many options including cheap older tablets for remote control. I was thinking about grabbing this but I have no idea how to create or interface the gui. It looks pretty though. Using something commercial for cabling and slapping it in a nice box will accomplish the same for much less. 

iPonic 600 IncludesRemote Combination Sensor
 CO2
 Temperature
 Humidity
 Light

The manual shows it only controlling outlet plugs. It mentions CO2 but I don't see any tds, ph, or submersible temp probes. What you have started looks much more capable to me.


----------



## AdvancedNewbie (May 29, 2012)

Oh for sure, we can make it better... Customizable. I don't have much experience with those touch screens but from what I've seen the functions for drawing 'buttons', shapes, text, etc... are pretty limited. You could save the screens as an image and basically create a hotspot (if x and y coordinates of your 'touch' are within the boundaries of a rectangle shape (ie. button) then you clicked that button). I see this as being a pain, unless there are some libraries on that stuff... Somebody has to have made it easy. But I'm pretty sure you'll have to end up saving the images on a sd card, or draw each page using shapes and text. I don't think I'm going to go there too soon, but it is definitely something to think about. I've seen those too - always wanted to mess around with them.

Edit: Just noticed the library on that page... Hmm... SD card slot too... Hmm. 

Edit 2: Check this out... Has an overview of the functions in the library.

Edit 3: Heeeeeere we go. http://www.henningkarlsen.com/electronics/library.php?id=51

Edit 4: http://www.youtube.com/watch?v=rn0abZE5YzA&feature=endscreen
 
Edit 5: Ahh, what the hell I'll buy one... lol


----------



## AdvancedNewbie (May 29, 2012)

Okay, so this is what I ordered:

http://www.ebay.ca/itm/270939250820

And this is what the size should be - approximately (calculated dimensions using pixel ratio):



4.3 Inch TFT SSD1963 - Compatible with that library (Edit 3)^^


----------



## Afistakis (May 29, 2012)

I just found this. I am not sure how different beside the price and snazzy video. It looks very similar. It looks like he is just playing with the pre loaded gpu code. I will order something like this or that to play with after I get a data logging tri meter setup. GLB isn't fast on shipping unless you pay for the expedite. I think the ship with tracking is a waste of $1.70. I have gotten stuff before I got tracking information! I'm okay with slow if it's cheap though.


----------



## Skutch (May 30, 2012)

AdvancedNewbie said:


> Skutch;
> 
> I'd probably stay away from "processing apps" like your friend their has suggested for use on the PC. Do you have any code right now? I'd love to hack away at it and make a nice 'historical' type datalog interface. I think that's all this project is really lacking. I'm really feeling bummed out about scrapping everything - but it's time for some Spring cleaning I think. Everything must be kept simple and clean.
> 
> May the most simple and effective tools win!


Remember I've been programming in Basic far too long and hardly had any education in C(++), I hope it's readable without getting a headache 
Sofar it works on arduino uno- and the latest 0022-IDE, but I'm still far from satisfied. I'm using an Nano by the way for this project.

I'm using gypsum soil sensors now (cheap&easy) that I'd rather replace with capacitive ones since those won't interact with the soil on a chemical or electrical basis.
The only thing controllable by PC now is setting the time of the RTC-clock, it is possible to change the
device timers (in EEPROM), but you'll have to do it in code.

Reading the ds18b20 sensors (wich are quite accurate), but still gives me a problem I haven't addressed yet. To read 'm you first have to command 'm a new readingcycle has started, wait ages (well... 750mS), and command them to send the data. I still have to seperate those two which would give me the opportunity to do most other stuff in those 750 mS.

Data is stored on SD in a map called logs. Create it on SD before running the program. Every day a new file name is chosen based on year,month,day.
Once every minute the arduino shows the filenames in that map plus the amount of space (days) left on the SD to serial port.
The sampling rate is quite high, about once a second, resulting in about a one year capacity using a 2 GB SD.
One thing I noticed was that I still didn't change the routine named tos() which checks wheter it's time to change the filename to a new date.Name of subroutine is lame.

All data spewed is in CSV-format, Comma Separated Volume, but I still haven't written a PC-program to analyze the data. 

Unfortunately it also uses a lot of programming space, probably because I've used quite a number of libraries. It probably is possible to shrink those since I only use parts of their functions. With an arduino uno one would have 1.5 KB extra room, but I wouldn't mind migrating this project to a 64KB controller to have some more space for future implications.
I unfortunately don't know how it will operate on a MEGA-board, I'd guess one will have to change the pins for SD and analog readings. 

It tries to log with a resolution of once a second, far more as needed in a 'slow' project like this, but depending on the speed of the SD, it may skip a second every now and then.


A lot of the functions written are unfortunately not the best/easiest/fastest, remember I'm still busy learning C++.

Anyway, good luck untangling my spaghetti 
I'm not a licensing kind of guy, so, feel free to use it any way you like.

P.s. I'll try to make an electronic schematic although I unfortunately can't see which components are used on the Ebay SD module.


```
/*
Growroom logger/ device timer.
 Logs humidity, temperature and soilmoisture.
 Daily timer for 5 devices included
 
 Pins used  
 0-1       Serial port
 2,3,5,7,9 individual timer switches
 4         DHT humidity sensor
 6         Onewire-bus 4 x ds18b20 attached
 8         pin for temporary powering gypsum soilsensors, temporary to prevent electrolysis
 10-13     SD card to log CSV-files
 A0-A3     Gypsum soil-wetness sensors  http://www.cheapvegetablegardener.com/2009/11/how-to-make-cheap-soil-moisture-sensor-2.html
 A4-A5     I2C bus
 
 */

#include <OneWire.h>             // OneWire library needed for DS18b20 sensor                  http://www.pjrc.com/teensy/td_libs_OneWire.html
#include <DallasTemperature.h>   // ds18b20 temperature sensor library                         http://milesburton.com/index.php?title=Dallas_Temperature_Control_Library
#include <DHT.h>                 // DHT library for  DHT11, DHT21 and DHT22                    https://github.com/adafruit/DHT-sensor-library 
#include <Wire.h>                // I2C library                                                Standard arduino library
#include <Time.h>                // Time library                                               http://www.arduino.cc/playground/uploads/Code/Time.zip
#include <DS1307RTC.h>           // a basic DS1307 library that returns time as Unix epoch     http://www.arduino.cc/playground/uploads/Code/Time.zip
#include <EEPROM.h>              // EEPROM library to support timer switch configuration       Standard arduino library
#include <SdFat.h>               // SDfat is used to read/write SD files                       http://code.google.com/p/sdfatlib/downloads/detail?name=sdfatlib20111205.zip&can=2&q=
#include <SdFatUtil.h>           // SD tools library                                           http://code.google.com/p/sdfatlib/downloads/detail?name=sdfatlib20111205.zip&can=2&q=

#define TIME_MSG_LEN  11         // time sync to PC is HEADER followed by unix time_t as ten ascii digits
#define TIME_HEADER  'T'         // Header tag for serial time sync message
#define DHTPIN 4                 // Data pin DHT 11 humidity sensor
#define ONE_WIRE_BUS 6           // data pin 1-wire bus
#define TEMPERATURE_PRECISION 12 // temperature sensor resolution 9-12 bits

// Uncomment whatever type you're using!
#define DHTTYPE DHT11          // DHT 11 
//#define DHTTYPE DHT22          // DHT 22  (AM2302)
//#define DHTTYPE DHT21          // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);        // name library

const int chipSelect = 10;       // SPI SS pin for SD
Sd2Card card;                    // needed to read size SD and space free
SdVolume vol;                    // needed to read size SD and space free
SdFat sd;                        // 
SdFile myFile;                   //

OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
DeviceAddress t0, t1, t2, t3;

byte Debug = 0;                  // Used to display (1) msgs, or not (0) while developing
long tooktime;
float dhtdat;                    //Array to hold humidity data. DHT11
int save = 1;                    // store readings to disk 1/0
int show = 1;                    // send  readings to serial port 
int soilWetness[4];              // Array to store soil wetness results
byte deviceStatus[5];
unsigned long lastnow;           // las noted value (second)  of now()- function 
int currentminute;               // closes/opens file for writing every minute
float w[5];                      // Temperature Array
char name[] = "01234567.CSV";    // variable used to store date based filename
int oh;                          // last detected hour
unsigned long deviceonAt[6], deviceoffAt[6]; // array for devicetimers 
int devicePin[6]= {
  0,2,3,5,7,9};   // pins used by daily timers

void writeconfig(void){
  //  === Timer for 1st device
  EEPROM.write(0,22); // device on at  Hour
  EEPROM.write(1,0);  //               Minute
  EEPROM.write(2,0);  //               Second
  EEPROM.write(3,21); // device off at Hour 
  EEPROM.write(4,0);  //               Minute
  EEPROM.write(5,0);  //               Second

  //  === Timer for 2nd device (Explantion as timer for first device)
  EEPROM.write(6,15); 
  EEPROM.write(7,0); 
  EEPROM.write(8,0); 
  EEPROM.write(9,22);
  EEPROM.write(10,0); 
  EEPROM.write(11,0);

  //  === Timer for 3rd device (Explantion as timer for first device)
  EEPROM.write(12,23); 
  EEPROM.write(13,30);  
  EEPROM.write(14,2);  
  EEPROM.write(15,7); 
  EEPROM.write(16,30); 
  EEPROM.write(17,00); 

  //  === Timer for 4th device (Explantion as timer for first device)
  EEPROM.write(18,3); 
  EEPROM.write(19,0);
  EEPROM.write(20,0);
  EEPROM.write(21,16);
  EEPROM.write(22,0); 
  EEPROM.write(23,0);

  //  === Timer for 5th device (Explantion as timer for first device)
  EEPROM.write(24,22); 
  EEPROM.write(25,0);  
  EEPROM.write(26,0);  
  EEPROM.write(27,23); 
  EEPROM.write(28,0); 
  EEPROM.write(29,0); 

  
}


void setup(void)
{
  tooktime = micros(); // Debug variable to measure time
  pinMode(8, OUTPUT); // configure moisture sensor "ON" pin
  digitalWrite (8,LOW);// and pull low to prevent electrolyzing effects
  dht.begin(); // start DHT humidity sensor
  Serial.begin(115200);  // start serial port
  sensors.begin(); // onewire ds18b20 start
  setres();        // onewire ds18b20 set resolution
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet) Serial.println("RTC Error, clock not set");      
  if (!sensors.getAddress(t0, 0)) Serial.println("Error DS18B20 1"); 
  if (!sensors.getAddress(t1, 1)) Serial.println("Error DS18B20 2"); 
  if (!sensors.getAddress(t2, 2)) Serial.println("Error DS18B20 3"); 
  if (!sensors.getAddress(t3, 3)) Serial.println("Error DS18B20 4"); 
  if (save==1){
    if (!sd.init(SPI_FULL_SPEED, chipSelect)) sd.initErrorHalt();
    sd.chdir("/logs");
    tos();
    if (!myFile.open(name, O_RDWR | O_CREAT | O_AT_END)) {
      sd.errorHalt("opening logfile failed.");
    }
  }
  writeconfig(); // write device timer configuration
  readconfig(); //   read   "      "         "  

  if (Debug){
    Serial.print ("Setup took ");
    Serial.print (micros()-tooktime);
    Serial.println (" Micro - seconds.");
  }

}

void loop(void){ 
  Tupdate();                    // check for external rtc update (T + 10 digit Unix epoch at serial port)
  if (lastnow != now()){        // performs action needed every second
    lastnow = now();            // log last detected second
    if (oh != hour()) tos();    // change date based filename to new date if needed.
    readsensors();              // reads all available sensors
    DataDump();                 // Dumps sensorinfo to SD/serial port
    chk_devicetimer();          // Turns timer-devices on/off when needed.
  }
}

time_t processSyncMessage() {
  // return the time if a valid sync message is received on the serial port.
  while(Serial.available() >=  TIME_MSG_LEN ){  // time message consists of a header and ten ascii digits
    char c = Serial.read() ; 
    Serial.print(c);  
    if( c == TIME_HEADER ) {       
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){   
        c = Serial.read();          
        if( c >= '0' && c <= '9'){   
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number    
        }
      }   
      return pctime; 
    }  
  }
  return 0;
}




void setres(){
  // Sets resolution of ds18b20 temperature sensors
  sensors.setResolution(t0, TEMPERATURE_PRECISION);
  sensors.setResolution(t1, TEMPERATURE_PRECISION);
  sensors.setResolution(t2, TEMPERATURE_PRECISION);
  sensors.setResolution(t3, TEMPERATURE_PRECISION);
}  




void Tstamp(){
  if (! myFile.timestamp(T_CREATE,year(),month(),day(),hour(),  minute(),second())) {
    Serial.println("SD create time error");
  }
  // set write/modification date time
  if (!myFile.timestamp(T_WRITE,year(),month(),day(),hour(),minute(),second())) {
    Serial.println("SD write time error");
  }
  // set access date
  if (!myFile.timestamp(T_ACCESS,year(),month(),day(),hour(),minute(),second())) {
    Serial.println("SD access time error");
  }
}

void readTemp(void){
  // Read temperature from 1-wire DS18B20 sensors
  sensors.requestTemperatures(); // Send the command to get temperatures
  w[0] = sensors.getTempC(t0);// and retrieve them
  w[1] = sensors.getTempC(t1);
  w[2] = sensors.getTempC(t2);
  w[3] = sensors.getTempC(t3);
}

void Tupdate(void){
  if(Serial.available()){
    time_t t = processSyncMessage();
    if(t >0){
      RTC.set(t);   // set the RTC and the system time to the received value
      setTime(t);          
    }
  }
}

void DataDump(void){
  // fileWrite, logs time and last sensordata to current logfile.
  if(save){
    chkMinute();
    myFile.print(lastnow);
    myFile.print(",");
    myFile.print(w[0]);
    myFile.print(",");
    myFile.print(w[1]);
    myFile.print(",");
    myFile.print(w[2]);
    myFile.print(",");
    myFile.print(w[3]);
    myFile.print(",");
    myFile.print(dhtdat);
    myFile.print(",");
    myFile.print(soilWetness[0]);
    myFile.print(",");
    myFile.print(soilWetness[1]);
    myFile.print(",");
    myFile.print(soilWetness[2]);
    myFile.print(",");
    myFile.print(soilWetness[3]);
    myFile.print(",");
    myFile.print(deviceStatus[0]);
    myFile.print(",");
    myFile.print(deviceStatus[1]);
    myFile.print(",");
    myFile.print(deviceStatus[2]);
    myFile.print(",");
    myFile.print(deviceStatus[3]);
    myFile.print(",");
    myFile.println(deviceStatus[4]);

  }
  if (show){
    // serial portWrite, logs time and last sensordata to serial port. 
    Serial.print(lastnow);
    Serial.print(",");
    Serial.print(w[0]);
    Serial.print(",");
    Serial.print(w[1]);
    Serial.print(",");
    Serial.print(w[2]);
    Serial.print(",");
    Serial.print(w[3]);
    Serial.print(",");
    Serial.print(dhtdat);
    Serial.print(",");
    Serial.print(soilWetness[0]);
    Serial.print(",");
    Serial.print(soilWetness[1]);
    Serial.print(",");
    Serial.print(soilWetness[2]);
    Serial.print(",");
    Serial.print(soilWetness[3]);
    Serial.print(",");
    Serial.print(deviceStatus[0]);
    Serial.print(",");
    Serial.print(deviceStatus[1]);
    Serial.print(",");
    Serial.print(deviceStatus[2]);
    Serial.print(",");
    Serial.print(deviceStatus[3]);
    Serial.print(",");
    Serial.println(deviceStatus[4]);

  }
}

char tos(void){
  // Creates CSV logfile name based on date/time
  // 
  // 20121110.CSV
  // ||||----- century (20)12
  //     ||--- Month 11, november
  //       ||- Day 10
  int rest;
  int mo1;
  int mo2;
  int d1;
  int d2;
  int millenium = (year()/1000);
  rest = year()-(millenium*1000);
  int century = rest/100;
  rest = rest - (century*100);
  int decade = rest/10;
  rest = rest -(decade *10);
  mo1 = (month()/ 10);
  mo2 = month()- (mo1 *10);
  d1 = day()/10;
  d2 = day() - (d1 *10);
  oh = hour();
  name[0] = char(50);        // millenium (2)
  name[1] = char(48);        // century   (0)
  name[2] = char(decade+48); // decade
  name[3] = char(rest+48);   // year
  name[4] = char(mo1+48);    // first digit month
  name[5] = char(mo2+48);    // last    ''    ''
  name[6] = char(d1+48);     // first digit days
  name[7] = char(d2+48);     // last    ''   ''
}

void chkMinute(){
  // Close and open file once a minute
  if (save==1){
    if (currentminute != minute()){
      currentminute = minute();
      Tstamp();// update date filestamp
      myFile.close();
      tos();// check if new hourly filename is needed
      if (!myFile.open(name, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      InfoSD();

    }
  }
}

void CHKearth(){
  // check gypsum sensors
  // Apply 5 volts to gypsym sensor/resistor voltage divider. Apply as short as possible to prevent electrolysis.

  digitalWrite (8,HIGH);
  delayMicroseconds(150);
  soilWetness[0]=analogRead(A0);
  delayMicroseconds(150);
  soilWetness[1]=analogRead(A1);
  delayMicroseconds(150);
  soilWetness[2]=analogRead(A2);
  delayMicroseconds(150);
  soilWetness[3]=analogRead(A3);
  digitalWrite (8,LOW);
}

void chk_devicetimer(void){
  for (int x = 1; x < 6; x++){
    deviceStatus[x-1] = lightcheck(x);
    digitalWrite(devicePin[x],deviceStatus[x-1]);
  } 
}

int lightcheck(int devicenr){
  int result; // result variable
  unsigned long tc = (hour()*3600)+(minute()*60)+second();// calculate current minute
  if (deviceonAt[devicenr] > deviceoffAt[devicenr]){ // starts late, stops earlier the following day
    if (tc >= deviceoffAt[devicenr] && tc <deviceonAt[devicenr]) result = 0;
    if (tc < deviceoffAt[devicenr] || tc >=deviceonAt[devicenr]) result = 1; 
  }
  if (deviceonAt[devicenr] < deviceoffAt[devicenr]){ //Starts early, stops later same day
    if (tc >= deviceoffAt[devicenr] || tc < deviceonAt[devicenr]) result = 0;
    if (tc >= deviceonAt[devicenr] && tc < deviceoffAt[devicenr]) result = 1;
  }
  return result;
}

void readconfig(void){
  // Read Configuration of growroom controller

  //==========================================
  // Read settings Growroom controller
  // deviceonAt, deviceoffAt, daily timersettings 
  deviceonAt[1] = (EEPROM.read(0)*3600)+(EEPROM.read(1)*60)+EEPROM.read(2);
  deviceoffAt[1] = (EEPROM.read(3)*3600)+(EEPROM.read(4)*60)+EEPROM.read(5);
  deviceonAt[2] = (EEPROM.read(6)*3600)+(EEPROM.read(7)*60)+EEPROM.read(8);
  deviceoffAt[2] = (EEPROM.read(9)*3600)+(EEPROM.read(10)*60)+EEPROM.read(11);
  deviceonAt[3] = (EEPROM.read(12)*3600)+(EEPROM.read(13)*60)+EEPROM.read(14);
  deviceoffAt[3] = (EEPROM.read(15)*3600)+(EEPROM.read(16)*60)+EEPROM.read(17);
  deviceonAt[4] = (EEPROM.read(18)*3600)+(EEPROM.read(19)*60)+EEPROM.read(20);
  deviceoffAt[4] = (EEPROM.read(21)*3600)+(EEPROM.read(22)*60)+EEPROM.read(23);
  deviceonAt[5] = (EEPROM.read(24)*3600)+(EEPROM.read(25)*60)+EEPROM.read(26);
  deviceoffAt[5] = (EEPROM.read(27)*3600)+(EEPROM.read(28)*60)+EEPROM.read(29);

}

void InfoSD(void) {
  // list logfiles available on diskfile date and size
  Serial.println("Logs Found, Size in bytes :");
  Serial.println("===========================");
  sd.chdir("/logs");
  sd.ls(LS_DATE | LS_SIZE);
  if (!card.init(SPI_FULL_SPEED, chipSelect)) {
    //sdErrorMsg("\ncard.init failed");
    return;
  }
  if (!vol.init(&card)) {
    // sdErrorMsg("\nvol.init failed");
    return;
  }
  int bpc = int(vol.blocksPerCluster());
  long DS= (vol.clusterCount()*int(vol.blocksPerCluster()))/2 ;
  long DF= (vol.freeClusterCount()*int(vol.blocksPerCluster()))/2 ;
  Serial.print("=== Disksize : ");
  Serial.print(DS/1024);
  Serial.print(" MB, ");
  Serial.print(DF/1024);
  Serial.print(" MB Free, still room for about ");
  Serial.print (DF/5540);
  Serial.println(" days");
}

void readsensors(void){
  tooktime = micros(); 
  readTemp();                                   // read all ds18b20s temperature sensors
  if (Debug){
    Serial.print ("ds18b20 sensors took ");
    Serial.print (micros()-tooktime);
    Serial.println (" Micro - seconds.");
  }
  tooktime = micros(); 

  dhtdat = dht.readHumidity();                  // read dht air humidity sensor
  if (isnan(dhtdat)) {                          // Error from DHT
    Serial.println("Failed to read from DHT");
  } 
  if (Debug){
    Serial.print ("dht sensor took ");
    Serial.print (micros()-tooktime);
    Serial.println (" Micro - seconds.");
  }
  tooktime = micros(); 

  CHKearth();                                   // read moisture sensors earth
    if (Debug){
    Serial.print ("dht sensor took ");
    Serial.print (micros()-tooktime);
    Serial.println (" Micro - seconds.");
  }

}
```


----------



## Skutch (May 30, 2012)

Part 2 of the spaghetti, the schematics.


Unfortunately the image is resized by the forum, hope it's still readable.


----------



## AdvancedNewbie (May 30, 2012)

Looks like you're on the right track. I've got an ethernet shield too, so I think I'm going to use the SD card as a buffer, until the arduino can dump everything on the computer. I have those DHT11's too - haven't got to try them out yet, how are they working for you? Thanks for the schematics as well, as I haven't looked it up for those yet, but now I don't have to. What benefit are you getting from the DS1307 besides battery backup? Does the time library have problems?


----------



## jujubee (May 30, 2012)

AdvancedNewbie said:


> Got my mega 2560 and 16x2 LCD screen. $35 and now I have 15 analog inputs (for sensors) and 53 digital outputs... Damn this thing is a beast.


I got it for the 4 UARTs.

Cool project.


----------



## ommpCaregiver (May 30, 2012)

Awesome project. I worked on something similar : whttp://www.github.com/pleasuretek/opengreenhouse . and am currently working on the project with a beaglebone (embedded linux with database in the load center). I had a PC controlling my garden for quite some time, until the server one day just died on me (wont post, even after replacing CMOS battery). I think the environment of a greenhouse killed it ( I did not put the server in a box with HEPA filtration). 

Also I just sourced a good c02 sensor today from DCS (Digital Control Systems) (been looking at them for a while). Model number 305e. NDIR sensor with SPI and 5v power, for $103 a piece for 1-10 of them... It is the same sensor Green Air Products uses in their sensors (I have one taken apart on my office floor right now after bad customer support experience). 

In my personal project, I started to add an ethernet shield (with SD card for local logging of CSV file), but decided the linux stack of encryption, servers, databases, and variaty of languages would be a huge help. Also learning about the beaglebone has been a really fun learning experience. 

I feel this problem has been taken on by a few people already, and it is important for us to share info and all contribute to an open source controller/software stack. It could not only help us all grow better plants, as well as help to feed the world healthy food.

Here is a link to my current parts list (reworking the relay section for DIN mount relays instead of hockeypuck style): https://docs.google.com/spreadsheet/ccc?key=0AkU3fFID7_H5dEE4VldmZ0U0eEEyVXpKbXkyN0otNVE


----------



## ommpCaregiver (May 31, 2012)

Thought I would post some pics of the build I had working on arduino platform. There were 3 'high' power relays (only 25A 120v - not running ballasts) to control A/C and dehumidifier and fans, and three low power (relays are in the junction box the outlets are mounted in). The power line went straight to a 30A 120v breaker in the main load center. It worked great turning lights on and off on time, and keeping temps and humidity under control (and loging to database) until I woke up one morning and the server that was running the control software was dead. And the control software is written in C++ with Qt, so it will run native on Windows, MacOSX, and Linux (multi architechture as long as you have an abi for gcc to use, I have ran it on a beagleboard)

The relays in the last image are the typer I used to use. You can get them for cheap around town and they are very reliable (no moving parts like mechanical relays, opto-isolater + triac). The model numbers for the 25A versions are "Crydom d2425" or the USA manufactured "Opto22d 24od25", there are also 10A versions for lighter loads, however A/Cs and other big devices need bigger relays. I suggest using a power meter to test the actual load of each device (including spikes) to determine the proper size of relay.

I used Maxim DS18B20 (dallas one wire) temp sensors, and DHT11 temp and humidity sensor for sensors. I still use the DS18B20's as they work with the owfs for Linux, but the humidity sensor I have chosen to re-source for one with i2c or SPI so I don't have to write any drivers.


----------



## AdvancedNewbie (May 31, 2012)

I'm liking those relays, I'm going to add this one (in which I already bought) to my outlet box: http://www.idec.com/language/english/catalog/Relays/RSSSeries.pdf <--- 25A

There's a nice little example for the DHT11's here: http://www.ladyada.net/learn/sensors/dht.html

Includes a DHT library. Shows Humidity and Temp. But the DHT11 is only accurate within +/- 2.0 degrees - not the most accurate in world.

The owfs seems really smart, 'why not have you temperature sensor as part of your filesystem?' lol


----------



## ommpCaregiver (May 31, 2012)

Yeah the DHT-11 was working great on the arduino with that library. But that library is written for AVR micros, and taking that logic and implementing it as a linux kernel module is a little over my head. Also everything in linux is a file... so to read the temps from the DS18B20, you simply open a file for reading. This makes it easy to interface with w1(one-wire), i2c, and SPI devices through any language that can read or write files.

The version I am building right now is going to take 80A into a DIN mount distribution block, from there to DIN mount SSRs. The 5v power supply for the beagle bone is also DIN mount. It will keep the inside of the box much more organized as well as finger friendly (I almost lost a finger during this project, my multimeter probe tip touched the 30A rail (yes accidents happen) and caused a spark that could of melted my bone (I was safe), and damaged my first beagleboard and the multimeter).


I really like your software layout. Do you have any experience with coding in c++ or Python? How about GUI toolkits, any experience with Qt or GTK+ ? I started to code this projec in c++ with Qt but c++ gets a little wonky when you get deep into memory management (pointers, references, registers oh my), which is why I have chosen this time ( 5th times a charm right) to start writing the project in python. Right now it is a console program that puts sensor data into database, and makes decisions (turn on or off) based on the curves of the sample data. I am up in the air about which GUI toolkit to use, Qt I have 3+ years coding with ( meaning I know how deep the rabbit hole goes, and how bad nokia has mangled the libs), or GTK that has better support on a wider range of OSes... Also to note, the GUI is viewed with SSH X forwarding - running on beaglebone (armv7) showing GUI with 'native' look and feel on OSX, windows and Android (I dont know of an app that can display X on iPhone nor do I care, apple is evil (just like microshaft) and in 1000 years not a bit of OSX or Windows code will still be in use due to the proprietary closed source selfishness... Where Linux is a block in the great pyramid, the stairs to the stars, a stepping stone for us (as a race) to conquer the heavens by allowing all that inherit from earth to freely build upon it...). Once again I really like the layout and the logic you have created with your program, however IMO anything written in VB.NET has inherent security flaws... meaning if this device was on a network that was connected to the internet, If I so had some motivation, I could turn your lights on and off, causing hermies, meaning your crop isn't worth as much as mine now... That is just one use case of the problems inherited with using the microsoft stack ( more like weave there are so many holes and free space in inject subroutines ) - Also the beaglebone is running ARM instructions, the opcodes are way different so every scriptKiddie with a pile of x86 - IA64 shellcode wont be able to attack it ( of coarse if one can write ARM asm ( like for a RTOS) then one can craft ARM shellcodez, but those people generally have great jobs ). 

Ok Im stoned, rambling (I can ramble about security for probably about 29 years), and have to go to work. Really awesome project you have started, tonight I am going to have a look at teh codez, see If I can port the overall logic onto a markerboard, and see where this takes us (I bet its further


----------



## ommpCaregiver (May 31, 2012)

I like the SSR you posted a datasheet for, however, the beaglebone is a 3.3v device (out of the GPIO (like digital pin)). So I look for relays that can be switched with a minimum input load of 3v (that one is 4v) so that I don't have to use a logic level shifter. Also I use the crydom ones (they are 3v-32vdc) when i can find a cheap lot on ebay, but I like the opto22 brand since they are manufactured in USA, meaning some monkey around here is getting a paycheck from us using them, vs more of asia making the profit and buying up all the buildings downtown and owning most of our dept.

And that datasheet says DIN mount, but they are flat bottom hockey puck, you need an adapter (usually a heatsink) to actually mount them on the DIN rail. I have been spec'ing similar relays but the heatsink and DIN mount are all a part of the relay.

Also if you are controlling a semi high load ( like a 12A A/C ) make sure to test the temps of the relay (temp gun bottom metal heatsink plate), as you may need a heatsink to avoid setting your house on fire.

One more thing... If you need a parts list to build a MLC like lighting relay controller (with trigger chord to plug into our duino/beagle boxxes) I have a spreadsheet around for that too, as I build all my lighting relays myself these days (dpst no 30A relay in a junctionbox (all pats from grainger supply))


----------



## AdvancedNewbie (May 31, 2012)

Well thanks, I guess you could do a lot to make it safe; running in a Virtual Machine and keeping the network on a VPN, etc, etc.... Yeah, it has security flaws, but so does everything; I think SSHing might be in need here, but that's another topic, like you said _ could probably ramble on about security for 29 years. I do have some programing experience with C++ but it's always been on the microcontroller side and only console apps in windoze, never anything with a GUI... But as I understand it, you can use a designer to come up with the 'layout' code for you, and from there it should be similar to C++ console programming. Since I'm hopping over the fence here and am going to have the code primary on the microcontroller, I'm assuming that the PC code should be easy and straightforward. As it stands, my project is/was sort of setup to be able to do anything from brewing beer to growing weed to analyzing a gryo in an airplane... 

I think it's going a little over the top; my original idea: "Make a program that can analyze data from sensors and act on that data with 'on the fly' IF statements or Timers." (VB mindset)

New Idea: "Make a great Environment Controller that logs data that can be viewed remotely (even if it's in the next room) on a PC or smartphone for under $250." (C++ mindset)

But I have a little time this weekend (and right now) so I'm going to play with my mega and LCD screen and try and write a quick sketch. I think I'm going to try and make a historical style program in VB.NET too. I'm also going to go specific rather than broad this time, so no firmata... This should be easy - I might steal some firmata code though, they seem to know what they're doing.

I'm also interested in the calculus behind the data logging and the PID loops. Could get interesting real quick. I'll keep you guys posted. Seems like we just got a bunch of motivation in one spot. Now we just gotta build it._


----------



## Afistakis (May 31, 2012)

ommpCaregiver said:


> Awesome project. I worked on something similar : whttp://www.github.com/pleasuretek/opengreenhouse . and am currently working on the project with a beaglebone (embedded linux with database in the load center). I had a PC controlling my garden for quite some time, until the server one day just died on me (wont post, even after replacing CMOS battery). I think the environment of a greenhouse killed it ( I did not put the server in a box with HEPA filtration).
> 
> Also I just sourced a good c02 sensor today from DCS (Digital Control Systems) (been looking at them for a while). Model number 305e. NDIR sensor with SPI and 5v power, for $103 a piece for 1-10 of them... It is the same sensor Green Air Products uses in their sensors (I have one taken apart on my office floor right now after bad customer support experience).
> 
> ...


I just got mental whiplash from so many acronyms! I have no idea what was just said but I suppose I have time to read a book... Thanks for the parts list and additional direction.

I received my mega and a few shields and sensors in the mail today. I'm still waiting on some key components to fully start, but it's time to see what I can put together.


----------



## AdvancedNewbie (Jun 1, 2012)

This is what I've got so far... Damn, I want my touch screen.

[video=youtube;0HeIQbyVDoM]http://youtu.be/0HeIQbyVDoM[/video]

Edit: Lol, just noticed the 'C[zero]2' and that music was unintentional, but seemed to work out pretty good.


----------



## AdvancedNewbie (Jun 1, 2012)

[video=youtube_share;ck8I8Y9Ube0]http://youtu.be/ck8I8Y9Ube0[/video]


----------



## ommpCaregiver (Jun 2, 2012)

The user interface I have been working on is displayed on any computer via X forwarding. So the command to view the interface is like : 'ssh [email protected] -X greenhouse' --- [email protected] is obvious, -X forwards the X session for created a GUI on a remote machine when all the process memory is on the beaglebone remotely, and 'greenhouse' is the program name that is launched at a terminal. 
I am writing this version (my 5th or 6th time writing this program now...) in python as big programs in C++ become hard to manage memory leaks and I end up spending more time keeping pointer/refrence registers in my mind ( like thinking ahead in chess) rather than the actual algorithm or design pattern I am implementing. Also a C or C++ program needs to be compiled for the specific chip arch that is being targeted, by using python, my code does not need to be compiled as it moves from beaglebone to raspberryPi to atom n450 processors, the user just needs to use openembedded or yocto (both bitbake based cross-compiler toolchains) to build their linux kernel and a filesystem with python ( which the recipes are well supported). Right now there are a lot of loose ends in my python codebase, and I want to get it to a working v0.1 (temp controlled relays with temperature hysterisis and such, also pin mux) before I push it to the github tree.

Those little nokia screens are cool, we have a bunch of them at our local hackerspace.. I thought about putting an industrial strength touchscreen on the front of my junction box, but decides against it, as it makes NEMA 4 compliance much more difficult, as well as the cost of replacing broken screens from the field would deter some farmers. However there are some cheap units for prototyping available here: http://andahammer.com/ or ask around for a TI EVM dev board ( usually like the Zoom and am335x-evm ) as I have seen a few of these being given away to people that have a use for it.

Is the temp and RH coming from same sensor ( looks like DHT-11 )? I used to use the white version of those (DHT-22) but there isn't a driver for them in linux, so I have sourced sensors that use i2c instead. 

I have for sure decided to use the m305e from dcs-inc as a c02 sensor, they are cheap, powered over 5v, provide spi and analog out as well as an on board relay trigger ( the sensor has a pic16f876a micro with all the set point control logic built in). I also pulled one from a broken 'Green Air Products spc-1' and I fixed the sensor (which Green Air would not do, even when I went to their factory to talk with their tech who refused to help me, and then I tried to talk to the owner about the help I recieved and he told me he didn't want customers that did not have $300 to fix a $600 controller that is barely over a year old ( more about the point of shitty support over money) and then he called me a "stupid kid" (I am 29 and not stupid) and told me to leave) -did I mention to buy Titan controls over Green Air if you have a choice... But yeah, I now have a working m305e and am compiling my kernel for spidev support as I type this..

Also to stear you further away from the darkside... Microsoft will not survive the tale of time. Every child born into this earth inherits all of the work people have done to create the Linux kernel and all GNU source code, this is free for them to build upon, use in whatever way their imagination can find a use for. On the contrast, every child born into this earth must pay for Microsoft's secret, they are not free to build a racecar with the wheel of the OS, they are charged ( kept in slavery due to the difference in the amount of money it takes for a human to live, vs the revenue streams of big corporations to keep the masses in a state of slavery ). By using and buying into Microsoft products (and apple or any other highly proprietary lock-in type vendor) you are supporting the idea of slavery and helping to eliminate the middle class common people, dooming your grandchildren into a life of forced slavery under the guise of 'freedom' (and since every one is thinking with atoms extracted from McDonald's cheeseburgers, they are 'asleep'). The choice is yours (this also applies to your career as a programmer) - the human community of honesty, openness, and love; or the corporate shareholders with their greed, secrets, and fear. IMO the working environments (and not your desk or box) in a Linux shop are much more human (sustainable and responsible) than my past experience working in shops using (any part of) the Microsoft stack. I understand the learning journey (I compiled my first source in Visual Studio), and am just trying to help shine some light on a path as we wander through the maze in the dark.


----------



## AdvancedNewbie (Jun 2, 2012)

That's some deep input right there... haha.. I understand that about MS and I actually run both. I'm not sure, but I believe I could compile this for use in linux, so long as the anything to do with the serial port still works... Hmm. But meh, the code for the arduino outputs serial data, so all's good there; just need to interpret the info after that. And yeah, these nokia screens are pretty sweet for $5. The temp and humidity are from the DHT-11 (right now) but I've ordered a more precise temperature sensor. Good for now.


----------



## AdvancedNewbie (Jun 10, 2012)

Big Update coming soon. Firmata is scrapped and it's much easier to add I2C, onewire, DHT, etc... sensors and the individual sensors have their own database tables that are now handled by a SQL server. "Historical" working good. You can select any range of days you want and see the graph, in which you can then zoom up on the graph. Now the arduino is not dependent on the computer, but does receive timesync message and logs data when the computer is on. Here's some screenshots:


----------



## AdvancedNewbie (Jun 10, 2012)

I have just ordered a different Ethernet shield as the one I have now wasn't compatible with the new arduino IDE and has very old libraries. It's much easier to program a W5100 Ethernet shield, and so I should be able to program SQL INSERT commands to be sent via Ethernet and the arduino will be able to log to the SQL database when the program isn't running. The Ethernet shield also has a SD card slot which will log data while the computer is off, and sync the data when the computer is back on either through Ethernet or manually updated directly off the SD Card.


----------



## AdvancedNewbie (Jun 13, 2012)

*Alpha 15 up*

- No more Firmata
- New Arduino code with custom serial communication (Arduino can be ran independently now)
 - Cleaned up Export to HTML
- Datalog to SQL Server Database
- Scrapped graphs in Labs
- New History tab allows you to select a date range to view datalog data in graphs.
- No more 'Adding Devices', instead the program looks for sensor names in serial communication message. 

_Download link in signature_


----------



## lorenzop (Jun 13, 2012)

nice work. I've been working on a similar project for a few years. mine's more of a solution for all needs. I have a standardized protocol for communicating with the arduino over usb or either of the ethernet shields. I even made a minecraft plugin to control the outputs from redstone in-game. the app I made is written in visual basic 6, which has its own issues, but I recently started work on the next major version, which will be written in java, and will run native on windows or linux with a client/server model, and with plugins.

would you be interested in teaming up for any part of these projects? one thing I'd like to do is start a wiki website for information on computer automated gardening. schematics and howto's to building many device needed, and different options and alternatives for everything.


----------



## AdvancedNewbie (Jun 13, 2012)

lorenzop said:


> nice work. I've been working on a similar project for a few years. mine's more of a solution for all needs. I have a standardized protocol for communicating with the arduino over usb or either of the ethernet shields. I even made a minecraft plugin to control the outputs from redstone in-game. the app I made is written in visual basic 6, which has its own issues, but I recently started work on the next major version, which will be written in java, and will run native on windows or linux with a client/server model, and with plugins.
> 
> would you be interested in teaming up for any part of these projects? one thing I'd like to do is start a wiki website for information on computer automated gardening. schematics and howto's to building many device needed, and different options and alternatives for everything.


I'm definitely down for the wiki, as it might grow some public interest and it would be interesting to see some other ways of doing things.


----------



## Peragro (Jun 14, 2012)

I've been kicking around the idea of automation for a long while now. I like where this seems to be headed. My "dream" is to have a touchscreen interface on the outside of the cabinet, electronic locking with biometric "key", SMS or MMS (webcam) in case of break-in or other calamity, way-over-temp (150F?) "kill switch" (with smoke detection/fire suppression); and the arduino wouldn't "need" contact with a computer after initial setup except when offloading a whole grow of data. I only have one PC and I don't want it connected to the grow 24/7.

I figure that time synch might be possible via atomic clock (on whatever frequency they're broadcasting). There must be hardware/code for that but I'm falling asleep and don't want to confuse myself further by searching for it. I hope you understand...

I do have a question: How would one go about making the Arduino control fans in a manner similar to the Titan Controls Mercury series? If you haven't seen those, they have day/night settings and "idle" the fan (at 25%~60% of full speed) until the temperature gets above a certain point (then it goes full blast). My problem with them is that the settings are imprecise (dial-based) and I want near-laboratory-grade control of the environment (which would end up giving "real" data about how strains/phenotypes respond to certain conditions). One thing they TC Mercury does that's really cool is turn off the fan entirely if the temperature is too low (thereby using the waste heat from the lamp to heat the grow space).

Since my lamp cooling fan is separate from my exhaust fan, I'd need to be able to control both (which would mean buying two expensive controllers). I figure the Arduino can do it, I just can't think of how right now. Using PWM to control a DC fan would be easy as pie. Unfortunately, I use 120 VAC fans (and have no plans to buy new ones just because I can't figure out how to make them do what I'd like them to do). I guess I could use two circuits for each fan; one would have a rheostat and the other would be "wide open". The Arduino would switch back and forth between them via relays. And if I wanted day/night I'd need a photocell and two more circuits/rheostats. I'm not sure but it seems like this could be done with less than $90 in parts (above the cost of the Arduino itself). You guys seem more knowledgeable than I am; what do you think?


----------



## AdvancedNewbie (Jun 21, 2012)

Peragro said:


> I do have a question: How would one go about making the Arduino control fans in a manner similar to the Titan Controls Mercury series? If you haven't seen those, they have day/night settings and "idle" the fan (at 25%~60% of full speed) until the temperature gets above a certain point (then it goes full blast). My problem with them is that the settings are imprecise (dial-based) and I want near-laboratory-grade control of the environment (which would end up giving "real" data about how strains/phenotypes respond to certain conditions). One thing they TC Mercury does that's really cool is turn off the fan entirely if the temperature is too low (thereby using the waste heat from the lamp to heat the grow space).
> 
> Since my lamp cooling fan is separate from my exhaust fan, I'd need to be able to control both (which would mean buying two expensive controllers). I figure the Arduino can do it, I just can't think of how right now. Using PWM to control a DC fan would be easy as pie. Unfortunately, I use 120 VAC fans (and have no plans to buy new ones just because I can't figure out how to make them do what I'd like them to do). I guess I could use two circuits for each fan; one would have a rheostat and the other would be "wide open". The Arduino would switch back and forth between them via relays. And if I wanted day/night I'd need a photocell and two more circuits/rheostats. I'm not sure but it seems like this could be done with less than $90 in parts (above the cost of the Arduino itself). You guys seem more knowledgeable than I am; what do you think?


http://www.aaroncake.net/circuits/dimmer.asp This little circuit would be a step in the right direction. You would just need to interface it with the PWM output from the arduino. This circuit is good up to 350W and most of those inline fans seem to be around 150W.


----------



## Peragro (Jun 23, 2012)

Thanks. I'll check out that link when I get back to my computer. I found some ridiculously cheap (


----------



## lorenzop (Jun 24, 2012)

AdvancedNewbie said:


> http://www.aaroncake.net/circuits/dimmer.asp This little circuit would be a step in the right direction. You would just need to interface it with the PWM output from the arduino. This circuit is good up to 350W and most of those inline fans seem to be around 150W.


nope nope, let me clear this up for you both. the pwm feature of the arduino will only work with DC fans. it will not work with a triac on an AC line. the PWM of the arduino is relatively high frequency, while the AC line is much lower at 50-60hz. if you do manage to safely hook it up to that PWM signal, you'd end up with a fan that only runs on high no matter what the PWM is set at, except for off. it has to do with the way triacs work. now, more importantly is safely. incase you don't know, NEVER connect an arduino directly to a dimmer circuit like that one. besides it being to high of voltage and frying the arduino, if you touched any part in that circuit, you'd get a nasty shock or much worse.

that said, I'll tell you my ideas/plans for a fan speed controller. the way that dimmer circuit works, the knob (pot, trimmer, variable resistor, whatever you wanna call it) varies the resistance of the power that charges a capacitor. when that capacitor charges to a triggering point, the triac activates and turns on. this is technically PWM, but the method it does this with isn't compatible with the arduino, as the timings are very different. anyway, the faster the pot lets the capacitor charge, the sooner and longer the triac will be on, and in turn, the faster the fan spins. a relatively simple way to interface this with an arduino is to have a few relays, say high medium and low. medium and low could be 2 separate pots/knobs you could adjust to whatever speed you'd like, and high would just bypass the pots or bypass the entire dimmer circuit. hope some of that makes sense to you, but above all, be safe when working with electricity!


----------



## AdvancedNewbie (Jun 24, 2012)

No, I wasn't thinking of PWMing directly to the dimmer circuit, but you can match up the PWM signal from your arduino using the signal from a zero cross detector and some how control a relay... or something along those lines. But you can just control the dimmer circuit with a digital potentiometer. The AD5171 is 64 position with "5 k&#937;, 10 k&#937;, 50 k&#937;, 100 k&#937; end-to-end resistance" and using it is as described here (it uses the I2C Wire Library). There is another that is 256 position for Resistor Values (kOhms): 10, 50, 100 and using that is as described here and it uses the SPI library.


----------



## Peragro (Jun 26, 2012)

lorenzop said:


> <snip> a relatively simple way to interface this with an arduino is to have a few relays, say high medium and low. medium and low could be 2 separate pots/knobs you could adjust to whatever speed you'd like, and high would just bypass the pots or bypass the entire dimmer circuit. hope some of that makes sense to you, but above all, be safe when working with electricity!


That's exactly what I was thinking of doing a few posts ago. I'd want to link the relays to temperature (at the canopy or at the exhaust). I'm thinking of using at least four temperature sensors (Reservoir - temp/pH/TDS; Roots or Intake - temp/RH; Canopy - temp/RH; Exhaust - temp/RH) and I'm still working on a flow chart to trigger climate control stuff according to their readings (res cooler, "swamp cooler", electric space heater, fans). I'm still deep in the "design" stage, drawing diagrams and doing a little bit of math here and there... I really like the Arduino concept but I haven't written code since middle school (BASIC - and not the "visual" kind). Trying to "keep up" with this thread is stretching that atrophied brain meat a little - so thanks for that...

EDIT: Woah. Those digital potentiometers are neat stuff. A little much for me to wrap my head around at the moment (being bedtime and all) but definitely cool. It looks like my previous comment about finding inexpensive AC speed controls on eBay got cut off. I've seen the same ones at hydro stores for way more money. IIRC, they can get noisy but there's an internal trimpot that's supposed to take care of that. I'm not sure how well they'll work but I'm guessing they'll have at least one useful component that's worth the purchase price...


----------



## lorenzop (Jun 27, 2012)

AdvancedNewbie said:


> No, I wasn't thinking of PWMing directly to the dimmer circuit, but you can match up the PWM signal from your arduino using the signal from a zero cross detector and some how control a relay... or something along those lines. But you can just control the dimmer circuit with a digital potentiometer. The AD5171 is 64 position with "5 k&#937;, 10 k&#937;, 50 k&#937;, 100 k&#937; end-to-end resistance" and using it is as described here (it uses the I2C Wire Library). There is another that is 256 position for Resistor Values (kOhms): 10, 50, 100 and using that is as described here and it uses the SPI library.


a circuit like that looks like it'd work great. much finer control than what's needed, but better than what I previously suggested. my only concern, is it shielded and safe to use with high voltage. I could assume it is, but I wouldn't dare plug it in without knowing for sure. any kind of high voltage feeding back into your computer equipment would be disastrous. I'm personally more comfortable using relays cuz I can physically see the control circuit is separated from high voltage, nothing hidden inside a chip and datasheet.

advancednewbie, do you happen to know java? I was up in the air for a long time on which high level language I'd learn next. mono/.net was an option for me, but I'm pretty happy with java so far. I'm only about a week into development on my app, but a few of the major parts are already working well. I wrote up a post on my website about what I have and what's planned, but I don't wanna post the link on your thread without your permission. development seems to go much faster than with anything I've done before. the hardest part is figuring out the libraries. btw, I'd still like to do that electronics wiki, but haven't had a clue where to start. you inspire me. I think I'll start on it right now.


----------



## Afistakis (Jul 7, 2012)

Is anyone still here? I am still working on controls for my RDWC system and such. Just wondering if anyone wants to see?


----------



## Peragro (Jul 7, 2012)

I'm still here and I'd enjoy seeing what you're working on...


----------



## Afistakis (Jul 7, 2012)

I have built an 8 site RDWC a la undercurrentDWC or WoodsmanEh, equipped with a 1/4hp chiller, 950 gpm mag drive pump, 8.5k btu ac, 240w air pump, 3kw digital lighting, cool mist humidifier, and exhaust fan with charcoal filter. I am currently controlling the Turbo Clone with an arduino unit doing a simple 1min on 4min off timer. I am currently working out the data logging through ethernet shield for dual temp humidity sensors in the flower tent to control the humidifier based on vapor deficit numbers. I am also working on a web page to display all of this on 30 second updates. Basically a stripped down version of the control the world idea. The nute chiller, ac and humidifier are all digitally controlled stand alone and the lights and exhaust fan are on timers so that limits the necessity of integration. 

I planted some sweet Blue Dream from clone 10 days ago and i can add some pics of those beauties also. The environment is stable so far but I really want to be able to data log the Ph and ppm along with any other piece of data I can get my hands on. I also have a light intensity meter I want to integrate. 

I definitely could use some help on the arduino to data base and web programming but I am learning on the fly. So far so good. I feel like a kid at a radio shack again!


----------



## sm00thslp (Jul 8, 2012)

MAN! Your doing what I had thought of a couple years ago! I got too excited and haven't read all posts yet, but I sure will. I've been waiting on the extra cash to start programming with arduino. I only have a simple automated-controlled grow box idea, but everything would tie into my VPN. Send me text messages if shit ain't working, or plants need water, etc etc etc.; but it would actually water itself.

I have a little experience with MySQL and PHP if I could at all be of help man.


----------



## AdvancedNewbie (Jul 8, 2012)

Hey guys, I'm still here... Been super busy. But I have my Raspberry Pi now and I think I'm going to start developing something for that. I've also since switched to running linux on my desktop box full time now and have just got some eclipse C++ action on the go now that I've been fooling around with this weekend. It would be nice to have a VNC server on the Raspberry Pi to connect up to and you could run a little MySQL server on there to. Then you could graph this data on a computer on the same network. It'll be nice to be able to program in eclipse or something similar and make use of the debugging and breakpoints which should make programming much easier. It'd be nice to run a little apache server as well, and have the program output a website with sensor values, etc.


----------



## Peragro (Jul 8, 2012)

Hey, AN... I'm a bit confuzzled about using the Pi as a controller. I was considering the Pi, too, when I first heard of it (and you have to love that price) but I got stuck on the "how am I going to make this thing talk to the sensors and switch on the lights?" aspect (as it's only "unused" interface is USB). There are boards/devices out there (mostly fairly expensive) that have a USB connection to PC/Linux. One I saw even had individually programmable digital/analog I/O, which is very interesting. I don't think I'm quite prepared to hack one of those together from parts unless someone's printed PCBs and a parts list. I enjoy building kits and repairing existing electronics (mostly audio/noisemaking gear). I'm just not very good at building circuits from scratch (always hated breadboards) and my programming "skills" are 20-some years out-of-date (as mentioned previously).

I like (no, "love") the idea that Pi can use a "real" HDMI monitor (touchscreen?) and I'm stoked that there's a camera module in the works (I'd like to use the camera's view of the inside of the garden as a "screensaver"). I like that it's ultra-cheap. But it has no internal timekeeping (which I'm not entirely comfortable with) and it only has one (or two) USB ports...

EDIT: I guess the I/O interface could "live" in one port (or in one slot of a passive hub that's "permanently" connected to that port, the touchscreen interface most likely residing in another) and the other "native" USB port could be reserved for another hub for keyboard/mouse... And I'm betting that it would be way easier to do biometric scanning with Linux (I'd mentioned using fingerprint recognition - and some heavy duty linear actuators - for grow security). OMG, I need to sleep. Curse you, Insomnia! CURSE YOU!!!


----------



## Afistakis (Jul 12, 2012)

Where did you get your pi? I have been looking but have yet to find them at the advertised price. More like 3x price... Just wondering if you would share a hookup.


----------



## RexXxMaster (Jul 12, 2012)

wow this is just what i was looking for i was looking at this C02 sensor you think it would work http://www.futurlec.com/CO2_Sensor.shtml .
plus i found this guy doing the almost the same thing he is trying to get funding to make a broad and a system to track everyone data to share it http://www.kickstarter.com/projects/liseman/growerbot-your-social-gardening-assistant
you got me wanting to start playing with a the arduino right now i wanted to do a eeb and flow system would be cool to get everything automatic ph ec C02 temp venting lighting.


----------



## Lite Brite (Jul 15, 2012)

Nice project you got going here AN!


Been tinkering with Arduino for about 10 months now, crash course in c++ (only code i ever did before this project was basic on a C64) 
I built a nice little standalone room controller using a mega that handles 2 light timers, 2 pump timers, & 2 thermostatically controlled blowers (using dh11 temp/humidity sensors).
A DS1307 clock does timekeeping, the 56bytes of battery backed ram on the 1307 came in handy for storing timer and tstat settings in case of power failure.
Has a nice easy LCD user interface using a 10K pot and a push button to set all the options. (gotta thank this guy for giving me a good base sketch to start with)


Anyways enough rambling about myself, my main reason for posting was to throw some info out there since there have been a few posts asking how to get started with Arduino.
Best place to start is http://arduino.cc they have some nice intro information on the arduino as well as a full library of the c++ commands and syntax there of that the arduino IDE supports.
also at the top left of this page you'll see a forums link. Tons and tons of stuff there as well, if you can think of a project odds are someone is or has already done it. Why reinvent the wheel when u can just hack someone elses wheel a bit to fit your needs?




This guy has a nice intro for arduino as well as step by step walk through lessons that'll have you up and tinkering in no time, my controller code started off as his chapter 10 dual timer:


http://tronixstuff.wordpress.com/tutorials/ 


A few more diy sites that have alot of arduino stuff:


 [url]http://www.makershed.com [/URL]
 http://www.instructables.com
 http://www.hackaday.com


And for buying dirt cheap with good quality if you don't mind waiting up to 15 days to get the product
http://dx.com
They have a arduino nano v3.0 on DX for $12.99 w/free shipping, you put a dip socket on your proto board and just drop this sucker in!
Has a micro usb connector to program it just like you would a Uno board.
Was using this until I upgraded to a mega as my code got alot bigger as well as my ambitions (lol).
They got a mega 2560 on DX for $20.90 w/free shipping that is really nice and has worked well for months for me now as a controller.


The mega is much nicer for large control projects since it's got double the program flash memory, double the program execution memory and almost 5X more i/o pins for only 8$ more!
No I don't work for DX, just shop there ALOT. They have almost everything you could ever want or need to get a nice Arduino project going on the cheap.


If you want to order in the us for faster shipping (and higher prices):
http://www.hacktronics.com/ - Have ordered from here as well, fast shipping, great customer service, lots of tutorials
http://www.sparkfun.com/ - Never ordered from here but have heard nothing but good things about them
http://www.adafruit.com - Ordered here before, fast shipping, lots and lots of tutorials




Those of you who are interested in building a custom arduino prototype will find this site useful:
http://www.taydaelectronics.com/
They have dirt cheap prices on atmega 328p's, ds1307's, the xtal's, pf caps, pin headers, dip sockets, 5v regulators, & proto boards needed for a basic breadboard arduino with clock project
No minimum orders, and blazing fast shipping in the US (had my order in 5 days or less every time so far, YMMV).

Keep up the good work AN, will be trying out your software when I can find the time!

LB


----------



## AdvancedNewbie (Jul 16, 2012)

Afistakis said:


> Where did you get your pi? I have been looking but have yet to find them at the advertised price. More like 3x price... Just wondering if you would share a hookup.


Hey, sorry I haven't been around for awhile... But I got my Raspberry Pi from Element 14.


----------



## AdvancedNewbie (Jul 16, 2012)

LB, you using the Pot as some sort of rotary selector for your interface?


----------



## AdvancedNewbie (Jul 16, 2012)

RexXxMaster said:


> wow this is just what i was looking for i was looking at this C02 sensor you think it would work http://www.futurlec.com/CO2_Sensor.shtml .
> plus i found this guy doing the almost the same thing he is trying to get funding to make a broad and a system to track everyone data to share it http://www.kickstarter.com/projects/liseman/growerbot-your-social-gardening-assistant
> you got me wanting to start playing with a the arduino right now i wanted to do a eeb and flow system would be cool to get everything automatic ph ec C02 temp venting lighting.


These are the cheapest CO2 sensors I've seen... Any word on how they perform?


----------



## AdvancedNewbie (Jul 16, 2012)

RexXxMaster said:


> wow this is just what i was looking for i was looking at this C02 sensor you think it would work http://www.futurlec.com/CO2_Sensor.shtml .
> plus i found this guy doing the almost the same thing he is trying to get funding to make a broad and a system to track everyone data to share it http://www.kickstarter.com/projects/liseman/growerbot-your-social-gardening-assistant
> you got me wanting to start playing with a the arduino right now i wanted to do a eeb and flow system would be cool to get everything automatic ph ec C02 temp venting lighting.


Those CO2 sensors are the cheapest I've seen, but any word on how they perform?


----------



## Lite Brite (Jul 24, 2012)

> *
> 
> LB, you using the Pot as some sort of rotary selector for your​
> 
> ...


Ya AN, works pretty good actually, would rather have used momentary buttons but the code was all there already and I really wasn't all that fussy about how my menu system worked, just so long as it worked. 

Still hacking away at a good pump timer code, have a generic one now that in leu of power failure will on recovery go to the on cycle. Better a little wetter than too dry I always say . Would like to get it nailed down so it recovers n picks up right where it left off like the light timers do. 

Have seen alot of light timer codes that do the hour=now minute=now then turn on. Does no good when power drops, light wont cut on till the next hour=now etc. I ended up rolling my own, basically when it powers up it checks the on time and the off time, if it's between the two the timer is ON, after a couple thousand hacks at it it now works perfectly. Learning C the hard way.. lol

LB


----------



## lorenzop (Jul 24, 2012)

Lite Brite said:


> Have seen alot of light timer codes that do the hour=now minute=now then turn on. Does no good when power drops, light wont cut on till the next hour=now etc. I ended up rolling my own, basically when it powers up it checks the on time and the off time, if it's between the two the timer is ON, after a couple thousand hacks at it it now works perfectly. Learning C the hard way.. lol


I've run into a lot of little tweaks like this while designing my own software. something else you might want to consider is a hot start protection to protect your hid bulb (if that's the type you're using). a hardware solution is best for this, but it can also be done in software. you don't want the hot start protection to turn off the light if it's already on and the software is starting up, but if the software is starting up due to a power outage, that's when you want the protection to activate. a hardware solution does simplify things. if power to the light goes out for any reason, good or bad, it'll keep the light off until it's cool. I designed a simple circuit using 2 small mosfet transistors and few other parts. when I find it, I'll post it on my website.

I haven't told many people yet, but I've recently decided to open source my software. I've always dreamed of being able to make a living doing what I love, but the longer I write software, the more I see closed source just holds it back. I believe many of my designs and code are just brilliant and makes me want to do more. just now, I noticed the program for testing firmata looks just like a similar one I made for my own project a few years ago. not sure how that happened, but I'll take it as a sign that I'm doing something right. my project uses its own protocol, but I attempted to make it something that could be standardized. anyway, my project needs a bit more work before I'll feel ready to release it, but source code is available and I do have it partly working.


----------



## Lite Brite (Jul 25, 2012)

Ya I hear ya lorenzop. I have overheat protection in place already using a couple 1wire ds18d20 temp sensors on the hoods of the lights and have thought about hashing out some extra code to check on a reboot to see if they're cold, if not keep the lights off till they are. 
Got a million other things going on right now and it's not super high on my priority list but will get around to it eventually.
I totally suck at coding, that says something about the arduino and it's open source code base. If it weren't for that I'd never have gotten this done. Closed source does have it's place but EVERYONE benefits from open source. 


Would like to see that schematic some time. I do build circuits n stuff. Made a couple protoboard AVR's for other projects I had brewing, love the minimal part count needed to get these microcontrollers up and running. 2 caps, a xtal, and power if you want to run them at 16mhz, nothing but power if you want to run at 8mhz(use the lillypad bootloader though as the arduino bootloader doesn't recognize 8mhz clock)




LB


----------



## Airheadnobody (Jul 29, 2012)

AdvancedNewbie said:


> Hey guys, I'm still here... Been super busy. But I have my Raspberry Pi now and I think I'm going to start developing something for that. I've also since switched to running linux on my desktop box full time now and have just got some eclipse C++ action on the go now that I've been fooling around with this weekend. It would be nice to have a VNC server on the Raspberry Pi to connect up to and you could run a little MySQL server on there to. Then you could graph this data on a computer on the same network. It'll be nice to be able to program in eclipse or something similar and make use of the debugging and breakpoints which should make programming much easier. It'd be nice to run a little apache server as well, and have the program output a website with sensor values, etc.



Hello my friend I see you have been hard at work... I am behind on what you have ben doing but i will try and catch up lol. tho I am still diving head first into my own projects and I tend to let myself start more projects then i can finish lol but anyway. did you ever get the program working on 64 bit? You know i dont mind putting old ass computers back to work again lol but my main is this win 7 64 and i dont know shit about linux well very little i have used ubuntu and back track 5 r2 i couple times......

Im kinda freaked out cuz this is the first time back on rollitup in a while Ive just been too busy with school and these crazy ass females lol but just recently I too have jumped into eclipse again so its odd that you have as well and not to mention the apache server you spoke of lol But i have some thoughts of writing a similar program but i was thinking using a spare android to control everything and upload live cam feed to my server... (and Id love to figure out how to graph stats and keep logs of everything it does) Well keep it up guys and be easy stress causes stress!


----------



## AdvancedNewbie (Aug 14, 2012)

Wow, it's been awhile now. But atleast I have some time to work on the project again. I never did get a 64-bit program running for windows and I decided to keep moving forward with arduino development instead of the raspberry pi. Now that I've played with it a bit more it seems more like a gateway device for the arduino to connect to and be controlled remotely. I believe MySQL can be setup on the pi as well, along with a program running to enter the data values from the RS232 from the arduino to the MySQL database on the Pi. But I'm going to focus on the arduino side of things for now, including saving relay on/off states into EEPROM incase of power outtage.


----------



## AdvancedNewbie (Aug 27, 2012)

Hey guys... Here's the update of the work I've been doing so far. I'm liking this LCD touchscreen I'm working with, it definitely is making the project a little more professional. Check out the video I made (http://www.youtube.com/watch?v=DdbVDJd1Mcc):

First it shows the Light Schedule. Just set whether you're doing 12 hour or 18 and it will automatically calculate the end time 12 or 18 hours after the start time.

Second is the pump schedule where you can enter the start time, the interval between pumpings, duration of the pump and how many times a day to pump. When you press "CONFIRM" it calculates the times during the day the pump will turn on at and displays them on the screen. No more adjusting mechanical timers to be spread out over the day!

Next is the Relay Screen. Notice how the changes are saved in case of power outage. I unplug the USB cable and plug it back in and they show the same states. Time is saved too, but I'm waiting for my DS1307 to keep the time when the power is off.

[video=youtube;DdbVDJd1Mcc]http://www.youtube.com/watch?v=DdbVDJd1Mcc[/video]

I doubt I'll end up using my Raspberry Pi for this project. I think I'm going to keep it standalone. I'm going to add the ethernet module next and once it's all working I throw it all together in the relay box I made earlier (bought some nice plexiglass). I think she's going to be ready for the next upcoming grow!


----------



## CocaLeaf (Aug 28, 2012)

Definitely have a great system developing and looking very good with the touchscreen, it is certainly a nice touch that you don't see everyday 

I also like the status display and relay display, showing clear accurate data that is clearly updated often. Very nice work.


----------



## AdvancedNewbie (Aug 28, 2012)

Thanks. Yeah, it's coming along nicely. Just a few things need to be done now:

+Ethernet
---Remote Control
---Add entry to SQL Database
+PID Loops
+Timers
+Blank Screen Saver

But atleast the interface is all setup.


----------



## Afistakis (Aug 28, 2012)

That is looking legit. I am glad that you have been doing work cause I have been distracted recently and hope to get back to working on it. What are you going to use the PID loops for? The multiwii code that runs my radio controlled quad copter PID for flight tuning but I don't see a correlating application. I was thinking of using the database trends to control if then statements to learn and self right. Is that close?

I still don't have all my sensors and timers coexisting happily... not to mention just about everything else on your check list! Are you going to be sharing your sketch for this one? Any help I can get or time I can save is much appreciated.

Sexy work as usual


----------



## AdvancedNewbie (Aug 28, 2012)

I'm not too sure I'll do PID loops for awhile as I'll do the pH and TDS (Total Dissolved Solids) all manually, but it could be used to keep the pH, TDS, Temp, CO2 and RH all in range. But just getting the timers up and running will be the biggest thing. But for a pro room, you'd have a heater and A/C on the temp PID Loop and pH up / pH down on pumps to control pH (with some sort of agitator), a dehumidifier for RH. Maybe I should just stay simple and, using the heater as an example, turn on @21C and off at @25.


----------



## Afistakis (Aug 29, 2012)

I see what you are looking at with adjusting multiple parameters but I am not sure that PID is the best way to accomplish your desired result. Most, if not all of the controls used for heat on/off, ac on/off, co2 on, etc, are digital high or low values. You do not need a soft correction based on rate of change/time to re zero. Just run it until it is back in range. If you get into controlling flow rate of co2 to balance it over time in a sealed grow room then I can see a benefit but that seems a little excessive when you can calculate your cubic ft space and know the duration needed at a certain flow level to bring it back to the top of your value, or just run it until the sensor hits your target...

My room has auto controls on ac, water chiller, humidifier and lights. I run my vent fan all the time which I could use a speed controller for based on when lights are on and difference of temp inside and outside the room. I would also like to have a difference in temp when the lights are on vs off (day/night) which my unit does not allow for. Water chiller is a constant. 

I rarely need to adjust ph because my nutes are buffered, I only adjust when I replace aspirated water and add nutes. I am using Rdwc, the first video here explains well enough https://www.rollitup.org/dwc-bubbleponics/478010-flowering-undercurrentdwc.html . You can add directly to the epicenter reservoir and it mixes through the system in a matter of minutes and constantly recirculates there after making it easy to manage a long string of sites from one location. No agitation necessary except for maybe the nutrient solution which could just be a pump running and re circulating once an hour or whatever... 
I have some pics of my babies up on page 60 there if you want a peek or I can post here but I feel that would be off topic 

What ever is easier and is more simple to adjust and define variables. I am still most interested in sensor data logging so that I can dial in nutrition better because environment is already fairly locked in. I have gone a few days away and all has been well, I would like to be able to be absent for up to 2 weeks without worry. Gotta take a vacay! Alerts for all system failures or out of range sensor results and remote viewing of the readings are key to what I am trying for.

Are you happy with your touch screen? What should I get to play with based on your recent experience?


----------



## Sencha (Aug 29, 2012)

+rep and sub'd....i'll be back someday, when I'm ready, lol.


----------



## AdvancedNewbie (Aug 29, 2012)

Afistakis said:


> My room has auto controls on ac, water chiller, humidifier and lights. I run my vent fan all the time which I could use a speed controller for based on when lights are on and difference of temp inside and outside the room. I would also like to have a difference in temp when the lights are on vs off (day/night) which my unit does not allow for. Water chiller is a constant.
> 
> Alerts for all system failures or out of range sensor results and remote viewing of the readings are key to what I am trying for.
> 
> Are you happy with your touch screen? What should I get to play with based on your recent experience?


I'd recommend an ITDB02... It's directly compatible with the UTFT library @ http://www.henningkarlsen.com/electronics/library.php?id=51. I had to do a little hacking to the library to get my SSD1963 up and running, but now that I know how I really do like this screen. I agree with the PID loops, I'm going for the on/off range set. I just updated the code to check the times to see if light / water(nute) pump should be on. So both timers are working and are testing to be okay. All the settings save automatically now too. I agree with the priority being the alerts and remote monitoring. I'm going to work on the Ethernet side of things next so hopefully those will be implemented soon too 

Edit: Never thought about the difference in temps for day/night. Good point/idea.


----------



## Afistakis (Aug 29, 2012)

One more frivolous but possibly useful thought: when I go pro, and I want separate systems so that I can harvest every few weeks. I haven't thought much about the control logistics but what do you think of running seperate unos that control the environment and report back to a master or to a computer via xbee or even hardwire? The goal being individual system monitoring and remote control. 

I can't tell how much sense I am making... I apologize that I am not sober but I wanted to put this thought down while i was thinking about it.out it...


----------



## AdvancedNewbie (Aug 30, 2012)

Afistakis said:


> One more frivolous but possibly useful thought: when I go pro, and I want separate systems so that I can harvest every few weeks. I haven't thought much about the control logistics but what do you think of running seperate unos that control the environment and report back to a master or to a computer via xbee or even hardwire? The goal being individual system monitoring and remote control.
> 
> I can't tell how much sense I am making... I apologize that I am not sober but I wanted to put this thought down while i was thinking about it.out it...


lol... Makes sense to me and should be possible through any protocol really, you could go xbee, or wifi but there are security risks to running wireless. Shouldn't be hard to have multiple 'nodes' either, just change the firmware to a different IP address and if you have a SQL Database running, you could just add a new table for each different unit. This should keep everything nicely organized


----------



## AdvancedNewbie (Aug 30, 2012)

Edit: Double Post ^^


----------



## AdvancedNewbie (Sep 1, 2012)

Does anybody know where to get a cheap EC sensor?


----------



## HotFuzzFan (Sep 2, 2012)

Very cheap  But it should work fine enough...
http://www.youtube.com/watch?v=0NPtmHdbW3k
And here is a EC sensor shield:
http://www.practicalmaker.com/products/arduino-shields/ec-shield-assembled
or
http://www.robotshop.com/ec-probe-shield-3.html


----------



## Afistakis (Sep 3, 2012)

Edit: self censorship due to unfriendly honesty...


----------



## CocaLeaf (Sep 5, 2012)

AdvancedNewbie said:


> lol... Makes sense to me and should be possible through any protocol really, you could go xbee, or wifi but there are security risks to running wireless. Shouldn't be hard to have multiple 'nodes' either, just change the firmware to a different IP address and if you have a SQL Database running, you could just add a new table for each different unit. This should keep everything nicely organized


I do believe using a separate table for each "site" or "node" as you put it is the best bet to result difference systems and simple PHP management/display. However, having a web server send signals to the device is where the tricky stuff comes in.


----------



## ricky6991 (Sep 5, 2012)

Sorry for noob questions but i see these type of things all the time for car stuff. I work on cars and do performance stuff for cars so there is always people using the adrino stuff an making posts explaining it ect... diff is cars have sensors on them already lol. To do this type of thing im ASSUMING that i would have to download software(hopefully available for normal laptop?) Then buy list of sensor and install them and wire them into their correct locations on motherboard... im more than capable of doing sodiering and computer things. 

Onto my question- is there a list of sensors to be bought and where to buy or better yet just post a link of all the sensors needed and what motherboard or controller to plug whichever sensors into. Then post the newest software that you guys are using. This would be awesome to do and i know i can hook all sensors up ect just havent ever played around with programming but seems like you guys did the programming parts and have a running setup already. Anybody willing to share it lol?


----------



## MarioMadness (Sep 5, 2012)

Wish I could make something like this.. Don't know where to get all the parts for this tho. To Bad you don't sell systems lol


----------



## AdvancedNewbie (Sep 6, 2012)

ricky6991 said:


> Sorry for noob questions but i see these type of things all the time for car stuff. I work on cars and do performance stuff for cars so there is always people using the adrino stuff an making posts explaining it ect... diff is cars have sensors on them already lol. To do this type of thing im ASSUMING that i would have to download software(hopefully available for normal laptop?) Then buy list of sensor and install them and wire them into their correct locations on motherboard... im more than capable of doing sodiering and computer things.
> 
> Onto my question- is there a list of sensors to be bought and where to buy or better yet just post a link of all the sensors needed and what motherboard or controller to plug whichever sensors into. Then post the newest software that you guys are using. This would be awesome to do and i know i can hook all sensors up ect just havent ever played around with programming but seems like you guys did the programming parts and have a running setup already. Anybody willing to share it lol?


*I just made a new Source Forge Page for this.
All code postings will be updated on this page: http://sourceforge.net/projects/envirocontrol/*

There's still some work to be done, but like you said, I can update it over time and a new download will be available periodically.


----------



## AdvancedNewbie (Sep 6, 2012)

> Wish I could make something like this.. Don't know where to get all the parts for this tho. To Bad you don't sell systems lol


I was thinking of that eventually


----------



## MarioMadness (Sep 6, 2012)

Do it up, I would love to be able to have a all computer controlled setup. I Just don't know how I Just don't know where to start


----------



## smigula (Sep 6, 2012)

Awesome thread and idea!

I actually had a similar idea early last year to use my programming skills to automate a lot of the grow process, but last June I fell down 25 feet a onto concrete floor, fractured 2 vertebrae (my T9 and T12...a spinal cord injury or SCI) as well as fracturing my skull in 2 places (a traumatic brain injury or TBI) and since then I have been rehabbing like crazy. I actual have already had a lot of return, but the nerve regeneration pain is by far the worst pain I have ever felt, and because of my brain injury the medications that are normally prescribed for nerve pain my docs can not prescribe for me as they will cause me to have seizures and so far the only thing that I have found that alleviates some of my pain is weed, so unless I move to a medical marijuana state I need to grow my own as I go through a lot of it with my pain

enough about my injury and shit, I actually just got my BS in Computer Science this May from Case, so I know a lot of programming languages. I have worked as a web developer, so I am particularly familiar with all aspects of web design...managing LAMP/MAMP stacks both locally and remotely so I know a lot of bash commands, writing PHP/JavaScript/HTML5 code, all sorts of database shit including structure and SQL queries...I was a biomedical engineer my first 2 years so I familiar with MATLAB, I made my first Android app for my senior project so I know that really well now (Java) etc. so if I can help with anything just let me know I have a lot of free time

I have never written anything in C++, only C in a few of my courses so if you haven't written anything in C it sucks, my desktop and laptop are both Macs, I get a lot of software for free from my college so I downloaded pretty much everything I could before I can not any longer, so I have the newest version of MATLAB and Visual Studio, and I was wondering how hard you think it would be to implement a similar system in MATLAB?


----------



## smigula (Sep 6, 2012)

btw in case you were wondering, Case is mostly nerdy people (beyond nerdy nothing like I have ever seen) so I met like 10 or 20 people from the whole university that smoke most ppl play WoW


----------



## ricky6991 (Sep 7, 2012)

Can you please help me out advnub... so i would download the adrinolab in your sig to a pc and how would i attach the sensors to pc? They all usb ends which plug in or do i need to buy some sort of adrino motherboard and then wire in the sensors to motherboard i specific order and then the usb goes from adrino to pc? Also how would you hook the lights into the computer to turn on and off? Is there an outlet which can handle that many watts from the audrino or does it use a seperate timer that hooks into the adrino?

These are complete noob questions but still lost as to what exact sensors to buy and what motherboard to buy then how to wire the sensor into whatever and finally which software to dowload on bboth links in your sig.

I completely understand you are doing this freeware already and put ton of effort into it but if you could just make some sort of write up on what to buy specifically and what specific to dowload and a write up on wiring the sensor then i bet a ton of people would be using this instead of all seperate sensor, bluelab meters ect... this is an awesome thing to develop. Hopefully uou can make a write up on it for us non programming educated people lol. I would love to go online as we speek an buy sensor/motherboard ect and begin using this. I bet it would be cheaper than buy 1 bluelab meter and more efficient as well.


----------



## Afistakis (Sep 7, 2012)

AdvancedNewbie said:


> The program is coded in VB.NET 2008 - if you downloaded the code and want to change it you'll need VB.NET 2008; I have Visual Studio 2008. The zip that's available for download also includes a folder called 'Arduino Source' inside that folder is a file called, "StandardFirmata_Modified_ALL.ino" That file, you'll have to open with the Arduino Development Environment. (http://arduino.cc/hu/Main/Software). From in the Arduino IDE program, you'll have to upload the modified firmata code onto the arduino. As for all the ideas you have in mind are very much possible; I have a RFID reader right now that I haven't used in a while and I found it to be a little bit a work to get it working... But none the less, it worked. I have also seen some cheap magnetic door locks good for up to 1200lbs, and ones stronger than that even, and they require 5v to activate them. But if you know of any cheap linear actuator style locks, I think I'd be more interested in those as they don't rely on magnets. (even though when the power is off to a magnetic door lock they stay locked) The RFID reader I got was off eBay, "Arduino RFID module Kit 13.56 Mhz with Tags" I had no trouble modifying their sample code to get to work. I have not messed around with it in respect to getting it to talk through the Arduino and then to the PC, but it should be possible. The code would have to be re-written for the arduino to accomidate the reader, as (if I recall correctly) the RFID reader uses a UART style transfer method and I can't really picture that working without rewriting the arduino code... Hmm, but you got me thinking. I was thinking it would be easier to use your phone to unlock as this could be code on the PC code, but it would suck to be locked out of your room because your phone's not charged, or the Internet > PC > Arduino > Lock 'hops' didn't work out somewhere along the way... If I knew the mega's were that cheap on eBay I probably would have waited for on of those to arrive to play with it instead. Please let me know if you're able to get up and running. I'd like to support all Arduinos. I might also incorporate shift registers to get more outputs, but this would take some rewriting of arduino code too.
> 
> Edit: If you want to try out the compiled binary, you'll have to dig deep... In the zip: ArduinoFirmataVBExtended > bin > Release > ArduinoFirmataVBLab.exe


Pleas read the thread and then do some more reading and experimenting. It isn't so simple as drawing a pic at this point and say plug this here and that there. Simple programming is required. This is not currently commercially ready and is still in the DIY stage.


----------



## AdvancedNewbie (Sep 7, 2012)

Afistakis said:


> Pleas read the thread and then do some more reading and experimenting. It isn't so simple as drawing a pic at this point and say plug this here and that there. Simple programming is required. This is not currently commercially ready and is still in the DIY stage.


Well said. Hopefully we'll be there in a couple months.  Experimenting with my ethernet shield right now. Not much luck


----------



## Afistakis (Sep 8, 2012)

After reading your sketch, I realize that I may have under stated the simplicity of the programming. My apologies. That interface looks like it was ridiculous to get working. I hope the ethernet shield isn't so difficult. 

+Rep for tons of amazing work!


----------



## AdvancedNewbie (Sep 8, 2012)

haha... No worries, I also expected it to be a lot simpler.


----------



## smigula (Sep 12, 2012)

hi, I am moving to Tampa at the end of the month, when I get there and setup I am going to start my grow op just like this one. I already bought a arduino mega 2560, I am going to do all the programming myself with MATLAB (i have a degree in comp sci and have did some summer research at Duke with a robotic breadboard, the research I did was actually the basis for a new course in the EECS dept), I am putting together a spreadsheet of what I will need to get started and I am lost on setting up an ebb and flood system. From what I could tell I will be putting together my own system instead of buying one, I already found a pump to get but I have no clue what to get for the tray and tubing, any suggestions?


----------



## AdvancedNewbie (Sep 15, 2012)

I'm going to setup my stuff again, most likely later today. Maybe I'll take some pictures of it 'bare-bones' to give you an idea. I take pics of all the fittings I used and how I cut the holes in the table. I use a simple 60L rubbermaid container as my nute res. But you'll see in the pics. I think it will be easier than typing everything out


----------



## smigula (Sep 16, 2012)

AdvancedNewbie I have a couple questions:

1 - I know you said you are using a rubbermade container for the res but what should I use for the tray?
2 - Instead of using timers, why dont you just write a bash script (similar to a CRON job) to execute a script at certain times? You can execute the bash script on your PC and transmit the specified command via wireless
3 - I just got a Mega 2560, I ordered a SSR and this 4-Channel Relay Board, what do you recommend to transmit/receive wirelessly?


----------



## smigula (Sep 16, 2012)

Also AdvancedNewbie, instead of using timers why don't you just write a bash script (similar to a CRON job) to execute a script/file at certain times?

You could run the bash script on your desktop, at certain times run a script that sends the Arudino a command to turn on/off outlets and even control the ebb and flow schedule (pumps).

This is what I am going to do unless you know that this is not possible.


----------



## AdvancedNewbie (Sep 17, 2012)

That's very possible. You could have bash output html code for you based on the settings of the arduino server if you really wanted to. There's lots of ways to do this. It's just how independent you want the unit to be (ie. fully running on the arduino). That's what I'm going for here; a fully independent solution that can serve a webpage. Waiting on another ethernet shield now. Didn't have much luck with the ones I have now. I've been playing the the raspberry pi as well, and am able to receive serial messages on it, so a little bash script on that wouldn't been too shabbs.


----------



## smigula (Sep 17, 2012)

ok AdvancedNewbie, I had a spinal cord injury last June so I am currently in a wheel chair, my plan is to write bash scripts to control everything that the timers control, I do not work and do not have a lot of money so that would save me about a $100. 

What ethernet shield do you recommend I get and what hardware do I need to get so I can send and receive messages on the Arduino?


----------



## AdvancedNewbie (Sep 17, 2012)

I'll test some shit out today, we'll see how it goes. I'm thinking the rasp pi would be a good asset. I'm going to start there. Maybe I'll have an answer to your question soon.


----------



## smigula (Sep 19, 2012)

ok thanks AdvancedNewbie, I already bought the Mega 2560, a solid state relay and a 4 Channel DC30V. 

Now I am looking to buy a raspberry pi before I move, where can I get one at? I found a bunch on ebay, anything I should keep in mind?

This one is buy it now but it says it is made for the Gertboard should I avoid getting this one?
http://www.ebay.com/itm/Raspberry-Pi-26-Pin-GPIO-Cable-Made-for-Gertboard-/280944977212?pt=LH_DefaultDomain_0&hash=item4169a0253c

I read this post on controlling the arduino with a rasp pi (using python), now if I wanted to have my desktop communicate with the arduino and run certain commands on a schedule or triggers, what will I need? Sorry for all the questions, I am not new to coding I am just confused by the hardware setup.


----------



## AdvancedNewbie (Sep 20, 2012)

I got my Raspberry Pi from Element14. I have had some success using python to receive serial messages, but cannot get repeatable results; yet. I'm going to work on the programming tomorrow. I think I'm going to try your post above. I just got everything setup again, so I'll take some pics.


----------



## AdvancedNewbie (Sep 20, 2012)

Here's some pics of some of the fittings I used and a basic wood frame (which still needs the 45 degree cross members). The drains/intakes all have a small rubber gasket that's in contact with the table (you can see them if you look close). They provide all the seal needed. The hose on the new setup has a 1in inner diam. for the drain and a 1/2in for the intake. I used a drill with a 1in bit (commonly used for making holes when wiring through studs) and finished it up with a rotary tool (dremel will work). I also start my babies off in a 'Jump Start' (kinda of expensive for what you get [~$75] - but not shitty either, worth it to have something work).


----------



## xscottrox (Sep 21, 2012)

Wow. Great work. I have been thinking/dreaming this up in my head lately and it is good to see an entire community of fellow nerds (no offense) working on this. I don't really have too much experience with arduino's but I learn very fast. As far as coding I'm definitely a newbie but I am going to college for it right now. Hopefully I can get something as elaborate as this set up within the next six months and hope I will be able to contribute. Thank you for all of your effort in this.


----------



## AdvancedNewbie (Sep 21, 2012)

xscottrox said:


> Wow. Great work. I have been thinking/dreaming this up in my head lately and it is good to see an entire community of fellow nerds (no offense) working on this. I don't really have too much experience with arduino's but I learn very fast. As far as coding I'm definitely a newbie but I am going to college for it right now. Hopefully I can get something as elaborate as this set up within the next six months and hope I will be able to contribute. Thank you for all of your effort in this.


Hey, no problem; and no offense taken... Nerds can make some cool shit happen, and there's nothing nerdy about cool shit.


----------



## arrozkongandulez (Sep 25, 2012)

AdvancedNewbie said:


> pH pen: ~$30
> pH sensor: $20, and Adapter: $15 - a little over the price of the pen here, but does the pen log the data? Can it turn on and off anything? Tested: I got it to match the value of my pH pen +/- 0.03


This is awesome!... im actually in the early stages of planning an automated grow system also... what ph pen did you get? ive been looking at one by Atlas Scientific that runs about 100, but 35 is much better lol... 

keep up the good work dude!


----------



## AdvancedNewbie (Sep 25, 2012)

arrozkongandulez said:


> This is awesome!... im actually in the early stages of planning an automated grow system also... what ph pen did you get? ive been looking at one by Atlas Scientific that runs about 100, but 35 is much better lol...
> 
> keep up the good work dude!


For the pH Sensor I use a phidgets pH/ORP Adapter: http://www.phidgets.com/products.php...duct_id=1130_0

I bought a cheap pH probe off eBay - connects up using the BNC connector.

I found some good info on using the pi and how to make a webpage with graphs from the information received off the arduino onto the raspberry pi.

Here's that info: http://www.benk.ca/node/10

I hope to have it all setup in the next couple of days. Just got my room all setup and am running everything manually for now.


----------



## AdvancedNewbie (Sep 25, 2012)

I finally forked out a few bucks for a cool tube. Holy shit what a difference. I didn't want to fight with heat stress this time 'round. No more 27 to 32 degree temperatures; but I didn't think I'd be down to 23 steady now. I'm idiot for not buying one earlier - so if this is 'you' reading this now - learn from me! ( I know it's a common-sense kinda thing, but if your thinking you can get by without spending the dollars; don't be retarded. )


----------



## AdvancedNewbie (Sep 26, 2012)

This was so helpful I have to post it now (for the sake of documenting): 

GnuPlot Multiplot Tutorial (Putting multiple graphs on one image)
http://www.youtube.com/watch?v=upitol8A0yQ


----------



## HotFuzzFan (Sep 27, 2012)

Thumbs up!
looks great and i like the idea to continue with raspberry pi.


----------



## AdvancedNewbie (Sep 28, 2012)

Anybody have any suggestions for an AC dimmer controlled by the arduino? I was going to do a triac / transistor - but I think maybe I can modify a regular 120V wall dimmer switch. Anybody?

Here's some info I've been looking at:
http://arduino.cc/playground/Code/ACPhaseControl


----------



## Afistakis (Sep 30, 2012)

AdvancedNewbie said:


> I finally forked out a few bucks for a cool tube. Holy shit what a difference. I didn't want to fight with heat stress this time 'round. No more 27 to 32 degree temperatures; but I didn't think I'd be down to 23 steady now. I'm idiot for not buying one earlier - so if this is 'you' reading this now - learn from me! ( I know it's a common-sense kinda thing, but if your thinking you can get by without spending the dollars; don't be retarded. )



There is no price short cut when it comes to equipment. I am about to do a run with a 16 site 180 gallon Rdwc system with 6kw lights in vented hoods, 2 ac units, nute chiller, 2 950gph pumps, 200lpm air pump, etc. I don't want to think of the prices involved all at once because it is about double the price of the car I currently drive, but there is no arguing with the results. 

I am super excited about the pi direction. I really want to add data logging to this cycle especially web accessible. 

keep up the great work! I will be back to trying to solve fun problems after I solve some other big important ones this week.


----------



## got2doodle (Sep 30, 2012)

Haven't had time to read the whole thread but...
Exciting to find someone else using an arduino in a grow room!

I'm currently building my room, I have a few arduinos and I been programming for years (php, perl, c++ basic) I plan on growing organic so mostly for me the arduino will maintain the environment.

I am going to have two 320w MH bulbs in a 4x4 room, I want to program the lights to share the load so for example maybe mid flowering bulb A burns for 4 hours Bulb A and B burn for 4 hours (massive light roughly around the maximum recommende) this should give some foliage penetration and then the last four hours is just Bulb B. The way I see it, plants don't like surprises so even switching from 18/6 to 12/12 could be a more gradual change. You could change the duration over a period of a week (or weeks) and the plants wouldn't be sitting there for a few days saying WTF just happened??

I haven't seen any other info regarding this approach and my gut just tells me that the plants would like it.

Anway, I'll be sub'ed and watching this closely.

Gotta go, stuff to do
doodle


----------



## got2doodle (Sep 30, 2012)

Just read the whole thread, holy crap!!

doodle


----------



## Afistakis (Sep 30, 2012)

IMHO there can never be too much light. Only too hot and close to the tops of the plants hence my 3kw per 8 site strategy per 4x8 tent. I wish I had more power to give them and more space to simulate their natural environment! I follow and have learned tons from a guy doing 1kw per plant on 110" centers. 4 plants, 4kw. That seems to be more toward the recipe I want to cook. With decent ventilation and maybe a little climate control 1kw should be easy to manage in a 4x4. The foot candle foliage penetration is so much higher than lower wattage lighting. I can supply numbers but if you want to substantiate my incredible claims but I am Le tired and Le lazy atm.

On a side note, it is an interesting idea to cycle lights to move the origin and leave your cumulative output the same. I think it would be cheaper to just move the lights and have fans blow the plants around a little to enhance canopy penetration. There really isn't much room in a 4x4 to do much of anything though.

my 2c


----------



## AdvancedNewbie (Oct 1, 2012)

Free day - going to work on this all today. I have my voltage regulators to run the mega / lcd screen at the same time now ( more power ). I still haven't found much information on what type of dimmer would work for an inline fan (chops the AC wave) or if you'd have to lower the voltage (using a Variac and lowers the amplitude of the AC wave). I'm thinking a variac would probably be the best so I don't 'turn on and off' the fan; maybe blow the capacitor in the inline fan powersupply? I have a good means of communication between the ardunio and raspberry pi now and can write a little script to output some graphs for a HTML webpage using the raspberry pi. I'm going to put everything in the relay box today and power it all using my new voltage regulator. woot


----------



## got2doodle (Oct 1, 2012)

Would PWM work to control the fan speed? Assuming a relay is controlling the fan, the fan only gets power for half the time? I'm no electronic whiz but why do you think this would blow the capacitor?


----------



## got2doodle (Oct 1, 2012)

Afistakis said:


> IMHO there can never be too much light. Only too hot and close to the tops of the plants hence my 3kw per 8 site strategy per 4x8 tent. I wish I had more power to give them and more space to simulate their natural environment! I follow and have learned tons from a guy doing 1kw per plant on 110" centers. 4 plants, 4kw. That seems to be more toward the recipe I want to cook. With decent ventilation and maybe a little climate control 1kw should be easy to manage in a 4x4. The foot candle foliage penetration is so much higher than lower wattage lighting. I can supply numbers but if you want to substantiate my incredible claims but I am Le tired and Le lazy atm.
> 
> On a side note, it is an interesting idea to cycle lights to move the origin and leave your cumulative output the same. I think it would be cheaper to just move the lights and have fans blow the plants around a little to enhance canopy penetration. There really isn't much room in a 4x4 to do much of anything though.
> 
> my 2c


No it's not much room, but I don't need much medicine just for myself. Many strains can produce 500gr/sq meter, if you know what you're doing (which I don't BTW). If I could get yields like that it would be way more than I need. I just thought the two lights would be a way to ramp up the intensity, my balast are not digital, but they were very cheap (like me). The arduino also has some eprom memory so that I could log the bulb usage and not lose that data with a power out by dividing the load between two bulbs, example each burns for eight with a four hour overlap I just have to store one number because it's the same for both bulbs.

But I'm a long way off from being there, I grew once about thirty years ago and I broke rule #1, the next thing I knew I had friends bringing friends over to see my plants!!
Duh!
Nobody knows this time!


----------



## AdvancedNewbie (Oct 1, 2012)

got2doodle said:


> Would PWM work to control the fan speed? Assuming a relay is controlling the fan, the fan only gets power for half the time? I'm no electronic whiz but why do you think this would blow the capacitor?


Not too sure, this is what I've seen on different web pages, but others say it's okay. I don't think an inline fan is the same as a ceiling fan, either way I bought a cheap variable speed controller for an inline fan on ebay for $22. On a side note, I tried a lamp dimmer, and half or lower gave me some flicker but half way and up the fan was nice n' slow like I wanted, then all the way up was full speed. The dimmer I tried is an Incandescent (tungsten filament) dimmer Max: 300W .... I didn't want to run this method until I knew for sure this was okay. It does work by chopping the AC wave.


----------



## got2doodle (Oct 1, 2012)

I don't completely understand the inline adjective used in your post, but assuming you have a motor, and there is a power supply (the part that contains the capacitor) then a relay could potentially meter out the current after the power supply. Usually when a capacitor is significant it's used as a startup component, like using a capacitor to jump start a three phase motor. I think in general motors are pretty simple devices, there aren't too many ways to make magnets attract. Anyway, I have no 'medicine' right now, red wine only, so I seriously doubt that my comment will make any sense but WTF , I'm posting anyway. I plan to do some experiments on my own with motor control, but that aint gonna happen tonight!

Cheers,
doodle


----------



## AdvancedNewbie (Oct 2, 2012)

It's just the fact that the capacitor has to load and unload fast to be able to smooth out the on/off switches of the dimmer, you're right though; usually with a capactior used to jump a motor into starting has to deal with there being no resitance at the start because there is no induction that has taken place yet. But that's an entirely different than smoothing out the chops in the wave. So the question is - is the powersupply (ie. capacitor) going to be able to deal with the chops? When I say inline, it's just like a regular 6inch 400cfm fan that goes 'inline' with the ducting (ducting attached to each side of the fan). My fan is in the attic, so testing this isn't really a great option for me; just in case something were to happen.

Option 2: Lower the voltage to the fan


----------



## AdvancedNewbie (Oct 3, 2012)

I ended up getting this:


----------



## got2doodle (Oct 3, 2012)

Cool, easy is good and so is safe!! Keep us posted.
doodle


----------



## AdvancedNewbie (Oct 8, 2012)

Some people have been asking about the wiring for the relays and the outlets. Here's a quick photo I edited:

 Note: "N/O" is "Normally Open" and "N/C" is "Normally Closed"

!!!!!!!!!!!!!!!!EDIT: Also, I have mine setup on the Normally Open side (opposite to what it shows on the picture) so when the lights go off I can take my system down to work on it or do a firmware upgrade, etc, without the lights and fans and pumps all turning on. This is much better!!!!!!!!!!!!!!!!!


----------



## AdvancedNewbie (Oct 9, 2012)

*I have updated the code for the Arduino standalone sketch and have included a Python script and a PHP webpage for controlling the Arduino remotely. This is now available at: https://sourceforge.net/projects/envirocontrol/*

Note: I am using a Raspberry Pi as a web server for the Python script and the PHP webpage. The Raspberry Pi costs about $35 and is basically a credit-card-sized small computer capable of running linux. This computer fits in my relay box along with my Arduino and Touchscreen interface.


----------



## guason (Oct 10, 2012)

Thanks AdvancedNewbie.

Nos vemos


----------



## AdvancedNewbie (Oct 11, 2012)

I finally got my speed controller - so I'll wire it up this weekend  Then I can start writing the PID loop for the Fan Speed based on the temperature. (Just going to keep switching between the circuit with the speed controller (adjustable) and full 120V)


----------



## AdvancedNewbie (Oct 15, 2012)

After many hours of research, I will most likely be getting this: http://webpages.charter.net/tdsmeter/products.html The submersible probe = $27 and the transmitter (just takes the input from the probe and outputs a range of 0 - 5V) for another $27... or an inline for $45... I will need two for each reservoir. I'm still waiting on my network cable to show up (bought a big spindle with a crimper tool off eBay pretty cheap - going to use this for my sensor cables.)


----------



## AdvancedNewbie (Oct 15, 2012)

For completeness sake, this is the CO2 Sensor I already own. [http://www.ebay.com/itm/110888030682] I haven't tested it out and I'm not too sure it can give a percentage yet (might just detect [yes/no] )... But all this is to come shortly.


----------



## AdvancedNewbie (Oct 19, 2012)

This is the wifi adapter I'll be using for my Raspberry Pi: www.ebay.ca/sch/i.html?_nkw=Edimax+EW-7811UN

Edit: Here's a link for getting that working ---> http://wolfpaulus.com/journal/embedded/raspberrypi_wifi


----------



## Total.Hydroponic.Control (Oct 19, 2012)

Do the project files include the touch screen?


----------



## AdvancedNewbie (Oct 20, 2012)

Yes, it's built into the Ardunio sketch.

EDIT: It's based on this library: http://www.henningkarlsen.com/electronics/library.php?id=51 (which can be modified for quite a few different TFT LCDs)


----------



## AdvancedNewbie (Oct 21, 2012)

Here's some of the ethernet box's I'll be using for the sensors. They all connect back to the electrical / relay box via ethernet cables / jacks.


----------



## smigula (Oct 23, 2012)

AdvancedNewbie can you please delete some messages from your inbox, it will not let me send you a message until you free up some space. Either way, these are the questions I have:

So I broke the first relay on my board as I did not know what the ports were initially so I ordered a 8-channel board and I got everything hooked up, but I forget where the jumper connected to a digital port on the Arduino goes, can you please explain?

Also I got a 25A SSR and a heatsink for it, what exactly is the SSR for? Last what is the minimum size (in quarts or gallons) of the container do you recommend?


----------



## AdvancedNewbie (Oct 23, 2012)

I use a 68L Rubbermaid container per 1 4ft x 2ft flood table. The 8-channel relay will have VCC, 1, 2 , 3, 4, 5, 6, 7, 8, and GRND Vcc ---> 5V GRND --> GRND All the numbered ones just hook up to a free digital pin on the arduino.

The SSR (Solid State Relay) will be used for your ballast. You want to make sure it has 'zero-crossing' ie. turns on when the AC wave is at zero. This will avoid a surge through the relay; which could weld the contacts together (thus rendering your relay useless)


----------



## GreenWilly (Nov 12, 2012)

AdvancedNewbie said:


> I ended up getting this:
> View attachment 2359087



Hey Newbie,

thank you for programming this  I plan to use your program.

Why don't you use a step-down transformer like http://avenco.de.preon.de/wp-content/files_flutter/12610594301260538906Stufentrafo3A230V.jpeg ?
With that you could control the LTI fan-speed with relays. It's not stepless but the easiest way I think.

Regards


----------



## ASMALLVOICE (Nov 13, 2012)

Very Nice Setup M8.

I would like to know the model of the PPM/PH meters you are using and what signal they output, 4-20ma or a vdc signal. I am looking for meter/s to add to my system. I have all the other components and that would complete the setup. I have a coupe of sequencers that I am playing around with and a small single phase vfd for my extraction setup, but it will be a while before I need that, my little babies are only 8 days old. I look forward to more from your setup Once again, great work M8.

Peace

Asmallvoice


----------



## AdvancedNewbie (Nov 13, 2012)

GreenWilly said:


> Hey Newbie,
> 
> thank you for programming this  I plan to use your program.
> 
> ...


I like this idea, and I'll basically be doing this anyways, but I'll just be using my speed controller I have now, or straight 120V (switch between manual and full 120V)... But I think I might want a little more control in the future, and one in the range of 40V,80V,120V would be nice.

I've been working on the interface and program this weekend, so I'll post an update really soon. Graphs are working on the site now  Starting to come along nicely. Also finished up my relay box, which has the touchscreen, relays, powersupply, ethernetports (for sensors) and spot for the raspberry pi so you can still access the usb ports / ethernet. Everything automatically starts-up with the Pi now too - auto login, start listening for serial comm's, webserver, vncserver, ssh, etc.


----------



## AdvancedNewbie (Nov 13, 2012)

ASMALLVOICE said:


> Very Nice Setup M8.
> 
> I would like to know the model of the PPM/PH meters you are using and what signal they output, 4-20ma or a vdc signal. I am looking for meter/s to add to my system. I have all the other components and that would complete the setup. I have a coupe of sequencers that I am playing around with and a small single phase vfd for my extraction setup, but it will be a while before I need that, my little babies are only 8 days old. I look forward to more from your setup Once again, great work M8.
> 
> ...



The sensors I'm using are 0V to 5VDC... I use the Phidgets pH Adapter and a regular BNC pH probe off eBay (cheap ones) The PPM meters (haven't purchased them yet) are also VDC 0 to 5 and there's a link a couple pages back.


----------



## ASMALLVOICE (Nov 13, 2012)

AdvancedNewbie said:


> The sensors I'm using are 0V to 5VDC... I use the Phidgets pH Adapter and a regular BNC pH probe off eBay (cheap ones) The PPM meters (haven't purchased them yet) are also VDC 0 to 5 and there's a link a couple pages back.


I humbly appreciate your responce and look forward to comparing notes once I get all setup. If you are looking for any specific hardware, such as sequencers( from 1 stage to 10 stages) or any type of end devices, temp, humidity, CO2 transmitters, actuators or the likes, drop me a line, would be honored to help.

AUTOMATION RULES!!!

Peace

Asmallvoice


----------



## entree (Nov 13, 2012)

I'd be interested in paying you to set one of these up for me Newbie. Getting the hardware and software configured would save me a ton of time and would be nice to compensate you for all this public work! If you'd be interested, send me a PM

Best


----------



## AdvancedNewbie (Nov 13, 2012)

*Version 1.11 out now *


----------



## AdvancedNewbie (Nov 20, 2012)

*Version 1.13 out now *


----------



## djlarry502 (Nov 20, 2012)

very cool.
I use a arduino to make led dance floors. I wanted todo something like this but can't seem to find the time.


----------



## AdvancedNewbie (Nov 21, 2012)

It does take time, but it's a good learning experience and now everything is customizable and it's pretty easy to add some code and add a new feature if you want it. I hate buying something and finding you want some feature later on and there's no way to just 'add' it in.


----------



## djlarry502 (Nov 21, 2012)

I think im going to put one together this friday.To be honest i did not look in depth. Do you have a complete parts list?


----------



## AdvancedNewbie (Nov 21, 2012)

I just ordered some different parts, project box, power inlet, etc.. and I'm going to be putting that all together once it gets here. Also ordered up some headers and have some copper pcb boards here and I'm going to make some Arduino Mega shields for connecting up to the LCD Screen and the Ethernet Ports making it a lot easier. Bought a small breaker for it too that can be snap mounted on the case and reset from the outside. I want to get rid of this ugly wood box I have now. Heh. I will make a complete list soon.


----------



## lorenzop (Nov 22, 2012)

there's a part, I forget what it's called, but it's sorta a cross between a resistor and a fuse. it normally has very little resistance, and allows power to pass, but if to much current passes, it heats up, raises the resistance, and cuts power. you unplug the device or turn it off for a few seconds and the fuse cools and resets. I have a bunch of them I plan to use for my similar project. they work great, as long as you don't overload them. I plan to put them in my controller box, which connects to relay outlets with mosfets and relays built in, in case the patch cord shorts somehow. hopefully save my hardware or prevent a fire.


----------



## GreenWilly (Nov 22, 2012)

A list of all Components would be nice  I now have got ---> Mega 2560, Relay Shield (with 8 Relays), DHT-11, LM35 and a DS1307 (Real Time Clock). Touchscreen I will buy next month. Sensors for pH/EC I don't need at the moment. Anything else I have to buy?  I read something about an Ethernet Shield?! Which one do you use? W5100? And could you explain how you connected the sensors to the ethernet box you built and how to connect to the arduino? Sry if my english is bad!  I am from Germany! Greetingz


----------



## AdvancedNewbie (Nov 26, 2012)

Sorry guys, been working lots lately. I don't use an ethernet shield anymore (tested it out)... I use the Raspberry Pi for a connection now, but I'm using an Edimax Wifi adapter - no wires  The relay shield is okay for small things (small pumps, maybe a 400W fan at the most) but for anything greater than 400W you're going to want a Solid State Relay with zero-crossover. I will explain how to connect everything up soon... (when I find time to do some technical writing) In the mean time though, I have successfully etched an 'Environment Shield' PCB for my mega. This makes the connections to the LCD touchscreen way easier (1 to 1 connection now - no crossing wires - can use a ribbon cable now  ), includes a reset button on top of the board, has a ds1307 for time keeping and a power strip for running the raspberry pi off of. Still waiting on some of the other things - project box, etc. I'm going to make another PCB for the Ethernet jacks soon and they'll connect up to the new PCB I made with a ribbon cable. Expect some sort of writings from me soon... Thanks for the patience.


----------



## labrat420 (Nov 27, 2012)

This is cool as man, im working on a logging/control system to, using an 8051 with asm code for control and LabView for the user interface (easy to remote desktop in from my phone or tablet). My plan in the short term is to get the data logging/user interface working smoothly (im not using the 8051 yet) then later on using the 8051 to control fans pumps lights dosing pumps. . . I basically want to limit the human interaction to the grow to monitoring plants and logs, tweaking the control parameters. Performing maintenance on systems/hardware as required, propagation and harvesting.

i can now log file PH, EC, Res temp, Air temp, Humidity and am working on water level and co2. I can also control 10A contact relays using a i2c buss. I also thort it would be interesting to control the light intensity of a digital ballast

Will do a right up soon, just waiting on ec ph sensors, I was using a modified EC PH combo pen but the wire on the ph probe just broke off to close to probe to re solder


----------



## AdvancedNewbie (Nov 27, 2012)

> I basically want to limit the human interaction to the grow to monitoring plants and logs, tweaking the control parameters. Performing maintenance on systems/hardware as required, propagation and harvesting.


Amen Brotha. I wish I had the plumbing in my grow room to hook up some source/drain solenoid valves for auto-refill, then add some dosers/pumps to mix the nutrients, with a recirc pump....


----------



## labrat420 (Nov 27, 2012)

I was thinking of using a small pump on a relay to top off. u just need to have a safe gard to against an over flow, Im thinking of using a float switch wired in series with the 12v submersible pump. Oh and siphoning don&#8217;t let that happen either

You can pick up cheep peristaltic dosing pumps, they seem to be getting used in hobby aquariums a lot at the moment. Just 12v dc in chuck it on a relay or switch and away you go. although it could get a little pricey depending on how many you want as they cost $20-30 each. I just don&#8217;t want a glitch to empty the ph down or ferts it to my res, that would be bad. It would be pretty sweet to have a fully auto set up thow for ferts A&B, PH, peroxide and top off.


----------



## AdvancedNewbie (Nov 27, 2012)

How are you liking the Intel Chip?


----------



## GreenWilly (Dec 3, 2012)

Hey Newbie... 
I've got a question:
Why are you using DHT-11 and LM35 together? Why dont you use the DHT-11 for both (temperature and humidity)?
Is the accuracy not good enough?
If yes... I found a "DHT-22" today ---> http://www.adafruit.com/products/385 ... Better Accuracy in temperature.

Regards

Edit: and what about Wireless Socket's and a Transmitter instead of the Relays?


----------



## omnidrive (Dec 5, 2012)

*

hello, great job, congratulation,Do you have a complete parts list please?​




*


----------



## AdvancedNewbie (Dec 5, 2012)

GreenWilly said:


> Hey Newbie...
> I've got a question:
> Why are you using DHT-11 and LM35 together? Why dont you use the DHT-11 for both (temperature and humidity)?
> Is the accuracy not good enough?
> ...


Lol, the only reason I used the LM35 and DHT11 together is because it's cheaper. Plus I just wanted to buy a couple LM35's for use in other projects too. I thought about wireless sockets and then immediately thought I wouldn't want anybody 'accidently' controlling my relays.


----------



## AdvancedNewbie (Dec 5, 2012)

Parts List:

1x MEGA 2560 (eBay)
1x Raspberry Pi ($35 @ element14)
1x SSD-1963 Touchscreen (eBay)
1x DHT-11 Humidity Sensor (eBay)
1x LM35 Temperature Sensor (eBay)
1x Light Dependent Resistor (eBay)
2x Phidget pH module (robotshop.ca)
2x cheap BNC pH probe (eBay)
1x RSSDN-25A Solid State Relay (w/ zero-crossing) (eBay)
1x 4-Channel Relay Board for Arduino (eBay)
3x Dual 120V outlets
1x USB Wall Wart (or a 5V powersupply)
1x DIN Rail
1x 8-port DIN module 
1x 120V Electrical Wire - amperage rating based on what you will be powering
1x Machine Screws
2x 2-Row Headers (eg. 16x2) (eBay)
1x Prototyping Soldering Board (eBay)
1x 4-port ethernet port (eBay)
1x EAC 309 Power Jack
1x Project Case
1x Rocker Switch
1x Panel Mount Ethernet Jack
4x Ethernet Surface Mount Box (for sensor box's)
2x Spare USB Cable
1x Hook-up Wire (different colors)
10x 10Kohm resistors

This is just a rough list...


----------



## omnidrive (Dec 5, 2012)

think you, and have you a electrical schematics please ? sorry for the vocable i'm french !


----------



## AdvancedNewbie (Dec 8, 2012)

*A Very Big Update! Now with login/log out and change settings via web interface! Version 1.14 up now! *

*Check https://sourceforge.net/projects/envirocontrol/*


----------



## ArCaned (Dec 9, 2012)

Working in the computing industry I have often thought of doing something similar to this but never did. Good job, the application looks great, totally jealous 


+rep for the stonernerds


----------



## smigula (Dec 20, 2012)

hey I have a similar setup and I need to calibrate my pH probe, how did you do it?


----------



## AdvancedNewbie (Dec 21, 2012)

``````````

Available at your local hydroshop.

Test it against the probe, use excel or openoffice and plot with the analog value from your arduino vs the expected pH and come up with a formula for the conversion of the analog value to the actual pH.

Use the sketch available here: http://arduino.cc/en/Reference/analogRead


----------



## AdvancedNewbie (Dec 22, 2012)

I plan on making some sort of calibration interface soon enough to come up with the equation by itself, and gives instructions, but that'll have to wait.


----------



## wangyo (Dec 23, 2012)

If you're interested in arduino grow room controllers, you may want to check out www.harvestgeek.com Looks like it is aimed at hydroponic agriculture (ya right) but I could see it being used in grow rooms just as well.


----------



## smigula (Dec 24, 2012)

hey AdvancedNewbie your pm inbox is full so I can not send you any messages, but I just got the new raspberry pi and I was wondering how do you have it wired up to the Arduino to get sensor data?


----------



## AdvancedNewbie (Dec 25, 2012)

I've just been using the USB port right now, but I have a 5V to 3.3V Logic Converter that I'll be wiring up too so I don't have to use the big USB cable. I'd have to look at the Rasp Pi pinout, etc, etc. But I plan on doing this soon - I'll let you know when this happens - almost done my new hardware box - I'll post pics soon.


----------



## jujubee (Dec 29, 2012)

Looks good. I plan on doing something similar and ran across your project on sourceforge. Then I realized I had seen it here before, and even commented in the thread. I am pretty sure I will base my project on yours.

What distro are you using on the rasp pi?

You may want to look at the adafruit occidentalis distro if you are not using it. It has some useful stuff in it. One thing I want to do is add a real time clock.

http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2

*Version 0.2 updates (new!)


Truncated image - only 2.6G now to fit on any 4G card
raspi-config notice retained on boot
Removed persistant wlan0 entry
Password-change reminder on login
Added RTC and lm-sensors kernel module
Included kernel modules for: DS1307, AD626 I2C digipots, HMC6352, BMP085, ADS1015
New! Adafruit's PWM/Servo kernel module for easy PWM/Servo control on GPIO#18

Version 0.1 updates (still included)


Updated to Hexxeh firmware
I2C and hardware SPI support
I2C/SPI modules initialized on boot
sshd on boot
ssh keygen on first boot
runs avahi daemon (Bonjour client) and is called raspberrypi.local
Realtek RTL8188CUS wifi support
One wire support on GPIO #4 when loaded
*


----------



## AdvancedNewbie (Dec 29, 2012)

I have a DS1307 attached to the arduino that sends the time to the raspberry pi through serial. This would be a nice distro for attaching everything directly to the Pi, but I want the arduino to take care of everything because if the power goes off, it'll boot back up in about 2 seconds and start making decisions right away. This does look interesting though, thanks for the find


----------



## jujubee (Dec 30, 2012)

A couple links on Raspberry Pi GPIO serial to Arduino
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=22736
http://www.andremiller.net/content/raspberry-pi-and-arduino-via-gpio-uart


I want to have sensors on both the Arduino and Raspberry Pi. I know it seems silly, but I think they will both have RTCs in my project. I haven't used any sensors or an RTC on the Raspberry Pi yet. I want to try Dallas One Wire stuff. I plan on ordering some things in the next couple days. I need a bi-directional logic level converter, and I want a breakout board for the GPIO pins of the Raspberry Pi.

I was looking over the code. Highly awesome. I don't plan on using a touchscreen, and it looks like the code was written around that. I may do a 16x2 Character LCD and some buttons, but I think that would be more of a back up input/output method, or to get or set basic info, like an IP address. I would like to abstract the input method. I want to have the ability to edit a simple text file that has all of the configuration/timing information for the environmental controller. Use the Raspberry Pi as a front end for input in my project.

Being able to run the Arduino IDE on the Raspberry Pi, and reflash the Arduino is a pretty neat feature I would like to have in my project. 


code suggestions:


Maybe use "tmp" instead of "temp" when it stands for temporary and only use "temp" for temperature.


Maybe go to a multi-file sketch to make the code easier to search....maybe one tab for variables, different tabs for some of the major functions


Looks like a lot of eeprom writes, but maybe that is just how it looks in the code, and they don't get called much. I just did a quick look. I didn't try to figure out how many writes would happen in a day, but I would try to keep it under 100. IIRC, you get about 100,000 write/erase cycles.

Anyways, thanks for doing the heavy lifting.


----------



## AdvancedNewbie (Jan 1, 2013)

I have since took the LCD out of the project, and am focusing on web-based control right now. I have also added a camera to the page and that is working now too. The code is much easier to understand now. The EEPROM is only used incase of power outtage. You will only see those values being used upon startup, to reload all the setting values. I have edited the amount of datapoints and updated the python code. Serial communications are via UART now aswell. Thanks for your 'concerns' though... lol


----------



## omnidrive (Jan 4, 2013)

_Hello I would like to know if you could provide me the complete list of component as well as the shema electric mounting, thank you for your work is extraordinnaire.
my actual componement:
arduino mega 2650
rapsberry pi
8 relay module
3.2 touchscreen+arduino adaptator shield_


----------



## omnidrive (Jan 4, 2013)

sorry for my english i am french


----------



## AdvancedNewbie (Jan 4, 2013)

lol, No problem!

It's in the wiki on the download page. (http://sourceforge.net/p/envirocontrol/wiki/Parts List 16:1:15 10-12-2012/)

Keep in mind that I'm planning on scrapping my touchscreen interface... The web interface is coming along nicely


----------



## omnidrive (Jan 5, 2013)

ok thank you but have you got the electrical shematic please ?


----------



## Oghazybread (Jan 5, 2013)

I cant see the picture, would of like to see inside that brain of yours.


----------



## AdvancedNewbie (Jan 14, 2013)

Hey guys - been super busy... I should have an update soon and a schematic soon as well.


----------



## AdvancedNewbie (Jan 21, 2013)

Thanks guys... Somebody posted about selling their junk on here; I see the post is gone now. Probably slapped everybody's else's code together and is just trying to sell their junk. Beware and don't get ripped off.


----------



## Afistakis (Jan 23, 2013)

Sorry I haven't been around much recently. I have been super busy. I stopped by to see what's been happening, saw the ad and flagged it as spam. Problem solved! 

I really like your improvements! I wish I knew more php. I will probably end up making my web app with asp.net. 

Keep up the good work. I will someday contribute something, I hope...


----------



## AdvancedNewbie (Jan 23, 2013)

Hey, thanks Afistakis. I've added a streaming webcam to the site and fixed up some minor issues and fixed up the python script a bit, but wanted to get my sensor/setpoints 100% before releasing it. But that was 2 weeks back?... Harvested this past weekend too


----------



## miker10001 (Jan 24, 2013)

Cant wait for more info.. I was recently looking to upgrade to an aquarium controller for ph and dosing!! REPPED!!


----------



## wangyo (Jan 25, 2013)

miker10001 said:


> Cant wait for more info.. I was recently looking to upgrade to an aquarium controller for ph and dosing!! REPPED!!


Cool Project. I saw something similar awhile back and it looks like the kickstarter is live. Looks like a wireless grow room monitoring system with hydro support Putting my order in now. http://www.kickstarter.com/projects/2077260917/harvestgeek-brains-for-your-garden


----------



## miker10001 (Jan 25, 2013)

wangyo said:


> Cool Project. I saw something similar awhile back and it looks like the kickstarter is live. Looks like a wireless grow room monitoring system with hydro support Putting my order in now. http://www.kickstarter.com/projects/2077260917/harvestgeek-brains-for-your-garden


This Kickstarter project looks cool as well, but I would prefer to setup this Arduino system for a few bucks less..


----------



## AdvancedNewbie (Feb 13, 2013)

As posted on another thread (just to keep everybody updated):

*

I'm glad to see there's still some interest of a DIY nature. I've got some stuff to do this week, but when the weekend rolls around I should find myself with some time to post my updated code.. It's been updated awhile now, just never posted due to problems with my SD card for my Raspberry Pi. This leads me to think all of the read/writes my program has are causing my cards to fail (replaced one already). Luckly I have the images backed-up, and can just dump my custom image back on to the new SD card(s). I'm thinking of programming some SQL in, and maybe having it run on a remote server, and then having the arduino --> pi --> remote sql there by eleminating any read/write issues with the SD card, arranging the data in an organized manner, freeing up space on the SD, and hopefully speeding up the performance of the script on the Pi. I'm hoping to fixup this little unit I have on the go now, and maybe post a DIY tutorial or something. But it's pretty simple, I think a couple pics and a schematic might do all the talking. I was thinking of posting the image for the SD card somewhere too - but it's pretty big (any suggestions?). But this would allow you to dump the image on the SD and with no modifications, the Pi would be up and running listening for the Arduino. But that would be after I make the swap to SQL.​


*


----------



## srpompon (Feb 13, 2013)

one of my dreams!


----------



## luc77 (Feb 21, 2013)

Your project is looking nice, please post a img file for sd. Thanks!


----------



## AdvancedNewbie (Feb 22, 2013)

*HUGE release, LOTS of changes. Everything is logged to an SQL database now and the graphs are working along with setpoints.

Now called, "yieldbuddy"

v1.15 out

Edit: I will be posting the SD image soon on the project's new site: 'www.yieldbuddy.com'*


----------



## luc77 (Feb 23, 2013)

Wow... i can wait for the .img, Great update buddy!


----------



## AdvancedNewbie (Feb 23, 2013)

Thanks, wanted to let you guys know about the forum on the website as well - it's on yieldbuddy.com


----------



## budballer (Feb 24, 2013)

Woah this is a dream come true for me man. If there's a kickstarter going ill throw in. Thank you so much for this great contribution to the community!


----------



## AdvancedNewbie (Feb 25, 2013)

budballer said:


> Woah this is a dream come true for me man. If there's a kickstarter going ill throw in. Thank you so much for this great contribution to the community!


Thanks, it's been a journey. lol I might fire up a kickstarter in the future. This last version was a big leap (*version 1.15b*). It's getting easier and easier to setup as we go. With the SD image you can having a working setup on your pi in as long as it takes you to copy the image over to the SD.


----------



## omnidrive (Mar 3, 2013)

Hello, I thank you for yours for the great tools that you offer. I have to buy the following component:
-itead studio ITDB02-4.3
-elecfreaks V1.2
-Arduino mega 2650
-8 X relais board
-
But the touchscreen does not work properly, I use a elecfreacks v1.2. However, the calibration of the screen with utouch runs correctly. Please help me !
Can provide the electronical shèmatics and the picture of your project please
? I am a beginner. Thank you again for your work give you the happiness of small farmer (I use a high pressure aeroponics apollo 2 and the device is great for me 
(just a second timer for irrigation will Formidable 
Sorry for my englis i'm french !
Thanks thank you, thank you!


----------



## AdvancedNewbie (Mar 4, 2013)

I actually don't use the touch screen any more - just the web interface. But if you're interested in the touch screen, the old 'envirocontrol' version of this project uses the touch screen but is no where near as complete as the newest version. But atleast you can reference from that. The pin connections, the library and other information are available here: http://www.henningkarlsen.com/electronics/library.php?id=51 As for the second timer, I was thinking of making every relay capable of being controlled by timer; on/off/enabled. But everybody's setup's can be quite different from one another, and some modification to the code to make it suit your purpose might be needed.

As for the schematics, they are being finalized right now - once everything's verified, we should be able to make our own boards with all the components already connected to one another, or just view the schematic and use the parts you already have. But I will release this when it's done.


----------



## omnidrive (Mar 6, 2013)

I understand that you no longer use the touch screen but I do not have the internet endroi of my culture and I want to keep the screen. about actually I noticed that the switch was reversed on the sreen , the top is down and the bottom up, the middle stays in the middle, do you have any idea or it just come ???
I check the connection everything is ok 
I use a itdb02 4.3 + arduino mega +itdb02 mega shield, I do not colmprend !
forum if somebody can help me it will be nice Thanks !!!


----------



## RonSwanson (Mar 6, 2013)

This is the coolest thing I've ever seen.


----------



## AdvancedNewbie (Mar 6, 2013)

omnidrive said:


> I understand that you no longer use the touch screen but I do not have the internet endroi of my culture and I want to keep the screen. about actually I noticed that the switch was reversed on the sreen , the top is down and the bottom up, the middle stays in the middle, do you have any idea or it just come ???
> I check the connection everything is ok
> I use a itdb02 4.3 + arduino mega +itdb02 mega shield, I do not colmprend !
> forum if somebody can help me it will be nice Thanks !!!


I think I recall adding in a negative sign to make it opposite (the correct way) for my screen. If you fish around the envirocontrol code you'll find there's a function that gets the x/y coordinates of the touch and runs the raw values through a formula to convert to pixels. I may add a screen in the future, but it was hindering the progress of this project and I just wanted to get the functions written and done and the web interface allows for a quicker development time, in my opinion... But, I will probably bring it back later.


----------



## AdvancedNewbie (Mar 6, 2013)

RonSwanson said:


> This is the coolest thing I've ever seen.


Thank you.


----------



## omnidrive (Mar 8, 2013)




----------



## omnidrive (Mar 8, 2013)

Here is your beautiful work that I allowed myself to use in for my installation! What do you think? Thanks for the directions for the touch screen, can - you tell me the number of the relevant code line and what is the formula that you use exactly, I'm really newbie and screens I have still problem. Thank you very much.


----------



## AdvancedNewbie (Mar 8, 2013)

Wow, I wasn't expecting this. Congrats on getting the code up and running, that looks pretty professional. 


This is the touchscreen function to get x and y values:


> void getXY() {
> if (readxy == true) {
> x = 999;
> y = 999;
> ...



and under void setup() there's this:




> //LCD Initial setup
> myGLCD.InitLCD(LANDSCAPE);
> myGLCD.clrScr();
> 
> ...



^^^ See how I had to change myTouch.InitTouch to PORTRAIT instead of LANDSCAPE --> for some reason this corrected the x y values for me (they were inverted) This should get you up and running.


----------



## Voidling (Mar 14, 2013)

What is a quick cost estimate of getting one of these up and running?

I'll have to go back and look at the capabilities. It's love to be able to set the Times by a pc rather than mechanical timers


----------



## Voidling (Mar 14, 2013)

Sorry I somehow started in the middle of the thread. I guess just take out the cost of the touchscreen and everything else ids the same


----------



## ElginAgain (Mar 16, 2013)

AN you never cease to amaze me! I've been busy building my room, working on wiring, plumbing, insulation, etc. while you've been busy writing quite possibly the best grow control program in existence. I haven't had much time to work on my controller project, but I've been slowly gathering the hardware as funds allow. Seeing that you've switched to a Raspberry Pi based setup was very exciting, once I figured out what a Raspi was! Anyhow I went ahead and picked up a Raspi and after getting it booted up on Raspian, found that you've recently made yet another HUGE update. Needless to say I'm quite excited now to get all my pieces put together and working.

I can't begin to thank you enough for all the time and effort that you've put into this project. The new website is great, thanks for putting the image up there, that will make installation/setup a breeze. Once you get a wiring diagram up, it should be easy for anyone with some basic skills to be able to re-create this awesome system you've built.

When using those cheap 120v 10a relay boards from china it might be a good idea to use some fuses to keep everything safe and sound, in case a device attached to them shorts out or something causes the relays to be overloaded beyond their 10a rating. So I bought some used DIN rail mount fuse holders and distribution blocks, the type they use in professional PLC systems, specifically I bought the Allen-Bradley 1492-FB1C30 fuse holders and 1492-W10 distribution blocks. My plan is to use one 20amp circuit to power 10 relays, so there will be 20 distribution blocks divided equally across two DIN rails, one for power and one for neutral. Each rail will have the distro blocks bridged using 10-Position jumpers (Allen-Bradley 1492-CJ8-10). I figure that at the least it will be much cleaner and simpler to hook everything up using the distribution blocks for power and neutral, then a ground bus bar from an old circuit breaker panel to connect all the grounds. Various fuse sizes will be used depending on the amperage draw of the equipment being powered and the power rating of the relay. I'm thinking that without having fuses before the relays, there is a good chance that the devices hooked to them could overload the 10A relay to the 20a max of the circuit breaker, causing damage to the relays or in a worst case scenario fire.


----------



## ElginAgain (Mar 16, 2013)

@Omnidrive - Where can I get one of those cases? What is the name of the case or what is it supposed to be used for? I've been searching for a metal box for my controller, but that plastic one looks like it might work nicely.


----------



## omnidrive (Mar 17, 2013)

*hello, here is the reference of the electrical panel: waterproof DEBFLEX, 1 row, 12 modules + cable VGA 15 + derivation waterproof box (for sensors)*

http://www.leroymerlin.fr/v3/p/produits/electricite-domotique/tableau-electrique/tableaux-electriques-et-de-communication-l1308218925?source=native&nativeSource.id=732&criteriaFormShape=PLAIN&majorPriceStyle=SALEUNIT_PRICE&resultListShape=PLAIN&resultLimit=25&resultOffset=50&keyword=&facet=PRODUCT


----------



## omnidrive (Mar 17, 2013)




----------



## omnidrive (Mar 17, 2013)

If people want to associate with me to develop the touch interface it would be very useful to me. for those who do not have internet on site.
I think that must be continued to develop this part of the project. 
What do you think Advancednewbie ??? 
Is that you can allow the development project touch ? Course in close collaboration with you to this model. I do not allow myself to do it if you do not allow as much I respect your work as you know.
Thank you for everything


----------



## omnidrive (Mar 17, 2013)

look at the pictures at the bottom of the page is my setup  if you want advice please do not hesitate :

http://www.cannaweed.com/topic/48406-guide-aeroponie/


----------



## AdvancedNewbie (Mar 17, 2013)

Hey everybody, thanks for the support. Omni, your setup looks quite professional and well organized, I actually plan on bring back the touchscreen interface soon now that the web interface is coming along quite nicely. I've made a few changes on the Raspberry Pi to keep the wireless connection up at all times and to restart the yieldbuddy program if anything goes wrong - seems very failsafe now. Thanks for the kind words ElginAgain - the fuses are definitely a good idea. There are push-button fuses that you can reset and I'm looking into incorporating those. I've split up the Arduino code to make it much more organized and readable. I've added a CheckSetpoints() function where you can easily write conditions for any custom rules you may want to incorporate, after all - everybody's setup is different... I'm getting excited to bring back the touchscreen - it will mean this project will once again become a fully independent system and will only require the Raspberry Pi for the web interface. Now that the code is all split into separate files it should be eas(y/ier) to add the touchscreen code back into the project.

I've been pretty busy with life, but should find time mid next week to put some serious work into the code once again and progress this project even further. Omni, I plan on re-using the previous 'envirocontrol' touchscreen code and upgrading it a bit - if there's anything you want added or anything you have done yourself which warrants a look at, send me a PM and I'll be happy to collaborate ideas/code. I wish I got the ITDB02; it seems like 'the standard' touchscreen to use in Arduino projects and has the libraries built up already; I am able to use those libraries, but I have to modify the code a bit to get it working properly with my screen. So hopefully it shouldn't be an that big of an issue with your screen - If I recall correctly, the only differences were with the X/Y coordinates from the touch interface, so it should just be a matter of calibrating those formulas to obtain the correct X/Y values for the ITDB02 (as mentioned in a previous post).

If there's anything you guys want implemented just let me know! And thanks again for all the support


----------



## omnidrive (Mar 18, 2013)

Hello advancednewbie, Here is the diagram of PIN for ITDB02 - 4.3 Itead studio as well as the megashield ITDB02 V2.1: 


Pin d'Arduino
Avec ITDB02
 3V3
LED_A
RD
5V
VCC
 
GND
GND
 D22 (PA0)
DB8
-
D23 (PA1)
DB9
-
D24 (PA2)
DB10
-
D25 (PA3)
DB11
-
D26 (PA4)
DB12
-
D27 (AP5)
DB13
-
D28 (PA6)
DB14
-
D29 (AP7)
DB15
-
D37 (PC0)
DB0
-
D36 (PC1)
DB1
-
D35 (PC2)
DB2
-
D34 (PC3)
DB3
-
D33 (PC4)
DB4
-
D32 (PC5)
DB5
-
D31 (PC6)
DB6
-
D30 (PC7)
DB7
-
D41 (PG0)
RAZ
-
D40 (PG1)
CS
-
D39 (PG2)
WR
-
D38 (PD7)
RS
-
D50 (PB3)
SD_OUT
-
D51 (PB2)
SD_IN
-
D52 (PB1)
SD_CLK
-
D53 (PB0)
SD_CS
-
D6
D_CLK
-
D5
D_CS
-
D4
D_IN
-
D3
D_OUT
-
D2
D_IRQ


----------



## omnidrive (Mar 18, 2013)

for the power supply I use a variable voltage adapter trade as you'd guess the message in MP


----------



## omnidrive (Mar 18, 2013)

my sides I'm still stuck with the touchpad, no coordination toujour X / Y for the moment (I have a headache so I'm looking for: (Just a suggestion, I think that several factors should be able to use the timer to be activated and also I want to make a code change to adjust the Real time clock for the irrigation in second , as you know irrigation aeroponics high pressure is in seconds : 20 sec ON/5 Mins OFF is ideal. i'm looking currently have a code for irrigation more spaced to night 20sec On/ 20 mins OFF.
this is the contoleur for irrigation night and day: 7 GSE water timer
http://www.indoorgardens.fr/catalog/fr/programmateurs-timers-145/gse-water-timer-gse-7-1977.html

two irrigation regimes for one day and one night. The timer makes a difference just with a sensitive photocell integrated in the housing. The sensitivity of this cell is adjustable and adapts to disruptions light cycles (5 min " Changeover Time")
 *Impulse phase*
Off, 1s, 2s, 3s, 4s, 5s, 6s, 7s, 8s, 9s, 10s, 15s, 20s, 25s, 30s, 35s, 40s, 45s, 50s, 55s, 1min., 1.25min.,
1.5min., 1.75min., 2min., 2.25min., 2.5min., 2.75min., 3min., 3.25min., 3.5min., 3.75min., 4min., 4.25min.,
4.5min., 4.75min., 5min., 5.5min., 6min., 6.5min., 7min., 7.5min., 8min., 8.5min., 9min., 9.5min., 10min.,
11min., min., 12min., 13min., 14min., 15min., 16min., 17min., 18min., 19min., 20min.

*switch intervalles *
1s, 2s, 3s, 4s, 5s, 6s, 7s, 8s, 9s, 10s, 15s, 20s, 25s, 30s, 40s, 50s, 1min. 1.5min., 2min., 2.5min., 3min.,
3.5min., 4min., 4.5min., 5min., 6min., 7min., 8min. ,9min. ,10min., 15min., 20min., 25min., 30min., 35min.,
40min., 45min., 50min., 55min, 1h, 1.5h, 2h, 2.5h, 3h, 3.5h, 4h, 4.5h, 5h, 5.5h, 6h, 6.5h, 7h, 7.5h, 8h, 8.5h,
9h, 9.5h, 10h, 11h, 12h, 13h, 14h, 15h, 16h


Dimensions : 34x58x86mm
Poids : 86g
Volt: 230V / 50Hz
I max. = 2A
Protection class: IP20


----------



## omnidrive (Mar 18, 2013)

look this ElginAgain for the voltage protection: for my realisation i use 8 relais board shield for activate this power contactor 
its the best shematics for full protection and high power circuit.


----------



## omnidrive (Mar 18, 2013)

Advanced do you have search a co2 sensor ? look this it's a MG811 Co2 sensor


and for the phidget i recommande : *
Open Reefs Sensable, Part 2, http://www.openreefs.com/*



it's open source


----------



## omnidrive (Mar 18, 2013)

Advancednewbie if you need to code particular ask me I seek for you so you can concentrate on programming.
I take the time to help you in this task, my goal is to save you time and make your project operational in the best condition.


----------



## omnidrive (Mar 18, 2013)

Elginagain this is the adresse site for the switch protector:

http://www.selectronic.fr/fusible-rearmable-a-monter-sur-chassis.html


----------



## omnidrive (Mar 18, 2013)

for fan control i will be used this shematics with pwm 0-10 Volts control: http://www.astuces-pratiques.fr/electronique/variateur-de-vitesse-pour-moteur-secteur-230v-16a


----------



## omnidrive (Mar 18, 2013)

My configuration:

-System apollo 2 high pressure
- pump high pressure 102 psi/40 meter aquaking
- tank 50 Litres
- brewing pump 1500 liters/HR in the tank
- filter biological eheim 440 L/H + organic substrate and biomagix
- a water cooler Aquarium 500 L/H max
- regulator automatic PH aquamedic PH-201 with pump Peristaltic 1.5 L/H
- a water timer GSE 7
- 20µ + 5µ water filter for not clogged my nozzles
- a continuous PH and EC controller

climate:
-3 glass reflectors, ventilated 50 X 50 cms
- 3 HPS 400W sylvania
-1 Extractor for GSE reflectors with thermoregulation 330 m3/H max
- 1 Extractor 660 m3/H with built-in humidistat and check valve for the passive intractor
-1 humidity namibia with 1 mist maker 5 heads
- 1 Unis CO2 controller ecotechnics with bottle of 10 kilos

look the result of my last session :


----------



## AdvancedNewbie (Mar 18, 2013)

I have the same CO2 Sensor, but on a 5v breakout board with an adjustable pot. I wanted to incorporate a fan speed controller, that circuit looks like it might just do the trick with the diac. Those openreef BNC boards look pretty good as well. On the to-do list is the following:

-Third on/off timer --> Interval timer: hours/mins/seconds ON hours/mins/seconds OFF
-Enable/Disable setpoints ----> Auto/Manual control - relays
-System --> Change username/password
-System --> Update interval --> based on time not number of loops.
-System --> Display versions [serial] ( ie. Arduino Firmware Version: x.x.x, Python yieldbuddy Version: x.x.x, PHP yieldbuddy Version: x.x.x )
-System --> Event Log (use SQL and date/timestamp)
-Email Alerts (System --> Email Setpoints --> Email Alert Enable/Disable)
-TFT LCD Screen

So far I have done the following:

**Fixed set arduino time under system
**Fixed RTC setup sketch to use DS1307RTC library
**Split sketch into seperate files
**Fixed relay buttons on overview.php into a table
**Removed lighting and watering pages and put them on a new timers page

I will post the new code soon.


----------



## AdvancedNewbie (Mar 18, 2013)

Disregard this post.  Didn't notice the TRIAC in the circuit.


----------



## omnidrive (Mar 18, 2013)

look this it's a fan thermocontrole of power supply of Pc, is good for the inline fan but this electrical tension is 0-12 v



My choice for the co2 sensor is an NDir


----------



## omnidrive (Mar 18, 2013)

or this co2 sensor 




Place of Origin:China (Mainland)Brand Name:WINSENModel Number:MH-Z14Usage:Gas SensorTheory:Resistance SensorOutput:Digital SensorType of Sensor:infra-red (NDIR) principalTarget Gas:CO2Detection Range:0~100%vol CH4 0~50%vol CO2 


[h=5]Specifications[/h]
Infrared co2 sensor electronic component made up of mature infrared absorptiongas detection technology, precision optics design





1. Technical specification:


Detection range 0~10000ppm(optional)Resolution ratio 5ppm(0~2000ppm)10ppm(2000~5000ppm)20ppm(5000~10000ppm)Accuracy±50ppm±5%Repeatability ±30ppmResponsible time<30SWarm-up time 3minWorking temprature 0~50°CWorking humidity 0%~90%RH(No condensation)Storage temprature -20~60°CWorking voltage 4~6VWorking currentMax current <100mA,Average current <50mAUsingage >5year


----------



## omnidrive (Mar 18, 2013)

do you have receipt my mp mail advancednewbie ???

look this page:

https://code.google.com/p/jarduino-aquarium-controller/downloads/list

there anything that you could help your project , download the version 1.1 is free


----------



## omnidrive (Mar 24, 2013)




----------



## omnidrive (Mar 24, 2013)

New Design !!!
what do you think my friend ?
Advanced do you have information for the coordinate of my itdb02 4.3 ?
thank-you !


----------



## omnidrive (Mar 24, 2013)

Advanced you are the best


----------



## AdvancedNewbie (Mar 24, 2013)

omnidrive said:


> New Design !!!
> what do you think my friend ?
> Advanced do you have information for the coordinate of my itdb02 4.3 ?
> thank-you !


Looks awesome in that case. By 'coordinates' do you mean the pinout?



omnidrive said:


> Advanced you are the best


I know, right? lol... Working on bring back the touchscreen and email alerts right now! Thinking I'll post what I've done already first though, as sort of a 'checkpoint'.


----------



## syphex (Mar 24, 2013)

This was exactly my idea. I wanted to use the same arduino board to measure temp/humidity/ppm/ph/co2, even perstaltic pumps to make my own dosing system. Even wanted to use heat equations and extensive data logging, such as nutrient use vs co2, temperature etc. I wanted to have it so that if the temperature outside is reasonably cooler than inside, and wasent rising too quickly to use co2, otherwise it would use the fan to ventilate, but if it was nearly as hot outside as inside I wanted it to go full blast co2 and use AC. This was ment to keep as much co2 as possible and only cool when required, saving AC by only using it when its too hot outside for ventilation anyway.

I ordered the arduino and got it to display temperature/humidity, but I have a massive problem! The god damn thing keeps freezing, I think its something to do with my read_DHT function. Have u had any similar problems? Here is the code I used: http://weather--station.googlecode.com/svn-history/r3/trunk/WeatherStation.pde from THIS website http://www.hobbyist.co.nz/?q=weather-station

Please its so frustrating... all I want to do is it display temp and humidity WITHOUT FREEZING and then start working on some basic temperature control.


----------



## AdvancedNewbie (Mar 24, 2013)

Use the DHT library and code found here: http://playground.arduino.cc/Main/DHTLib


----------



## omnidrive (Mar 25, 2013)

my probleme is the touch of the touchpanel isn't cooredinate


----------



## omnidrive (Mar 25, 2013)

advanced look this : https://github.com/FernandoGarcia/Ferduino_French/tree/master/Circuitos auxiliares
: https://github.com/FernandoGarcia


----------



## AdvancedNewbie (Mar 25, 2013)

Looks like he has most of the features for the interface figured out.


----------



## AdvancedNewbie (Mar 25, 2013)

I'm implementing email alerts right now, I'll be working on the LCD soon.


----------



## omnidrive (Mar 25, 2013)

advanced look your mailbox !


----------



## omnidrive (Mar 25, 2013)

I do not have to send you the file by email advancednewbie  Your e-mail address is invalid 
contact me in private for send the file of *Sebduino
*
http://www.ilot-recif.fr/portal.php

*Sebduino *can manage: 

- Management of 4 independent lines of lights
- Possibility of gradual ignition and extinction for each of these lines
- a skimmer delay when power failure with adjustable time delay
- Manual for the on / off of the skimmer, pump lift, pumps brews, oscillators
- 2 oscillators with management for each angle setting start and end of rotation and speed
- Management of 8 dosing pumps with adjustable time for each dosing pumps
- Display the temperature of the tank and the room - Getting Started The fan tray set temperature
- Display PH tray
- Control solenoid according to a set PH
- Viewing time and date 
- Ability to rename lighting lines (6 character max)

he use ITDB02 4.3 , bitmap and RAW picture it' s very beautyfull !
But the best for me it's the 8 dosing pump controle and the parameter of the water ,it's very interessting !
good luck


----------



## AdvancedNewbie (Mar 25, 2013)

I got your email (with attachments)... I'll take a look soon.


----------



## omnidrive (Mar 29, 2013)

hello advancednewbie !
tell me your tft lcd screen reference please


----------



## AdvancedNewbie (Mar 29, 2013)

omnidrive said:


> hello advancednewbie !
> tell me your tft lcd screen reference please


Reference? I'm only using the information found on the UTFT library site at: http://www.henningkarlsen.com/electronics/library.php?id=51

Oh and I posted* yieldbuddy v1.16* yesterday.


----------



## omnidrive (Mar 29, 2013)

hello world 
New information for ITDB02 SSD1963-800

Touch does work with Henning's UTouch library. The X and Y are transposed and only scaled to a 320 x 240 display. The transposing is easy:
y = myTouch.getX();
x = myTouch.getY();
The scaling just takes a little bit of coding to fix, like so (from Henning's Quickdraw example):
myGLCD.drawPixel ((x*800)/240, (y*480)/320);
It's probably trivial to fix the library but for me ITDB02 SSD1963-480 ( 4.3") is dead for this moment  it's beyond me.

Source : http://imall.iteadstudio.com/display/tft-lcm/im120419008.html

bye !


----------



## omnidrive (Mar 29, 2013)

Very beautifull code AdvancedNewbie ! Congratulations but My Rapsberry is dead at this time, fucking life


----------



## AdvancedNewbie (Mar 29, 2013)

Nice scaling formulas. I was doing something similar, but that looks like it'd be more exact. If you were experimenting with the old envirocontrol on your Pi your SD card is probably dead! lol. Good thing they're like $2/GB now. And yeaaaas, I hope you enjoy the new easier to understand and partitioned code.


----------



## omnidrive (Mar 29, 2013)

yes the partition is very clear, do you have looking Sebduino ? is very interesting
for my touchscren is bad, i have not solution at this time !
oh very beautiful online site  but my intervention it's here for me  the ultimate source


----------



## omnidrive (Mar 29, 2013)

the usb ports is dead on my rapsberry , el puta madré grrrrrr !!!!


----------



## AdvancedNewbie (Mar 30, 2013)

omnidrive said:


> the usb ports is dead on my rapsberry , el puta madré grrrrrr !!!!


Never fun.  Updated screenshots - now you can see what you're missing... lol


----------



## omnidrive (Mar 31, 2013)

you want me dead Advanced ? 
I'm really disappointed me the raspberry is dropped ;
( and after that I saw the code I already Envoy potential but this level c is art my friend


----------



## AdvancedNewbie (Mar 31, 2013)

lol... It might seem that way, but I'm just hoping you find a bucket full of Raspberries! Now that it's all split up it might be considered 'art', but before? Maybe a Picasso?


----------



## zVice (Mar 31, 2013)

is there a usb sensor available that will do temp and humidity and can connect to a raspberry?

apologies if this has been answered/covered.

tia

EDIT: found these, but the price for the temp/humid/pressure seems a bit excessive
also can't source them locally (uk) but think they may ship here

http://www.yoctopuce.com/EN/products/category/usb-sensors

its quite sweet that they have a lux sensor, your could get the system to let you know when your bulbs are burning out.


----------



## AdvancedNewbie (Mar 31, 2013)

zVice said:


> is there a usb sensor available that will do temp and humidity and can connect to a raspberry?
> 
> apologies if this has been answered/covered.
> 
> ...


The Raspberry Pi only controls the web interface, the Arduino is what the sensors connect to. I use a DHT11 and a LM35 along with a simple LDR <--- all three under $3


----------



## zVice (Mar 31, 2013)

all I'm really after is a simple system where the temp/humidity can be checked remotely
minimum effort, and reasonable cost

don't really want to be wiring shit up and fiddling with chips and shit

is there a similar plug and play system, all the one's I've found that you can buy just seem a bit shit.

props to your work so far though on the yieldbuddy dude, it looks insane




AdvancedNewbie said:


> The Raspberry Pi only controls the web interface, the Arduino is what the sensors connect to. I use a DHT11 and a LM35 along with a simple LDR <--- all three under $3


----------



## omnidrive (Apr 2, 2013)

Advancednewbie do you have new information or solution for my itdb02 4_3 ? i have not new information, it's very hard for me because I can not find user


----------



## AdvancedNewbie (Apr 2, 2013)

omnidrive said:


> Advancednewbie do you have new information or solution for my itdb02 4_3 ? i have not new information, it's very hard for me because I can not find user


No worries, I'm on it. Just had to get the new update out and now it's time for the touchscreen interface.


----------



## AdvancedNewbie (Apr 2, 2013)

omnidrive said:


> hello world
> New information for ITDB02 SSD1963-800
> 
> Touch does work with Henning's UTouch library. The X and Y are transposed and only scaled to a 320 x 240 display. The transposing is easy:
> ...


He shouldn't be doing it like this... lol
Really, it should be like so:



> screen_width = 800;
> screen_height = 480
> y = myTouch.getX();
> y =  (y*screen_height)/320;
> ...


This way, you could pass x and y directly to *any *myGLCD sub-function without having to convert the values each time within the function call itself.


----------



## omnidrive (Apr 3, 2013)

thank you very much adavanced, question: what is the number of the line for includ your code please ?


----------



## AdvancedNewbie (Apr 3, 2013)

Which line are you referring to?


----------



## omnidrive (Apr 4, 2013)

excuse me advanced it's an error of my part, sorry


----------



## AdvancedNewbie (Apr 4, 2013)

lol No problem. 300 posts... woohoo


----------



## Sushione (Apr 12, 2013)

Can't wait for your Arduino's hardware schema/howto ! I really want to build my own controller.
Coolest project on earth ! 

Peace


----------



## Voidling (Apr 13, 2013)

Could a similar system be made with the raspberry or other PC monitor multiple ones of these and email alerts?


----------



## AdvancedNewbie (Apr 15, 2013)

Voidling said:


> Could a similar system be made with the raspberry or other PC monitor multiple ones of these and email alerts?


Right now it's made to update the database in separate tables; 'yieldbuddy-0' 'yieldbuddy-1' 'yieldbuddy-2' etc... (ie. for three yieldbuddy's) Nothing has been made to monitor all 'three' on one page, but you could generate graphs from the database comparing values from all 'three'. Also, each has it's own web interface, so you could just login to each one separately. As for the email alerts, you can create an email filter and put the alerts from each separate one in their own folder - that way you'd know right away which one the alert was coming from.


----------



## automated (Apr 15, 2013)

Voidling said:


> Could a similar system be made with the raspberry or other PC monitor multiple ones of these and email alerts?




definately yes 

actually .. I stuffed openssl in it (https connection) and I can keep tabs with my mobile <_<

some info in my grow journal (small screenie too)


----------



## Voidling (Apr 15, 2013)

Good to know. Thank you.


----------



## Voidling (Apr 15, 2013)

Won't let new rep you again advanced


----------



## Sushione (Apr 16, 2013)

Sorry if this isn't the right place but have you heard about UDOO, a new kickstarter project.
Interresting : it's an raspberry/arduino fusion, looks pretty cool, even more for my future home made controller 

Peace


----------



## AdvancedNewbie (Apr 16, 2013)

Sushione said:


> Sorry if this isn't the right place but have you heard about UDOO, a new kickstarter project.
> Interresting : it's an raspberry/arduino fusion, looks pretty cool, even more for my future home made controller
> 
> Peace


Looks pretty good.


----------



## AdvancedNewbie (May 5, 2013)

*yieldbuddy v1.17a released*


----------



## bicit (Jun 16, 2013)

My apologies if this has been covered, but what sensor would work best for measuring the amount of co2 in a given space?


----------



## Lite Brite (Jul 2, 2013)

Well since no one has given you an answer to your co2 question, try this one:

http://www.co2meter.com/collections/co2-sensors/products/k-30-co2-sensor-module

Connecting it is fairly simple using I2C. as well all the hardware and communication specs are very well documented.


----------



## Lite Brite (Jul 2, 2013)

BTW AN, nice project you got goin here. 

Not sure if you know this or not but the Arduino mega, duo, & decimillia will run at 3.3v when you apply 5v power using the barrel connector.
If the 5V electronics connected to the arduino play nice at 3.3v there's no need for a level converter circuit between the arduino and the pi.
Only probs I've run into doiing this was LCD's dont like 3.3v operation. 
Alot of sensors & relays work well at 3.3v but I had a few sensors I had to feed 5v to, their output to the arduino is 5V but the nice thing is the arduinos pins are still 5V tolerant.
The other thing is you must disconnect the 3.3v comms to the pi before you plug in a usb cable to the arduino or you can just simply modify a usb cable by cutting the red wire so the only supply voltage to the arduino is through the barrel connector otherwise you risk damaging the uart on the pi because the arduino will be running at 5v.


----------



## notacrook (Dec 4, 2013)

I thought I was the only one working on something like this! Very cool. I'm designing a coco coir grow using General Organics line of nutrients. Due to time constraints from the many jobs I have, I needed something that would automate a great deal of growing. I'm still in the code development, but its coming along at a very fast pace. Once you get an RTC added, its very easy to use to trigger readings, count days, and to know exactly what area of the cycle you are at. I checked out your yieldbuddy site and I am envious of the web integration. I have a Raspberry Pi was well, but I think its going to take me a while to work on that. For the time being I'm just going to keep the Garduino plugged into a windows machine via USB and remote desktop into it. With the way this is going, unless there is an issue, which I should be able to see via the data from the serial port, or via a webcam, I should only have to go up once every two weeks to fill up the water in the barrels. Wish me luck!


----------



## notacrook (Dec 4, 2013)

Went and breezed through a bit of your code. Didn't think about using EEPROM. My first step is to get this thing working and responding to sensor data, but I definitely think I'm going to have to start playing with the rasppi shortly afterwords and see if I can't modify your code to work with my setup. Very nice indeed.


----------



## Voidling (Dec 4, 2013)

I'm waiting on my raspberry pi to be delivered. Unfortunately it's not going for this grow.


----------



## Abiqua (Dec 5, 2013)

bump.....ive been waiting for this thread for 3 years, don't know how I missed it...


----------



## Voidling (Dec 5, 2013)

I'm not sure what happened to riu but seems like everyone I know abandoned shop here at the same time. Some I still haven't heard back from.


----------



## AdvancedNewbie (Dec 18, 2013)

Hey guys, it's me! I've sort of moved the conversation to www.yieldbuddy.com and plan on working on this project again pretty quick. It's been a busy 8 months!


----------



## Mr. Kitong (Nov 18, 2015)

Hi,
Can you me AdvancedNewbie in my project, in creating a program using VB10 that monitor the pH level, water level, air and water temperature. And control the ON or OFF of sprinkler and water pumps?
Thank you..


----------



## saiyaneye (Mar 8, 2016)

BUMP

Starting to read about this.


----------

