420 Magazine Background

Arduinos In The Grow Room: My Project

odam2k

Well-Known Member
In order to make it easier setting up Blynk widgets, and given the large number of Virtual Pins available, I've come up with a convention regarding sensors and virtual pins.

Sensor # 2 can share 3 values, these will be shared on Virtual Pins 2, 102, and 202.

So if Sensor #21 is a DHT-22, where would I find the humidity value? That's right, Virtual Pin 121...

I only have data sent to Blynk that I have specifically configured to do so.
 

DrewT

Active Member
Turned out I was running pinMode again
Glad to hear you sniffed that down! Nice work, I cant tell you how many times I've run into things like that. I've got a bug now that is a result of EMI on a board I fabbed up. Runs great when its spread out on the table but get it tucked away in an enclosure and the encoder SW pin goes high every time the sump pump turns on! Sometimes I kick myself for not getting an EE degree instead of going the CS route.
 

odam2k

Well-Known Member
I'm thinking of moving this to a "blog" site. It has become more of a blog than a DIY thread. I get a feeling that this thread isn't getting much attention due to my long winded ramblings, which is ok, as I originally stated, it's here as much for me, and my own reference, as it is for anything else...

I guess I should have a look around and see what's available, perhaps a more "arduino" type place? Any suggestions?
 

DrewT

Active Member
I think there's a lot of useful info in your posts, calling them "ramblings" undercuts the true value imo :) . That said, if you're looking to make salient points more accessible then yes, perhaps a different format may help.

isn't getting much attention
What type of attention would you like to recieve? If we knew more about that it might lead to better feedback.

I'm planning a build journal for my next setup so I'm in the same boat as you. I have a website running a CMS (WordPress) and it does a decent job of making blog entries less than painful. I'm not sure what kind of hosting resources you already have but that may be an option as well.

Another idea - perhaps make a google doc that includes all your thoughts, then anchor link specific achievements here? That way the thread represents a simpler way to observe your applied process and call out things you want to share.

In any case, my vote is for not changing your style. There is a ton of great info in this thread and I for one would rather have it here opposed to not posting.
 

Latitude17

Well-Known Member
Just curious how reliable this would be, if it missed an event for some reason, and you never start sending data to your app, you'd be banging your phone on the table wondering why it wasn't getting updates, no? I do suppose it is well tested though, I haven't run across any bugs in the app so far. (Server admin is another story!)
In the ~3yrs I've been using it, not one hiccup with that feature. If you watch the network traffic between the server and the phone app, you'll see it pass on the client connected event reliably as part of the client-connect process to the server. Pretty sure they've tested it thoroughly.

I'm thinking of moving this to a "blog" site. It has become more of a blog than a DIY thread. I get a feeling that this thread isn't getting much attention due to my long winded ramblings, which is ok, as I originally stated, it's here as much for me, and my own reference, as it is for anything else...

I guess I should have a look around and see what's available, perhaps a more "arduino" type place? Any suggestions?
To each his own, however I would have never seen your blog... ;)
 

odam2k

Well-Known Member
Well, I've had a chance to actually think about it, and this is actually the perfect place for me to be posting...

I like the way threads in a forum work for creating a nice timeline of events, organized, basically, in a thread, as opposed to blog sites where you post seemingly non-related articles.

The people here are not likely to find my posts offensive due to the underlying subject matter (growing pot). People frequenting the DIY forum are a rather technical lot, and have provided some fantastic input to my project.

I think this is exactly where I should be....
 

odam2k

Well-Known Member
A little about my development environment...

The grow room is in the spare bedroom, it contains all the sensors, and Module 1 and Module 2. The two modules are connected via WiFi to my home network.

In what used to be a dining room, I have my development laptop which I code on, I have an external 40" TV Screen via HDMI (don't need to wear my glasses!) I have an external USB hub and this is where I plug in boards when working on different things. Permanently plugged in here is Module 3, which is my development Module. Everything goes on here first to be tested before being uploaded to the Modules in the other room.

I'm working in the Visual Studio 2017 IDE with the visualMicro plugin, and I love it! I can monitor multiple COM ports, I can even upload the previously built version of something. It's SO much faster and smarter than the Arduino IDE.

