Arduino Controlled Grow and PC Program - Work In Progress

AdvancedNewbie

Well-Known Member
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

Member
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

Member
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.
 
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

Active Member
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

Well-Known Member
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

Well-Known Member
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

Active Member

  • 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

Member
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

Active Member
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
 
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 Capture.jpgBut 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

Well-Known Member
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

Well-Known Member
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! :D
 

CocaLeaf

Member
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

Well-Known Member
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

Member
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

Well-Known Member
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

Member
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 :weed:

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?
 
Top