Arduinos In The Grow Room: My Project

Sunday, June 16, 2019
The Misting of the Clones - A Reality!

Here's my original blog post:

the misting of the clones...


The point of this little project was to find a way to automate misting the clones to keep the humidity up while they are rooting... Right now I do it whenever I think of it, probably every 6 hours or so...

I wanted to find a way to automate it so it could just give a couple spritz's every hour or so...

It looks like this will work, I'll need to set up something on the "switch module" I guess, that sounds like a logical place, it will just toggle a servo to/from set points every x minutes...

Anyhow, here it is...


 
Monday, June 17, 2019
Monitoring Serial output from all these arduino's

In the grow room I have 4 Arduinos hooked up through a USB hub to a laptop. I can remote desktop to that laptop from my workstation, and run the Arduino IDE to monitor the serial output of any of those 4 modules. In fact, I can load 4 copies of the IDE and monitor all 4 modules at the same time...

Now that I'm programming Windows again, I decided to write my own terminal program to monitor the output... It's very simple, all it does is open the serial port and anything it receives, it prints out... Other than grabbing the Com Port, Baud Rate, and DtrEnable flag from the command line, that's all there is to it.

Untitled.png



I'll have to add the ability to type into it so I can set up credentials, but that should be pretty simple.

Now, the beauty is I can take this code, add it to the RPC Server which runs on the laptop in the grow room, and it can send the serial output back to the Desktop App, how cool is that :)

I can also add color so certain items stand out... maybe even cursor positioning.. I love having so many choices :)
 
Tuesday, June 18, 2019
GBW Serial Terminal - First Look

I took the terminal and turned it into a WinForm program, meaning it has a window to run in, not just the DOS window... It also allowed me to add buttons and checkboxes to control it rather than having to use a command line.

The first thing you will probably notice is the color... Yeah!

I used a Rich Text Box to display the data from the serial port, and as I read the data, I process it before writing it to the display. This processing looks for specific TAGS in the stream of data. At the moment, it supports three...

{{HIGHLIGHT}}

{{WARNING}}

{{ERROR}}

Pretty simple, when it sees a tag, it adds the rest of the line (up to a CR) and then SELECTs that text, changes the color, and then continues...

This is written in C# using Visual Studio 2017 Community edition (FREE)

GBW_Serial_Terminal.jpg


This shows the output from the Maintenance Module, I added the three sample lines just for this screen shot. The colors will be configurable... including the terminal background and text color...

Within the Maintenance Module Code, it's simple to add the color to a line...

Right now, I added this at the top of the program:

bool colorSerialOutput = true;

Then anywhere I want to highlight something...

Serial.print(logDateTime());
if (colorSerialOutput) Serial.print("{{HIGHLIGHT}}");
Serial.println("This is a Highlight");

The boolean colorSerialOutput will be set during a handshake between the terminal and the module. Whenever the terminal connects, and it receives data, it will send a command sequence to the module identifying itself, thus enabling any custom features I end up implementing.

I will also try adding the ability to connect to the RPC Server and interact with the serial ports on the laptop in the grow room.Basically right now the RPC server runs the commands to upload firmware to the arduino modules, and takes the output and sends it back to the main program here on my workstation. Having the RPC server open a com port and send/receive data will be exactly the same as I'm doing it here, except instead of sending the data to the rich text box on the form, it will send it back to the workstation via the RPC network pipe...

Since the modules remain plugged in all the time, they are always on the same com ports, even after rebooting everything. It CAN change, but usually only when you plug into a different port... So, that means I can create a database table to hold the com port connection info for each module, and then rather than selecting a com port t the bottom, you will select a module to connect to...

THAT will be cool :)
 
Killing it man, keep going!

Thank you! Next up, I'm creating a standalone winform Configuration utility, all data will be entered/modified through it. Plants, sensors, plots, pumps, lights, switches.... I'm going to keep it seperate from the firmware updater, just to keep the code less complicated, and keeps like tasks grouped together.

Also, I did manage to get the handshake to work when the terminal connects to a module, the module recognizes the terminal, and turns on the enhanced features... My imagination is just going wild these days, lol...
 
Wednesday, June 19, 2019
GBW Serial Terminal - Update #1

Lot's of improvements...

I've added more options, and whenever you change one of those options, they are saved using the properties.settings It also saves the form size if you change it...

During the handshake with the module, it will receive the modules name, and put it on the form title along with the com port. This helps when you have many terminals open to different modules...

I also added a {{CLS}} tag to clear the screen... I'm sure I'll be adding many more....

Here's the latest....

Untitled.png


This terminal offers all the features (and baud rates) that the Arduino IDE Serial Monitor does...
and more!

I still want to try making it work across the network and allow me to connect to my modules hooked up to another laptop....

