420 Magazine Background

Arduinos In The Grow Room: My Project

odam2k

Well-Known Member
No go on the certificates, perhaps it's because I do not have a fully qualified domain name for this machine?

In any case, it's only available inside my network anyhow, so I'll use it without being secure... Either I'll figure this out eventually, or once I get the app working and want remote access, I'll move it to their server.

You are only charged when you add widgets, which I'm sure I'll do lots of while learning Blynk, on my own server :)

So, onward with Blynk....

and my phone battery is dead... <sigh> nap time?
 

TheFertilizer

Well-Known Member
Whoa, cool post.

I was looking around on Amazon and found one of those moisture probes you posted up on the first page, was wondering how it was used. I've got a pretty good background in software design, so I have heard of Arduino in my C research, but I don't really have much electrical knowledge. How much do you need to know about circuitry to do this, and do you know of a good place to learn that? I have some experience splicing car wires, but nothing in the least bit complicated.

One thing I wanted to do lately that I think you might be able to accomplish with your setup is to control the exhaust fan according to temperature and humidity. I have a termostat and a humidistat which have a temperature and humidity probe, and they either turn on or turn off power to an AC adapater depending on the settings. I wanted to try to figure out how to get the fan to turn on when humidity was over 60% OR if it got too hot in the tent ( say over 85F ) and realized what I wanted was too sophisticated for what I had.

One thing that I think that would be cool to track and control with the help of software is Vapor Pressure Defecit. Since it's a relationship between humidity and temperature, it's often a little tricky to keep it in the "optimal" range. For example, you can't just keep it at 65% all the time, because in one temperature range that might not be optimal VPD. With software like yours, you could target the proper humidity range according to the current temperature and track/control VPD perfectly.
 

odam2k

Well-Known Member
Whoa, cool post.

I was looking around on Amazon and found one of those moisture probes you posted up on the first page, was wondering how it was used. I've got a pretty good background in software design, so I have heard of Arduino in my C research, but I don't really have much electrical knowledge. How much do you need to know about circuitry to do this, and do you know of a good place to learn that? I have some experience splicing car wires, but nothing in the least bit complicated.
Welcome to the thread... Great input....

Getting started can be so daunting, I had a bunch of Arduino stuff sitting in a drawer for years and years before I finally kicked myself in the pants and decided to make use of it... If you understand the power of writing your own software, then you will have no problem figuring out the rest... I've always been amazed, that as a programmer, I can make a computer (or Arduino) do anything I want, limited only by my imagination, and time invested...

I was in about the same boat as you when I started this project, I had experience with wiring R/C planes, boats, helicopters, multicopters, etc mainly batteries etc, but no real "electronics" knowledge. I keep a handy reference on my phone to look up resistor codes etc :) I tend to learn only what I need to know to accomplish a task, so that means just tackling one thing at a time, and not rushing... well, not rushing too much :) If you follow this thread, you'll see most of my hurdles. I also spend a lot of time googling stuff, like general electronics tutorials and how specific components work. Download datasheets for everything, and read them, even if you don't understand them eyet... Instructables.com is a great place to learn too.... If you are going to work with sensors on an arduino, learn about voltage dividers :)


One thing I wanted to do lately that I think you might be able to accomplish with your setup is to control the exhaust fan according to temperature and humidity. I have a termostat and a humidistat which have a temperature and humidity probe, and they either turn on or turn off power to an AC adapater depending on the settings. I wanted to try to figure out how to get the fan to turn on when humidity was over 60% OR if it got too hot in the tent ( say over 85F ) and realized what I wanted was too sophisticated for what I had.
I do this with the Humidity dome on my Aqua Cloner. It's on a much smaller scale than your idea, but basically a bigger fan, and it will work. I will be controlling a box fan in the window, and in summer, an air conditioner in it's place... I just have to open and close the window by hand now, I don't have a servo strong enough to do that :) I have a couple posts about trying to get this working, I finally ended up using a DC Brushed Motor Controller rather than a relay. This gave me the ability to control the speed of the fan.

