Arduinos In The Grow Room: My Project

odam2k

Well-Known Member
Hi there, I'm about a month into my project, and decided it's time to not only share it, but document it as well. Hopefully posting here will accomplish both :)

I will keep this first post short, and come back often updating the thread, which should be quite often as I have nothing much else to do while waiting for my plants to grow :)

So, I guess I better describe what I'm doing... and why....

First, why?

About 7 years ago when I was still working, and playing with R/C toys, I ended up buying some arduino stuff to fiddle with. (google it if you don't know what an arduino is) but never had a chance to play with it... Fast forward to today, I'm on disability, and have TONS of free time. Initially I was on a lot of opioids, and used medical pot to get off those, and some other nasty pharma's... Affording al that pot was a problem, so I got my grow license, and have a small grow set up in a spare bedroom. I set up my workspace in there as well, and started playing with the arduinos again, and discovered just how much I could do with them!

Now, what am I doing?

First, some info about my layout...

I am licensed for 40 plants, so I've set up three "locations", one for my clones, one for veg, and one for flowering...

My clone area is just my DWC machine on a shelf in the kitchen under an LED bulb... The DWC holds 24 clones when full... 6 rows of 4 spots

My Veg area is about 3' by 3', it's two plastic shelving units taped together so its 2 deep, making the shelf area square... The bottom 2 shelves are for storage, and the top, open to the ceiling level, is where the plants are. The very top shelf is the roof, and hanging from that is a LED light fixture (like used on the patio or over a door outside). The whole thing is wrapped in plastic, the black/white stuff... This area holds 9 plants, 3 rows of 3 pots, my pots are 10" across, roughly square...

My flower area is about 3' x 7', with white plastic along the back and side walls (back wall is 7'), so 21 pots altogether, 3 deep, 7 across...

Each area, I call a "location" (1-Veg, 2-Flower, 3-Clones)
Each spot a pot or plant goes, I call a "plot" (a plot belongs to a location)

I have made my own soil moisture sensors using galvanized nails, wire, and a 10k resistor as a voltage divider...
Each "sensor" is numbered... and labeled :)

There are also temperature sensors, humidity sensors, and more to come...

So a plot can hold a plant, but it can also hold a sensor...

My database (MySql hold all this info) has a bunch of tables such as a "location" table, "plot" table, "plant" table, "sensor" table...
It also has lookup tables for "strains", "vendors", "sensor_type", etc...
and Map tables that tie Plants to a Plot, and Sensors to a Plot...

More on db structure later if there's any interest...

So all my plants have moisture sensors, each location has temperature sensors, including one in the air conditioner in the spare room which cools everything, so I can track when it's on...

ALL sensor reading obviously are logged to the database...

How is this accomplished?

I have an Arduino Mega with an on board ESP8266 WiFi module. This is my main "Server", the arduino part handles communication with the other "modules" to gather data, and sends it to the ESP8266 which then does all the MySQL db stuff... The ESP8266 also runs a web server.

Each "module" is an arduino pro/mini with 8 analog inputs, each with a sensor attached. There are 4 modules so far:

Module00 is the main module in the grow room, it communicates with Module01 and Module02 via serial interface, passing XML back and forth... Every "x" minutes, it sends a "ping" to each module and requests it to read it's sensors, and send the data... In order that the moisture sensors don't corrode from being on all the time, Module00 uses a relay to power ALL the sensors attached at once, sends the request, gathers the data, then turns off the power till next time. This allows it to gather data from 8x3 sensors, or 24 sensors in all at one shot. I need to add one more module to cover all my spots...

Module03 is special, it is in the clone area, and currently has two temperature sensors, one in the air, and one in the water. Every x minutes, it reads the sensors, and then sends that info to Module00 using a bluetooth connection.

Probably sounds confusing, but hopefully that will get cleared up as I go forward... Maybe a pretty picture will help :)
 

Attachments

  • Capture.JPG
    Capture.JPG
    211.7 KB · Views: 647
That image is from the webserver running on the ESP8266 with data from the MySQL database. It shows my flowering location, 3 rows deep, 7 rows across, and not all hgave a plant in them at the moment... For each one with a plant, you can see the Plot ID, Plant ID, Strain Name, # Days flowering, Moisture level as a bar graph AND value, and the sensor # on that plant. It also shows the age of the reading in minutes...
 