You may have noticed the date, 1970/01/01 on the first line with a date... That's because this is my development module, and doesn't have a clock on it, it gets the time from the MySql database, so until it gets on the network, it doesn't know the time... You notice the identifier on the left side [M03] is for Module 3, and the first line is [M??] because it hasn't looked itself up in the database to know it's own ID. It looks itself up using it's MAC address...
 
I've been thinking more and more about making Grow By Wire available to others, but I'm just not sure how to go about it. It's such a large system, built in place, so I don't even know how to install it :(

If there is any interest, I'd like for it to be open source, but I've no idea how to manage that...

So, if you like what you've seen here (and you're STILL following along), are highly proficient in c++ and c#, knowledgeable in managing open source software, and have lots of time to fiddle, I'd love to hear from you! I know, that's asking a LOT!

I'd really like to share everything, others may not want to actually run it, but might find inspiration in either the design, or the code.
 
In order to connect to any module, anywhere, I need to keep track of where they are hooked up.

So I created a table to define the RPC Servers, each one gets an RPCServerId, and using that Id, I store the name of the RPC Server (GrowRoom, Development, etc) and it's IP Address and RPC Network Port.

There is a Module IP table which contains the live IP Address of each Module, so I've added the RPCServerId field, which if > -1 means it is hooked up to that RPC Server via USB.

The only thing missing is the Com Port for that USB connection. I added a ComPort field to the Module IP table as well.
Now, you may ask, how can a module know the COM Port it is hooked up to?
Well, during the handshake between the GBW Serial Terminal and the module, the terminal passes the port name to the module, and the module then updates the table...

Pretty cool...

Next step, rather than selecting a com port when using the terminal, I want to make it so I just select a module name, and it will determine how to connect to it... It might be a local com port, or it may have to connect to the com port via the RPC Server on another computer... it will be seamless...

Granted, this isn't a feature which directly affects the grow room, but it's a cool idea and I just want to flesh it out...
 
Saturday, June 22, 2019
The Misting of the Clones - A Solid Platform

Here's the last blog post on this project:
The Misting of the Clones - A Reality!

Here's a link to the DIY Page for this project. (Updated with these additions)
DIY - Automated Clone Misting

Because the servo is fairly heavy, this whole thing just tips over unless it's full of water. I'm also a little worried about how long the water will last in the bottle, probably a while, but, I decided to extend the "pickup tube" through a hole in the side of the bottle. This will allow me to put the other end in a larger reservoir of water. This also allowed me to drill a hole in the bottom of the bottle and screw the whole thing onto a block of wood which will hold everything in place.

spritzer_002.jpg

spritzer_003.jpg
 
Hey @Latitude17

I turned this into an I2C MistSprayer Module... Yep, I2C...

It was actually a perfect fit for this, for a couple reasons...

The Servo library interfered with timers on other things in the Switch Module, and the general timing of things... The switch module needs to be kept free to check on other switches, not be tied up squeezing a trigger on a spray bottle... So, the Switch module simply sends a command to the I2C Slave device (Arduino Pro Mini) and then goes about it's own business... There's not even any feedback, I don't feel any need for it...

The switch module will eventually pass the number of squirts (currently it does 3 squirts every 15 minutes) at whatever time interval you configure. I need to make some significant changes to the Switch Module to support something like this, fully configurable, but for now, this works...

Oh, and with my other I2C modules, you need to load special firmware to set the I2C address and save it to EEPROM. Starting now, I'm using a model similar to the other modules, you can set it via the serial interface (using a terminal) In this case, at any time you can simply type "i2c=107" for example, and it will change it and save it to EEPROM.
 
I'm gonna call this thread dead... I think @Latitude17 is the only one who even reads it any more :)
I can understand that, it's been a long one, over 800 posts, mostly me rambling on... I also realize it didn't really turn into a DIY, it was more DI(My)self not DI(YOUR)self...

I'll definitely keep my blog going, the project isn't going to end. In fact, I will be focusing on how I can turn this into an Open Source system, free for anyone who wants to use it, and most importantly, easy to install and run....

On my own this is going to take a while, a long while, but in the mean time, I plan on continuing to innovate with new ideas, and new ways of doing things.

I'm not leaving the site, in fact, as I turn this back into a DIY, I'll be posting the individual projects right here but in their own thread.

Once again, a big thank you to all who contributed, or even just posted in the thread...

If you stumble upon this thread, and made it here, I invite you to check out the latest over on my blog....
 
That's because this is my development module, and doesn't have a clock on it

Do an i2c broadcast time packet from a single RTC source ;)

If there is any interest, I'd like for it to be open source, but I've no idea how to manage that

Easy enough for you to open source it, and not lose any control - just put it on github, make it public, and encourage pull requests for anyone that wants to contribute. it's that easy.

I turned this into an I2C MistSprayer Module... Yep, I2C...

Hells yeah! haha

I'm gonna call this thread dead