One thing that I think that would be cool to track and control with the help of software is Vapor Pressure Defecit. Since it's a relationship between humidity and temperature, it's often a little tricky to keep it in the "optimal" range. For example, you can't just keep it at 65% all the time, because in one temperature range that might not be optimal VPD. With software like yours, you could target the proper humidity range according to the current temperature and track/control VPD perfectly.
Wow, getting picky :) I suppose it would be much like the above, but account for both temp and humidity. Would this be heat index, the third measurement on a DHT-22 sensor? It's measured as a temperature, not %
If it is the same thing, then basically we could already do that :)

My grow room is just a spare bedroom, well, half of the room... so absolute atmospheric control is out of the question, I'm lucky to keep within temp range... I'll get there though...

Good luck with your project!
 

TheFertilizer

Well-Known Member
Welcome to the thread... Great input....

Wow, getting picky :) I suppose it would be much like the above, but account for both temp and humidity. Would this be heat index, the third measurement on a DHT-22 sensor? It's measured as a temperature, not %
If it is the same thing, then basically we could already do that :)

My grow room is just a spare bedroom, well, half of the room... so absolute atmospheric control is out of the question, I'm lucky to keep within temp range... I'll get there though...
Ha well it's mostly curiosity. I've read a lot about it and I wonder how much it it really affects certain things, but it's not really easy to tell that unless you're able to track it. I don't think Head Index is the same thing. It's a rather complicated formula to calculate VPD, most people follow pre-made charts that are out there on Google. Really you could just use the separate humidity and temperature probe readings, logging them to SQL and have a VPD value calculated from them.

I have a similar setup, so I know what you mean about it being hard to control the temp ranges. Hey I didn't notice you mention what kind of light you're using? I've been wanting to get a DIY LED, there's a lot of people who have made them here and have really good success with them. I have been running HID for a while but it's really hard to cool them without a lot of air conditioning. I feel like having the electrical knowledge would allow making a DIY LED pretty easily.

I'm on a disability too so I know what you mean with a lot of free time to learn new things. Kind of makes it difficult for me to start and complete things though, so trying out new and different things is pretty difficult as well. Figuring out how to automate things would be great, but I also wonder how much improving environment would increase my yield. Environment including light, air, etc. Long story short I'm not really sure I've really got a project in mind other than "Grow more, work less" :p

But this is a pretty cool thread I'll definitely have to bookmark and keep for later. Right now all my automation is just done on timer, so I think a nice basic "first step" would be to figure out how to use those moisture probes.

I'm gonna go back and read through the thread but wanted to say hi and subscribe.
 

odam2k

Well-Known Member
I'm on a disability too so I know what you mean with a lot of free time to learn new things. Kind of makes it difficult for me to start and complete things though, so trying out new and different things is pretty difficult as well. Figuring out how to automate things would be great, but I also wonder how much improving environment would increase my yield. Environment including light, air, etc. Long story short I'm not really sure I've really got a project in mind other than "Grow more, work less" :p

But this is a pretty cool thread I'll definitely have to bookmark and keep for later. Right now all my automation is just done on timer, so I think a nice basic "first step" would be to figure out how to use those moisture probes.

I'm gonna go back and read through the thread but wanted to say hi and subscribe.
i started with the moisture probes because in the summer, we like to take off for a couple days whenever we're up to it,. and I was always worried about my plants, so we didn't really do much last year. It's not like we're world travellers or anything, but we like to get away car camping during the week when the campgrounds aren't busy...

I'm not sure if any of what I'm doing actually increases my yield, so much as gives me something to do while I'm waiting for it to grow :) I guess anything that keeps our attention focused on the plants is good for them.

Grab an Arduino, a couple galvanized nails, some wire, and a 10K resistor, and you've got a soil monitoring module... Seriously, go with the nails over those cheap little moisture probes, or go with the capacitive moisture sensors, they won't corrode apparently. Pick an Arduino with WiFi and it can update a MySql database on a local machine. There are other ways to accomplish what I'm doing, my way is just one of many, maybe not the best, but it's working so far.
 

odam2k

Well-Known Member
If you Blink, you're gonna miss it!

But if you Blynk, you're gonna love it :)

So, I managed to get my local Blynk Server up and running... Still have to get certificates working properly...

I loaded the Blynk Library onto my development machine

