Arduinos In The Grow Room: My Project

That is pretty cool. As soon as I get temperature under control for the hotter days, automatic watering is next on my list of things to do. For my soil I don't need to add nutrients to my vegging plants because they get transplanted enough, but in my flowering tent, after a couple of weeks I use nutrients. How do you handle nutrients with auto watering? Mine are liquid and I mix them with my water right before I manually water the plants.

I switched from a 2 part liquid that would leave a chalky residue to one that doesn't. It stays dissolved better. Since my bucket (reservoir) is only 20L, or 9 waterings, it will probably need to be filled weekly (one bucket, 8 pumps for 8 plants) will need a few buckets for all my plants... at least 4. 2 for flower, 2 for veg. I may end up switching to either garbage cans or totes, but they need to be straight sided so my "volume calculations" work.

I will mix the nutrients into the water as I fill the buckets. I'll keep one pump to circulate the water in the bucket, probably on a schedule...
 
I've been letting the system tell me when to water my plants, and so far, it's batting a thousand... I'm really happy with the way things are going...

Blynk has made my phone into an invaluable tool in the grow room.

It tells me which plants need watering and where they are located.
Watering is done manually until I get more pumps, relays, and buckets, but if a pump is assigned to a plant, then the system will automatically water the plant instead. The system logs every watering, and also notes if it was manual or automatic. If it is automatic, is also stores more data such as how many ml of water was pumped, and how long the pump ran, etc.

From this same screen, I can mark the plant as watered once I actually water it, no further action required, the system will confirm the watering by checking the sensor reading next time it scans the sensors.

Untitled.png
 
Made it into the electronics store today to pick up the terminal blocks I needed to build more of my DIY-3 Soil Moisture Sensors made with stainless steel rods.

Made up 12 new sensors...

Untitled.png
 
... and 14 new 10K Ohm voltage dividers to use with the Soil Moisture Sensors...

Untitled.png



Here's the fritzing diagram again to show how they are made...


VoltageDivider.png


I also need to make up 14 one foot long male/male servo wire (3 wire with dupont connectors) to go from the Voltage Divider to the Arduino...

The Voltage Divider connects to the sensors via a 2 conductor wire, again, using dupont connectors.
 
Today's mini project, a light baffle for my Flower Tent air intake.

You can see how much light leaks OUT, so it worries me that light is leaking IN when it is supposed to be dark in there...

baffle00.png



I took some measurements, and using the latest CAD system, came up with these engineering drawings...

baffle01.png



To make this project, you're going to need to make a visit to the dollar store...
First BLACK foam board, I bought two, not knowing how much I'd need, but this baffle used only one sheet.

baffle02.png



Some BLACK duct tape to assemble it....

baffle03.png



You will also need some Velcro Tape, we'll use that to attach the box to the tent...
I didn't have any, so still need to go buy some...

So now I needed to figure out the pattern to cut out so that I could fold it together... Again, using the latest CAD system, I created more engineering drawings...

baffle04.png



And here it is transferred to the foam board... For the folds, I cut the paper on one side, and put duct tape on the other side to prevent it from tearing... You can see the cutouts at the ends for air intake...

baffle05.png



Folding it up.... except the top, I'll leave that open so I can add the baffles inside.

baffle06.png


And here are the baffles to prevent the light from shining directly through...

baffle07.png


Now fold the top down, and tape it all up...

baffle08.png




And finally, hold it up to the tent to see if any light comes out the ends...

baffle09.png


I'd say it works!

I still need to add a "flap" all around the edges, it will simply be a flap of duct tape with the velcro attached to it so that you just place the box against the tent, and press the flaps on all 4 sides of the vent, and voila, the air can get in, but the light can't get out...

I'll add a couple more pictures once I get the velcro tape and install this.
 
I created a duplicate post to the Light Baffle post in the DIY area, since most people aren't going to read this thread, and therefore don't get to see the things I create here. I will try to do this with each mini project within the bigger project, I think it makes sense.