Bit of a changeup in naming today...

A module with a relay will be called a Master Module, and modules connected to the Master, will be Slave Modules. A module will be one or the other, so there are only 2 versions of the module software, and I'm using defines to compile for each physical module with its own id. I built a new module. and realized keeping a copy of the software for each module was going to be a maintenance nightmare...

I've got 4 more clones rooted and waiting for a spot, so I have to move 4 plants from veg to flower, meaning I needed the new module and some more soil moisture sensors, so spent yesterday afternoon doing that.
 
A better picture of the main unit, it contains the Arduino Mega with ESP8266, a bluetooth module, and three Arduino Pro/Mini's, one Master Module with relay, asnd 2 slave modules. Each Pro/Mini has 8 analog ports, with connectors on the edge of the breadboards..

Also, a picture of the new Master Module, I don't have the capability to etch my own circuit boards, so I just wire up the backs of the breadboards, making everything plug-in to the board... Once I'm done fiddling, I'll learn a design program, and send away for some boards...

The Master Module contains an Arduino Pro/Mini, a 5v relay, an NPN transistor, diode and resistor, plus the pin connectors... pretty darn simple... The 3 pin connectors for the sensors have the ground rail joined, the middle power rail is joined, and powered by the relay, and each signal pin foes to an analog port on the arduino...
 

Attachments

  • MainUnit.jpg
    MainUnit.jpg
    428.8 KB · Views: 436
  • MasterModule new.jpg
    MasterModule new.jpg
    632.5 KB · Views: 428
  • MasterModule bottom.jpg
    MasterModule bottom.jpg
    483.2 KB · Views: 407
Here's how I hooked up the relay...

and created my Soil Moisture Sensors... Just a galvanized nail at the end of each wire...
 

Attachments

  • Capture.JPG
    Capture.JPG
    221.2 KB · Views: 403
  • Capture.JPG
    Capture.JPG
    193.4 KB · Views: 387
Wow. Tech to the max. Cheers for it. Check ya later odam
 
Thanks guys, didn't realize anyone was watching :)

I did read through an older thread here, that's what inspired me to post. I'm sure I'll be scouring the site for more threads when I run out of ideas, I have so much already planned, and between this, and some R/C projects on the go, haven't had much time...

I am naming my project 'Grow By Wire', I'm hoping to eventually automate everything... I've made some changes, including adding another ESP8266 WiFi module so I can split the MySQL Connector and the Web Server onto separate boards. This has increased the reliability of the SQL stuff, and the response time of the web server. Amazing stuff, and under $7 for a server!

I'm also replacing all my "galvanized nails" moisture sensors with cheap sensors from China, they are about $1 each... I keep losing nails in my pots :)

I've modified the web page showing the status of the sensors....
 

Attachments

  • showlocation_new.JPG
    showlocation_new.JPG
    159 KB · Views: 371
I grabbed 5 of these 3-6v pumps, will use them to water the pots... I have 3 so far, 2 more on their way. They don't have a lot of lift capability, but enough to pump from a container (bin maybe?) up into a pot no problem. I've had to order more relays. Unfortunately, I will need about 30 of these, and 30 relays, but at less than $3 each, I guess that's not too bad, just gonna be a mess of wires and tubing!
 

Attachments

  • IMG_20180921_174656.jpg
    IMG_20180921_174656.jpg
    506.3 KB · Views: 334
I replaced the "galvanised nail" sensors in my "veg area" (9 plants) with the new "probes" I ordered online. I didn't pay a lot of attention, the plants were all about midway between wet and dry.... I eventually noticed that they seemed to be getting wetter as time went by, not drier...

Seems the little circuit board included INVERTS the reading compared to just using a 10KOhm voltage divider as I do with the nails. Not to worry, my code allows for different calculations for different sensors, so it was an easy fix. :)

I've been spending a lot of time on code lately, one of the things I learned as a programmer for 35 years is not to be afraid to just rip everything apart and make changes :)

Anyhow, these are the moisture probes I'll be using....
 