I added the Blynk code/library to my ESP8266 based maintenance server, the one which simply performs database maintenance, plant watering, etc.

I created a Blynk App on my phone, all it does is show the uptime of the ESP8266, updated every second...

It works!

I'm almost giddy with the possibilities!
 

odam2k

Well-Known Member
I've only played with a couple widgets so far, a Value Display, terminal, and Notifications.

Value display is updated every second with uptime (how many seconds since last reboot of esp8266)

terminal I used to display a list of plants... just playing... note that you can send back to your sketch using terminal... it could ask you a question, and you answer for instance.... just like Serial but via Blynk...

Notifications - now THIS is the important one... Pop up notifications on my phone, sent from the esp when, for example, it cannot contact the sql database, or plants need to be watered, or even when the esp goes offline...

I really mean it, the possibilities are endless here...

I'm not sure I'll be able to sleep....
 

odam2k

Well-Known Member
When I designed things related to sensors and modules, I set the main "timing" of sensor scans based on a signle setting for a module. In other words, Module 01 scans ALL of its sensors every 30 minutes. Module 02 could have a different schedule, but, they are both set to 30 minutes.

In addition, I designed it so that each sensor could have a trigger time, and actually wrote the code for it. It's never been used...

Now, with Blynk, it allows the App (on the smartphone) to directly read and write analog and digital pins on the connected board. In the case of my modules, that's an ESP8266 connected to a Mega 2560, with all the sensors on the Mega 2560, NOT on the ESP where Blynk can access them :(

Have no fear, because I can configure the sensor to scan at whatever interval I want, and when it does, it will send the sensorId and raw value to the ESP8266 using my XML based Serial Communication, and then the ESP8266 can send it to the Blynk Server. If the Server wants to request a sensor read, then it does so to the ESP, which forwards the request via XML to the Mega 2560, and it replies, like the previous example.

Might be worth me adding a new field for each sensor, BlynkVirtualPin. Every sensor could have its own virtual pin, since some may not have physical pins, like i2c sensors...

So really, I don't have a lot of changes to make...

Wow, things are moving so fast, my head is spinning...

BTW, I posted a while back about wanting to have a camera in the veg tent... Well, Blynk does that too! :)
 

odam2k

Well-Known Member
I have Blynk connected to, and receiving data from two different units. One is the database maintenance server, an ESP8266 ESP-01 module, and the other is Module 3, which is the ESP8266 on board the Mega 2560. I spent a frustrating couple hours trying to get the second device going, turns out I forgot a couple lines of IMPORTANT code... <sigh>

All is good now, I can go ahead and do the XML communications between the 2560 and 8266, giving Blynk live access to all sensors... I have added a new field to sensors, so every sensor now has a customizable Virtual Pin, unique to the module which hosts the sensor. Blynk supports 255 Virtual Pins on an ESP8266, that's a lot of sensors on one module!

Soon I'll have a live display on my phone where I can see the light level (are lights on or off?), room temp/humidity, outside Air temp, plus any other sensors I want...
 

odam2k

Well-Known Member
Interesting... My lights come on around 4:15am, this is the graph from my dual level moisture sensor for the past 24 hours...
Capture.JPG


When the lights come on, I could understand the top level of soil drying out, slowly, but the bottom level getting more moist? And the opposite happens at just before 5 pm last night, when the lights went out...

Does the plant move water down through its root back into the soil? How is this happening? Just curious...
 

odam2k

Well-Known Member
Thinking out loud...

Back to the i2c Sensors, specifically my DIY one(s) The Dual Level Soil Moisture Sensor is an i2c device, it has an attached Arduino Pro/Mini in i2c slave mode.

It's a pain when I add a new sensor because I have to tell the system WHERE I plugged it in, and WHERE I put the sensor.

So, why can't each module scan it's i2c bus, try to connect to each valid i2c address. If it can connect, then that means an i2c device exists at that address, but it could be an LCD Screen, RTC, almost anything... So, if it finds something, then it does a "Sensor ID" query, just something only we know about so my sensors can respond with GBW### where ### is the SensorID (which is the same as the i2c address)