I'm not sure that I am the only guy following along, but attention spans do tend to diminish after 24hrs haha. Good luck on your continued success, I'll miss the catch up reading.
 
Do an i2c broadcast time packet from a single RTC source ;)

The modules really don't care about the date and time, they only use it in the serial output for the log style view... Any dates and times used by the system are generated as data is inserted into the database, this ensures precision co-ordination across all modules. I noticed early on that the clocks I was using seemed to drift quite a bit, and started resetting the time on them from the database, and eventually removing the clocks altogether...

Easy enough for you to open source it, and not lose any control - just put it on github, make it public, and encourage pull requests for anyone that wants to contribute. it's that easy.

That part I can manage, but it's the code itself... I've been writing it "in-place" for nearly a year now, and I wouldn't have a clue where to start in telling you how to install it :( Once past that hurdle, then there is the managing of the code, what to do when people want to check in changes, seems like it could be a lot of work...

Hells yeah! haha

I knew you'd like that :)

I'm not sure that I am the only guy following along, but attention spans do tend to diminish after 24hrs haha. Good luck on your continued success, I'll miss the catch up reading.

Watch for the odd post here, I'll still be around, but it just seemed to be a waste copying and pasting all my posts from the blog... people can subscribe to the blog, so no excuse not to continue to follow along :) I understand not adding another site to check all the time...

Thanks for all your input, you gave me tons to think about!
 
Here's a list of new posts from my blog if you're interested in any of em...

The Firmware Updater and the Serial Terminal are really taking shape...

Monday, June 24, 2019
A bit about watering...

Tuesday, June 25, 2019
GBW Serial Terminal - Update #2

Tuesday, June 25, 2019
GBW Serial Terminal - Update #3

Thursday, June 27, 2019
GBW Serial Terminal - Update #4

Saturday, June 29, 2019
GBW Serial Terminal - Update #5 (final?)

Sunday, June 30, 2019
Bit of a redesign re: Firmware updates

Monday, July 1, 2019
Firmware Updater - OTA Working!
 
Had a major breakdown today... Part of the tools I rely on every day for coding has stopped working... I'm not sure how I'm going to go on...

I sat down earlier, popped in my ear buds, pulled up VLC, clicked on my favorites folder, cranked up the volume, and almost fell over due to the one sided blast of Metallica!

One of my ear buds gave out! This is my fairly expensive pair I've had for years, amazing bass, crisp highs... perfect for my old ears... I count on these EVERY day and night, I always have em on and cranked up... I figured it was frayed wires where they enter the bud, so I dissected it, rewired it, soldered it up nicely, and still no go... so I cut the wire shorter, still no go, so I suppose the speaker itself is shot... I have a pair of dollar store ear buds I'm using now, THEY SUCK! I'm not sure how this is going to affect my programming.... There are only about a dozen Metallica songs I like, and I listen to them over and over, and now it's like listening to them on AM radio :(

End of the month I'll have to budget some funds for new earbuds, but until then, it's gonna be a rocky road...
 
By the way, I noticed this thread has had 10K views, that's 1000 views in the last 3 weeks or so... So lot's of views, just no posts... Should I continue to copy my blog posts here? If you want that, you'll have to speak up! :)
 
End of the month I'll have to budget some funds for new earbuds, but until then, it's gonna be a rocky road...

I found my old "Cambridge Soundworks" computer speakers from the 90's... There are 4 tiny speakers (I'm only using 2) and a powered subwoofer, and they still sound amazing!

My wife is away visiting her mom for a week, so it's just me and the dog, and she doesn't mind the music playing at all hours :) Just hope I'm not disturbing the neighbors... I don't think so...

Rock on...
 
Wednesday, July 3, 2019
Software Integration...

In order to do the firmware updates for modules connected via USB cables, I need to know the COM Port assigned to it. For the most part, it doesn't change unless you move the cable, although it can, and eventually will change... Keeping this in a configuration table means having to go update it whenever the com port does change.

So I had an idea.... since I'm using the Serial Terminal to monitor the modules, I have to select a com port in order to connect with a specific module, so, when they do connect, the module passes it's Id to the terminal, and the terminal then updates the database with the current, and correct COM Port for that specific module. If for some reason the port changes, and the firmware update fails, all you need to do is load the terminal, pick the new COM Port, connect and verify it's the right one, and that's it, the terminal has already updated the configuration for the Firmware Updater. The terminal also checks for the IP Address of the machine its running on, and looks it up in a table to get a computer Id, so it updates the module with a Computer AND Com Port... The Firmware updater will need that info...

So today, to bring this full circle, I had the idea that since I can grab a list of modules which are plugged into "this" computer (whatever computer I run the terminal on) I populate a combo box with a list of modules by name... No more having to remember which module is on which com port, just select the module you want to connect to, and it sets the proper com port and baud rate, and connects...

Untitled.png
 
Back
Top Bottom