I will try to break things into standalone projects and create separate threads for each once they are completed and tested... This thread will continue to document my thoughts and processes as I attempt to automate the grow room :)

As I move forward, it is my intention to share the details of every aspect of my automation, including, eventually, all of my code. I don't feel I should publish my code yet, as it changes SO FAST and OFTEN that it would be extremely time consuming just to try to maintain a code base shared with others. Besides, I have no idea how to install all of this from scratch! I've built it all on a live system, with continuous upgrades to both code and database, as well as additional libraries (for the Arduino) and servers (Blynk for example). Once I feel the code base is stable (not necessarily perfect) I'll post it to GitHub and possibly see if I can find someone interested in maintaining it as open source, something I know nothing about, and really don't care to learn... lol

Grow by Wire is being developed solely for me to use, and in that regard, I feel I'm not cutting any corners, and I think it is a much more robust system than anything else available, which is why I think it is worth sharing.

Examples of this robustness include the Soil Moisture sensors, which are extremely reliable, non-corroding, and very stable over time. Also, automatic watering, we don't just turn on the pumps and water every plant for a fixed time... that seems so error prone, for reasons I've covered before. Instead, I water each plant with a pre configured volume of water, which can be adjusted, based on a trigger value from the moisture sensor, again, every plant is treated individually...


So, stay tuned, there's lots more to come, and if you are reading this, why not say Hi, or at least "like" this post so I know you're there...
 
I recently noticed in some of my graphs (Blynk and Grafana, even my own DIY graphs) that on occasion, there were some really whacked out numbers. Sometimes sensors would return values that are impossible to be real... Temps near minus two billion?

I added some code recently to fix this, for each sensor each sensor type, I can configure a minimum and maximum allowed value, and if it is outside that range, it will not save it to the database... Problem solved...

Tonight I am playing around with the Blynk App, re-arranging screens, removing some stuff, adding new stuff... Basically now that I know how it works, and what I can do with it, I want to almost start over and create a better app...

So I noticed as I was recreating the Blynk graphs for temperatures, they still showed these whacked out numbers... I check my MySql database, and there are NO invalid entries.... Aha, I send these values to Blynk directly on a different schedule than that used to update the database...

I had added the checks to the code which writes to the database only. I moved the new code into it's own method, and now call it from both places, the db write, and the Blynk Send. Blynk has stored all those invalid pieces of data... I clicked the 3 dots on the bottom of the graph, and clicked "Delete Data". Now only good data will be saved going forward...

So for each sensor each sensor type, which can contain up to 3 "probes" (DHT22 has Temp/Humidity/HeatIndex) I can configure a minimum and maximum for each of the RAW and CALCulated values.

That means 3 probes X 2 endpoints X 2 values = 12 fields in the database for each sensor each sensor type...

Setting a min and max is optional for any sensor sensor type...


EDIT: This is configurable for each sensor TYPE, not each individual sensor. so for a DHT-22, you can configure the valid minimum and maximum allowable value, and anything outside that, on any DHT-22 sensor will be ignored...
 
For my analog reads, I take an average. That might explain why I haven't seen a wild reading yet.

Code:
int smoothAnalogRead(int sensor){
  int i;
  int value = 0;
  const int numReadings = 5;

  for (i = 0; i < numReadings; i++){
    value = value + analogRead(sensor);

    // pause adds more stability between reads.
    delay(100);
  }
  return value / numReadings;
}
 
For my analog reads, I take an average. That might explain why I haven't seen a wild reading yet.

I do the same, 100 readings per "scan". I also do something I call a PowerTest. Because I only power the sensor when I am taking an actual reading, I first do a reading WITHOUT power to the sensor, and then do a reading WITH power. I compare the two, and if the readings are more than 5 in difference, then the sensor is good, otherwise I assume the sensor is somehow not connected properly and ignore the value.