1722238


Originally everything was in one room, and all updates were done over usb. Then I discovered (and finally got working) OTA updates for the ESP8266 module... I made some modifications to the code to help prevent accidentally uploading the wrong software. With the old generic message on the screen, there was no indication of WHICH board you were connected to...

1722244


When I seperated from the growroom, I put a laptop in there which is on the wireless network, and I can use Chrome Remote Desktop to remotely operate the computer. That laptop has both Module 1 and Module 2 plugged into it's usb ports. To accommodate this, I run two separate copies of the Arduino IDE (start both from the main icon, not within a running copy) Each copy lets me set the com port (Module 1 on left, Module 2 on right) and open the serial monitors. This is how I keep an eye on things, especially when trying to debug problems.


1722247



On the remote desktop are two batch files for uploading compiled bins to the Modules.

1722248


Just double click, and it will upload the most recently compiled bin for the Mega2560 which it gets across the network from my development machine.

1722251


And there we have it, from Compile, to test, to live... All from my desk.

Any questions?
 

odam2k

Well-Known Member
On the front of each Module, I have an LCD Screen. That was one of the first external pieces... It just shows the module # (3 in this case), the current time, and the time until next scan...


1722499




Now there's an App for that! <grin> Now I can see all three at once! The app only refreshes these screens every 5 seconds, no need for every second...


1722502



Not sure what the foreign characters are at the bottom of the widgets...
 

odam2k

Well-Known Member
I like the way threads in a forum work for creating a nice timeline of events, organized, basically, in a thread, as opposed to blog sites where you post seemingly non-related articles.
Actually, one gripe... I can't edit the first post in the thread (actually can't edit ANY posts after a set time) so there is no way for me to post a "See post # xxx for latest" or something. If you are reading this thread for the first time, and you made it through a couple messages, you would have a wrong picture of this project today, it has changed THAT much! I'd like to be able to make say monthly UPDATE posts with a description of where we're at, and then on Post #1, place a link to that update.

Oh well, if you're reading this, you're up to date anyhow :)
 

Latitude17

Well-Known Member
Not sure what the foreign characters are at the bottom of the widgets...
According to the Blynk documentation: "This is a regular 16x2 LCD display made in our secret facility in China.", many people ask it in their forums too - it was a joke by the devs.


Diggin' the progress. (Oh, and update your signature to get around the edit issues. You can point anyone anywhere at any time ;))
 

odam2k

Well-Known Member
According to the Blynk documentation: "This is a regular 16x2 LCD display made in our secret facility in China.", many people ask it in their forums too - it was a joke by the devs.


Diggin' the progress. (Oh, and update your signature to get around the edit issues. You can point anyone anywhere at any time ;))
Thanks, and great idea, that's going to get updated in my first post whenever I change it :)

I remember reading that about the secret chinese factory, but I didn't think they looked like chinese characters... too rounded... I'm no expert...
 

odam2k

Well-Known Member
In order to make it easier setting up Blynk widgets, and given the large number of Virtual Pins available, I've come up with a convention regarding sensors and virtual pins.

Sensor # 2 can share 3 values, these will be shared on Virtual Pins 2, 102, and 202.

So if Sensor #21 is a DHT-22, where would I find the humidity value? That's right, Virtual Pin 121...

I only have data sent to Blynk that I have specifically configured to do so.

This will work for sensor id's 9-54, there are only 255 Virtual Pins on the ESP8266, so only 9-54 can have all 3 values sent using this convention, but luckily it's just that, a convention, not a rule :) You can assign ANY value to ANY Virtual Pin.
This just makes it easier to remember where they are when setting up screens on the app.
 

bobinca

Active Member
I enjoyed reading your journey on automating your grow. You mentioned that one of your goals was to take small trips and not have to worry about your plants. I was wondering if you achieved this. My goal is very similar to your but in the harsher environment of an attic, so I also have to monitor and adjust for temperature. My hope is keep my plants safe on an upcoming 3 week vacation. I'm starting to plan for this and thought the arduino should be able to handle it. I'm curious if you had any issues keeping the arduinos running for so long.
 

odam2k

Well-Known Member
Hi @bobinca and welcome to the thread...