Now the module knows exactly which i2c sensors are connected, and can update the database in real time. This doesn't tell it WHERE the sensor is located, but it saves one step... Maybe if I had enough probes so one stayed with each plot, even when not used....

I'm putting this here kinda like a todo list when time permits and I've run out of other fun things to play with :)
 

Camaro1691

Well-Known Member
I never thought of that when I bought mine. Mine has an On/Off rocker switch plus a rotary knob for power level. It was a cheap one, so I don't suspect it has any type of remote capability, but I'll have a look when the lights come on in the morning.

I'm thinking maybe it's possible to use pull-up resistors on the relay signal line so that when the arduino reboots, and the logic level of the pin fluctuates (goes low until booting completes), a resistor tying to 5v should hold the level high, so when the Arduino reboots, the lights won't flicker off then on quickly, That can't be good for them. Also, now you have a problem, if the Arduino reboots at night, the pullup resistor is going to turn the lights on during a reboot, and while they won't light immediately, it still can't be good for them.

Been thinking about it, and it looks like putting a small mcu in charge of the relay is the way to go, and operate it via i2c so it's completely decoupled from the main Sensor Modules, at least in regards to reboots.

If a Pro/Mini controls the lights, then the Mega 2560 Sensor Modules, with their built in photoresistors can double check to make sure the lights are either on or off when they are supposed to be.
I haven’t gotten thru this whole journal yet to see what the answer may be as I’m only up to page 14 in reading soo far, but since your lights have rocker switches in them to turn the lights on wouldn’t it be easier and have less interference to have your relays toggling the rocker switch rather than the actual 110 wire going to the lights, you guys have me stumped on the coding side of things but I love messing with wires, aside from being a full time auto transmission installer I install and mess with car stereos on the side soo I understand dealing with electrical noise espically when combining different current types. Second question would be do you twist your wires when you run them? It does add a little bit of length to your run of wire but helps eliminate noise.. speedometers in cars can go bonkers if the wires going to the sensors aren’t twisted.. easiest way to acieve this is sticking the end of the wires in a drill and slowly turning it to get a slight twist not tight.. just food for the thought.. anyways, love the project and seeing what has been done with it and will continue reading and will be watching for more once I get to current posts haha
 

Camaro1691

Well-Known Member
Hey, that brings me to the next mini-project!

I need a way for the system to get ahold of me... Not passively when I go look at a web page, but actively. I have the need for a notification system...

Right now, the system is capable of Auto Watering plants, but is limited the number of pumps I have, so as we get going, the system needs to be able to notify me to water the others... Not too time critical, I suppose as long as I get the message within a couple hours...

When water in the reservoir for the watering pumps goes low, it needs to notify me, again, a couple hours, probably not too critical....

If there is a problem with the lights, a single isolated incident wouldn't be too critical, but any time the lights go on or off unnecessarily is probably hard on the bulbs, and will screw up your flowering plants if the lights keep coming on when they aren't supposed to...

Notification is required when there is a problem with the system, or Sensors malfunction and stop reporting valid data... Well, again, probably not too critical.

Other options include sending alerts to my phone or computer...

The problem is, the number one reason I have any issues is because of WiFi network problems. If the network is down, how would it contact my phone or computer? Oh I'm sure there's a way, but at what cost, in parts AND time...

So, again., I don't really have the "requirement" to support the cost of implementing something bulletproof...

Maybe just some "status" icons on the Plot Map page, the one I usually leave in my browser...

So there it is, my next Mini Project.... yep, it IS mini... :)
Do you have a phone that’s not being used and is still activated and has bluetooth? You could have your module send a message or command to the phone and in turn the phone automatically rerouts the message to you? Your a software guy I’m sure you could figure that part of it out
 

odam2k

Well-Known Member
Welcome @Camaro1691 Hope you find the thread informative, and entertaining :)