Occasionally the difference might be 6 or just enough to pass my test, but I had to pick a number that made sense... For example:

If you unplug a sensor, and let the system do its scan, it will return a value for that pin still, and that value, while meaningless, will be relatively stable. Lets say it returns 355. Because there is no sensor, the reading with and without power should be about the same... So without power, say it is 354, and with power, 357. My test will catch that and ignore the value...

The PROBLEM is, perhaps the soil moisture level is 35%, the reading will be roughly 358 with power applied. If the reading without power is 355, then I will end up ignoring a valid value... This is why I need to keep the TEST value low (5) otherwise I'd be flagging a lot of valid readings as bad.

So far this hasn't caused any problems, it's very rare that this could happen, in fact, I've never seen it, but it could... It has however, allowed me to find faulty wiring/sensors quickly and easily. My web display for example, changes the color of each "plot" is the age of the last reading is greater than 60 minutes.
 
I found some velcro, left over from my R/C days...

The "flaps" are made with tape, I used black on the inside, and silver outside, cause I have lots of that...
I just attached the velcro to the flaps... I think once installed, this is going to stay put, and may even be a pain to remove... We'll see, lights on in just over 2 hours (5am) and I'll give it a go...

baffle10.png
 
Tonight I am playing around with the Blynk App, re-arranging screens, removing some stuff, adding new stuff... Basically now that I know how it works, and what I can do with it, I want to almost start over and create a better app...


Here's what I've got so far...

There are 7 Tabs, or screens...

Screen_01_02.png


On the left, the Automatic Watering Status. I only have one reservoir so far, and on this screen I can see exactly how much water is in the reservoir, this is updated every time the AutoWatering system checks the reservoir (every 5 minutes plus every time it is used). The pump status is also shown, when the AutoWatering module reboots or is first powered up, these turn yellow, then red as it verified all pumps are off... Then any time a pump is turned on to water a plant, that "led" turns green, and then back to red when it shuts off, lets me know when pumps are running... While a plant is being watered automatically, it will update this screen with information such as which plant, where is it, the total amount to be pumped, amount remaining, time elapsed, etc...

On the right is the Manual Watering tab, where any plant that requires watering, but does not have a pump associated with it, will show up in this list. The example above show me that plant #66 in the Flower area, in row 2 (middle row) column 4 (far right) needs watering... Once I manually water the plant, I simply select it, then hit the "Water Selected Plant" button, and it will update the database to show that it was watered, what time, and that it was done manually.


Screen_03_04.png


On the left, a very visual indication of my major temperature concerns... Pretty self explanatory, these values all come from DHT-22 sensors.

On the right, again, temperature and humidity, but also includes a sensor placed outside so I can monitor the outside air temp. These graphs allow me to view history, and see trends in the data, and also to see the relationship between the various area, ie, how does outside air temp affect inside temp...

Screen_05_07.png


On the left, I see the "uptime" for each module, the time since it last rebooted. It also lets me verify that the module is up and running since these are updated every second. The exception to that is when the module is busy doing something, such as scanning the sensors, it does not do the update here... I can also reboot a module with the touch of a button, or have it perform some task, such as a Sensor Module to scan all attached sensors, or the Maintenance Module perform it's scheduled maintenance on demand... I can also see that the Veg lights are on, and the Flower lights are off (using photoresistors), and finally, force ALL modules to reset their RealTime Clocks to the time on the database server by doing a SELECT NOW()

On the right, each ESP8266 monitors the RSSI (signal strength) of it's WiFi connection, and reports it every minute to the Blynk Server. This screen allows me to monitor all modules, in near real time. The "uptime" is also shown so that I can confirm the module is in fact running, and connected and I'm not just viewing a high RSSI from an hour ago.

Screen_06.png