Attachments

  • IMG_20180923_163635.jpg
    IMG_20180923_163635.jpg
    541.5 KB · Views: 368
This is awesome! I have had an arduino board and some relays laying around from an old project key less entry/remote start project I never got off the ground, but you have inspired me.

Here's my very crude idea I worked out.

Basically, if moisture sensor 1 is dry, it checks water levels in the water bucket. If the water bucket is above minimum, it kicks on air pump for a couple minutes, then checks PH (If it's not above minimum, it sends alert, and waits to check again after 4-6 hours. If PH is not in range, it sends alert and waits 4-6 hours to repeat loop). If PH is within range, it opens solenoid valve 1, then kicks on the pump (not sure if it should be for a timed duration or until based on moisture sensor readings). Then repeat the process with moisture sensor 2. All while constantly recording temp and humidity.

I will be watching your thread very closely!
 

Attachments

  • automated watering system.png
    automated watering system.png
    101.8 KB · Views: 451
Been a while, sorry, but I've been redesigning and rewriting software.

I was using Arduino Pro/Mini's with only 8 analog pins, and had two "slave modules" reporting to one "master module", so 3 altogether, and the "master" would trigger a relay to power the sensors on all three modules. That meant it had to be powered long enough for the master to scan its own sensors, then contact the first slave and tell it to scan, wait for the results, and do the same for the second slave module. While power is on, the soil moisture sensors are corroding, so minimizing the time with power would be a good idea.

My new design is to use the Wemos Mega 2560 with onboard ESP8266 wifi module. This gives me 16 analog pins and 54 digital pins. It is also able to communicate directly back to the mySQL database on the network, making this wireless standalone unit that can be placed almost anywhere you have power.

I also solved the problem of having the power turned on to all the probes for long periods of time by using more digital pins, and transistors. I've seen stuff online where people are powering their probes directly from the digital pins, but I just got 100 S8050 transistors in my last online order... I created a small board with a 4 pin connector (Arduino - Gnd, 5v, A0, D23) with a voltage divider (10K) so A0 can read the sensor value, 5v goes to the Collector on the transistor, and the D23 digital pin goes to the Base on the transistor. When D23 goes high, the transistor outputs 5v on its Emitter, which is the + for the sensor. So now, set D23 HIGH, read A0 100 times, get avg, set D23 LOW, and move on to the next sensor. Power will be on for a very short time...

I've also ordered some multiplexor boards and chips, will see how many sensors I can run on a Mega :)

In the process of changing the hardware setup, I'm also making a lot of software changes and database redesign.
I'm gonna create a blog once I'm happy with the direction the changes are going...
 
Interesting issue popped up. If I power my NTC Thermistors directly from the 5v rail, with a 10K Ohm resistor for the voltage divider, the temperature is within a few 10ths of a degree C of the DHT-22 Sensor.

If I power the thermister through the switching transistor, I need to use 15K Ohms in order to get the same temperature.

I looked it up and there is a .2v drop across Emitter and Collector, that would explain it...

This brings me to calibration, something I'm going to need to account for obviously...
 
I replaced the "galvanised nail" sensors in my "veg area" (9 plants) with the new "probes" I ordered online. I didn't pay a lot of attention, the plants were all about midway between wet and dry.... I eventually noticed that they seemed to be getting wetter as time went by, not drier...

Seems the little circuit board included INVERTS the reading compared to just using a 10KOhm voltage divider as I do with the nails. Not to worry, my code allows for different calculations for different sensors, so it was an easy fix. :)

I've been spending a lot of time on code lately, one of the things I learned as a programmer for 35 years is not to be afraid to just rip everything apart and make changes :)

Anyhow, these are the moisture probes I'll be using....


Hey :) Just saw ur project - Very nice at all!!!

But plsssss dont use such bad moisture probes - they give a lot of copper to the soil and I dont think u want that - instead use capacitive moisture probe - there is no metal touching anything ;)
 
Teleon, thanks... I hadn't heard that anywhere... The probes seem to be maybe aluminum traces, not sure, but it looks silver. Anyhow, if I have to spend the money for a safer smoke, I will. Appreciate the heads up!
 
Back
Top Bottom