I haven’t gotten thru this whole journal yet to see what the answer may be as I’m only up to page 14 in reading soo far, but since your lights have rocker switches in them to turn the lights on wouldn’t it be easier and have less interference to have your relays toggling the rocker switch rather than the actual 110 wire going to the lights, you guys have me stumped on the coding side of things but I love messing with wires, aside from being a full time auto transmission installer I install and mess with car stereos on the side soo I understand dealing with electrical noise espically when combining different current types. Second question would be do you twist your wires when you run them? It does add a little bit of length to your run of wire but helps eliminate noise.. speedometers in cars can go bonkers if the wires going to the sensors aren’t twisted.. easiest way to acieve this is sticking the end of the wires in a drill and slowly turning it to get a slight twist not tight.. just food for the thought.. anyways, love the project and seeing what has been done with it and will continue reading and will be watching for more once I get to current posts haha
You mean like a solenoid or actuator pushing on, and physically toggling the switch? It's easy to use a relay, and I've just built one into a power outlet, so I can plug both lights into it, and the relay will turn them on and off. No issues with noise there... So far, twisting wires has not become necessary, although having spent considerable time wiring up video transmitters and receivers for FPV I am familiar with twisting wires, and using toroids where required.
 

odam2k

Well-Known Member
Do you have a phone that’s not being used and is still activated and has bluetooth? You could have your module send a message or command to the phone and in turn the phone automatically rerouts the message to you? Your a software guy I’m sure you could figure that part of it out
While I have two cell phones, neither are activated... We do have one active cell phone, but mine is just for WiFi, and when we're out, I tether from the wifes phone. I don't like talking on the phone, so it's not worth keeping it active.

As you'll see if you keep reading, I have discovered, thanks to a recommendation from @Latitude17 , Blynk, which will solve that problem.
 

odam2k

Well-Known Member
Took a little break from Blynk, and finished off the Water Chiller for the Aqua Cloner. I don't need it till summer, but I suppose I should at least test it. I was waiting to grab the muffin fan off the humidity dome on the cloner, because I only have two of that specific size, and the dome needs a smaller one anyhow.

So the completed part is the 4 peltier plates, the water cooling block, thermal paste, heat sinks, fans... physically assembled, but not wired up yet.

Then, just now, I had to make up a scented candle. Management is replacing plumbing fixtures on two floors of our building today, and a security guard will accompany the workers. I do NOT want them knowing I'm growing, so I have the lights off today, exhaust fan going like mad, and the room closed up. The wife is baking cookies and bread today...

When pot was legalised, our building management created a new rule, no smoking pot anywhere on building property, including your own unit, and NO GROWING... While they say they will make exceptions for those covered under the Ontario Human Rights rules (which we are, being licensed medical growers) I want to avoid explaining my medical needs, and jumping through any hoops they impose. I am a safe grower, no mould, no electrical hazards, etc, constantly monitor temp/humidity... Two people who work here, not part of the management company, who know we are growing (the maintenance foreman, obviously) and an office worker, both said we should just keep quiet... so we are... If we get caught, no problem, I'm not worried about repercussions of keeping quiet, it's just none of their business...

Anyhow, I made a nice big scented candle, will burn all day....

Back to coding....

more coffee....
 

Camaro1691

Well-Known Member
Welcome @Camaro1691 Hope you find the thread informative, and entertaining :)



You mean like a solenoid or actuator pushing on, and physically toggling the switch? It's easy to use a relay, and I've just built one into a power outlet, so I can plug both lights into it, and the relay will turn them on and off. No issues with noise there... So far, twisting wires has not become necessary, although having spent considerable time wiring up video transmitters and receivers for FPV I am familiar with twisting wires, and using toroids where required.
I was referring to taking the toggle switch out of the grow light and using the relay in place of the toggle switch, similar to what your doing with the outlet box you have
 

odam2k

Well-Known Member
I was referring to taking the toggle switch out of the grow light and using the relay in place of the toggle switch, similar to what your doing with the outlet box you have
Gotcha...probably need a way for either, might need a mechanical backup.
 

odam2k

Well-Known Member
I was referring to taking the toggle switch out of the grow light and using the relay in place of the toggle switch, similar to what your doing with the outlet box you have
It would actually be nice to be able to replace the rotary switch with something electronic, and be able to adjust the brightness, could be useful for temperature control... I suppose you could turn it with a servo, hmmm...

My other ballast is for a 400W MH, and it's just a bare transformer on stilts with a big ass capacitor hanging off the side... Looks like hell, but it's been reliable as heck over a span of many years.
 
Top Bottom