Finally, my Sensor Calibration Tab. This screen lists all sensors currently in use, the sensor Id # is the number on the far right by itself. The line of numbers separated by the slash is as follows:

1st # is 0 or 1, is the sensor being monitored to determine if it needs watering?
2nd # is the calibrated reading in dry air
3rd # is the calibrated reading dipped in water
4th # is the value at which the plant needs watering
5th # is the latest value read from that sensor.

I can select a sensor (only 1 at a time) and perform the following actions by touching the appropriate button:

Calibrate Wet: Read the sensor and set it's current value as the reading when dipped in water.

Calibrate Dry: Read the sensor and set it's current value as the reading when in dry air.

Calibrate Auto: Read the sensor and set it's current value as the reading which will trigger the watering process, either manual or automatic.

Scan: Read the sensor and log it's current value just as if it was processed in the full sensor scan.


Refresh, as you would expect, refreshes the list.



That's it right now, you can bet it will continue to change, but I'm liking it more each time :)
 
I finally installed the light box on the tent, after doing some measurements...

I used a small hand held Anemometer to measure the wind speed coming out of the ducting, which is exhausted from the tent.

I took 6 readings, 3 with the fan on 100% and 3 at 50%.
The 3 consist of having the vent covered completely, open completely, and with the box installed.

Fan at 50%Fan at 100%
Vent Covered5.0 m/s7.5 m/s
Vent Uncovered5.5 m/s8.6 m/s
Light Box in place5.0 m/s8.5 m/s

Keep in mind I also have a 6" duct for air intake.

At 50% the vent probably isn't as effective anyhow, the duct likely provides enough inflow... However, at 100% the box has almost no effect on the amount of air being pushed out of the tent.

I'm calling it a success!
 
It's hard to see, because it's dark, but that's the point! :)

The Air Intake light box has blocked the light almost completely, I don't see any....

You CAN see the light leaking out of the Duct I'm using for an intake which has a tight U shape.

Baffle11.png
 
Trying to wrap up the Automatic Watering and get it installed on at least 2 plants...

Because the module consists of a few pieces, and I don't have another project box for it, I just mounted the parts on a piece of wood...


AutoWater Mounted.png


No more excuses... time to set it up!
 
Ok, final version (for now) Added a power board, bottom left. 12V in, and 12V, 6V and 5V out for various items...


AutoWater Mounted2.png
 
And, FINALLY, after so many false starts....

It's INSTALLED!!!

Just one plant for now till it waters it without issue, then I'll start adding more. It might be two days before this one needs watering, but I do want to leave it to do it all on its own...

Installed.png
 
The downside is I haven't used c# for nearly 5 years...

It hasn't changed in the sense that you can still use what you knew to get the job done. Just "more" functionality and built-in stuff available now. I'd suggest doing .NET Core if you're going to do it now. MVC hasn't changed, so web will be a breeze to pick back up.

build an XML representation of the data and passes that back to the 2560, which then parses the XML into variables...

Have you considered switching to JSON from XML? Way smaller payloads, which is important for these little guys when talking performance, and very web-friendly. Squeeze every drop!
 
It hasn't changed in the sense that you can still use what you knew to get the job done. Just "more" functionality and built-in stuff available now. I'd suggest doing .NET Core if you're going to do it now. MVC hasn't changed, so web will be a breeze to pick back up.

Yeah, but the problem is, my memory doesn't go back 5 years ny more :) I've literally forgotten more than most people know...

Have you considered switching to JSON from XML? Way smaller payloads, which is important for these little guys when talking performance, and very web-friendly. Squeeze every drop!

It's the classic problem, you start development using one technology, and every day that you continue to use it, you become more attached to it, and it's harder to change.

I've got so much hinging on this code right now that I won't be making any changes to it until I'm ready for a major rewrite.

I'm sure there are many advantages to switching, but right now xml is working.

I have however, added to my "reading list" to brush up on json.

:)
 
Back
Top Bottom