While being able to get away for a few days was an original goal, it's almost one I had forgotten till you mentioned it :)
I'm still fiddling with the automated watering part of things, but I think I will be ready this summer to take days away from it. My problem is I'm absolutely worried about the system failing, so end up double and triple testing things and trying to build in as much redundancy as possible.

I can tell you that every day I try to rely more on what the system is telling me, and less on popping in and looking at them. It took a few wilted plants to figure out exactly when the system should decide they need watering, but nothing serious, I can always override it and water whenever I like. I'm currently still watering by hand, but just finishing up the code for the phone app that will let me do it at the push of a button.... first step before letting it go off on its own :)

Hope your vacation isn't too soon :) The temp should be easy enough, but you don't want to come home and find your walls soaked with flood water :(
 

odam2k

Well-Known Member
New feature idea...

Movement Alarm

I already have the motion sensor (PIR) to detect movement at night and turn on the LCD backlight, but now with cell phone control...

Alarm can be set from phone
Alarm can be disabled from phone

If alarm is tripped, phone is alerted - you have 60 seconds to respond or piercing alarm sounds - enough to wake us, or scare burglar away hopefully - only last 60 seconds or so - can be shut off, or disabled with button on module in case you forgot your phone.

If tripped, then once I have the camera hooked up, it can take pictures and send them in real time to phone


Or the whole thing can just log that someone was there, in case you think the kids are sneaking in and snatching a few budz...

I'm sure it wouldn't take much to go even further, and control a lock on the door, with an entry keypad, and also controlled from the phone.
 

odam2k

Well-Known Member
Almost there...

1722963



Not much room for text on a table. Have to go with Location, Row, Column, but it has the plant number on the right...
I still have some coding to do because the button is not tied to the selections like it is on a web form. I need to keep this screen synched with what the ESP8266 sees as selected, so that when it gets the button press, it can loop through and water the selected ones only...

Not sure how much time left to complete, but next to me, you'll be the first to know when it works!
 

odam2k

Well-Known Member
You know one thing I could never do, that has been a requirement for my job for the past 20 years at least?

I cannot, to save my own life, estimate how long it will take me to write a piece of software.

Many years ago when I was self employed, I was asked to do a proposal for a piece of software for a company. I did, and submitted it. They liked my proposal, but said they needed it in half the time, but would pay twice the money...

Later on, my mentor, who I recently mentioned in another post, used to tell me to work out your honest estimate, and then double it, and add a week.

Another lesson I learned, never promise something fast, because a customer will always be dissatisfied if you're late, but always happy if you're early, especially if early mean fewer billed hours :)

Anyhow, to this day, I still can't do a proper estimate. I mean, how can you possibly account for all the things that can go wrong... and they always do... My boss used to come up to me and say "I have a 5 minute job for you". Sure, on paper it sounds like 5 minutes, but it never is...

I wonder if this is because I'm a pessimist?

Lookit that, it's almost 4:20am - gotta get ready... :bong:
 

odam2k

Well-Known Member
I decided that since the info for the list of plants to be watered comes from a database table, I would use that table to also maintain the state of the selections in the menu.

This is a problem because this does not account for more than one app running and using this feature at the same time.

The chance that I will ever need to use two phones is pretty slim, however, it IS something I'll fix, just not super high priority...

Any how, when I select or deselect an item on the app, an event fires on the ESP8266 and I mark that row in the database as selected or deselected. When we repopulate that table (every 5 minutes) it also selects the correct items in the table.

Now when I click the button to Water the selected plants, it can just loop through the database table, water each one that is marked as selected, then mark it as watered, and move on.


For now, I still need to water by hand, but this alerts me when I should do so, and allows me to mark them as watered once I do.
 

odam2k

Well-Known Member
Another positive note on Blynk. The android app seems quite easy on the battery even while constantly connected. I sort of expected to see quite a difference.
 

bobinca

Active Member
Are you relying on only the sensor data for watering? When designing my system I'm trying to think of as many backup plans as possible. I worry about a faulty sensor and was thinking of have a configurable min/max time between watering, each plant would have have a configurable amount of water, that way veg and bloom can have separate reasonable values. If a min or max was used then of course I would like it to e-mail me.
 
Top Bottom