September 2019 Update

New! We're moving to the new forum!

ALL new Blog posts will be on the forum.

Please join us there.

This Blog will no longer be updated...

Wednesday, September 18, 2019

The Blog is Moving!

I like the format better on the forum software, so I've moved the blog to a new site, and have been busy getting it ready.

The forum, located at https://growbywire.boards.net/ will be the focal point for everything to do with Grow By Wire from now on.

Eventually I will copy some of the pages over, such as DIY instructions, but this blogger.com site will remain online for now.

So, update your bookmarks, off you go, and don't look back!

Go, now!

Sunday, September 15, 2019

ESP-01 Programming Board


I made up a couple of these back when I first got the ESP-01's, but I guess I never documented it, or bookmarked any pages, or anything.  I ended up reverse engineering mine, but had trouble with the color codes on the resistors, so to verify, I scoured google, and eventually found this set of instructions which included the following schematic:




So, combining his schematic, with my existing programmers, I drew the following wiring diagram based on the component placement and board size I wanted. On the right, you can see I'm about half way through assembling it. 




Once I verify it works, I want to build a board with 6 sockets for the ESP's one power supply for all, so it will be like a mini server farm :)  Somehow I'll select which one is connected to the tx/rx of the Serial/USB adapter for programming... but first, will this one work?


Followups posted on the forum at https://growbywire.boards.net/thread/18/esp-01-programming-board

Surrounded!

I'm sitting here at 6am, surrounded by the disassembled components of half the system.  I started off by wanting to build an esp-01 programming board, so I look back through my notes, photos, bookmarks, and no reference on how to build one.  I must be going color blind, because I can't make heads nor tails of the color bands on the resistors.  They are pullups to 23.3v and I believe they would be 10K Ohms, but, the color bands definitely is not 10K, and they measure about 8.8K on my meter.

I only found one schematic online that actually used resistors and they are 10K so that's close enough...  At this point, I started looking at the custom shields I had on the Switch Module, the Auto Watering Module, and the sensor module, and that's what led to all these parts scattered about.


I'm used to having one torn apart and not functioning, but three?  I really didn't accomplish much last night, but I guess I'm gonna have some good days, and some bad, er, not so good days.... It wasn't a bad day, nothing is broken, just disassembled.

Actually, the night started with me wanting to work on the Switch Module v2 code, since it doesn't do lights yet, and now that I bought that contactor, I'm ready to bring the rest of the working code over from version 1 and let it control the light in the flower tent.

The weather is turning, it's not so hot any more, so soon the A/C will come out, and a box fan goes into the window, along with my fancy light baffle, made from black dollar store foam board. That fan needs to be controlled by the Switch Module. Last but not least, I'll need it running the Clone Mister soon.

Saturday, September 14, 2019

Oops! Now what?

Posted: 12:40am

Well, I did it, I knew I would eventually...

The old Switch Module that has no usb plug on it due to my clumsy feet catching the usb cable and yanking it off the desk, ripping the usb connector half off the board, is now my development board until a new one arrives. Of course, that left only OTA as a method to load new sketches.

I just uploaded a sketch to the 8266 that throws an exception immediately and reboots the 8266 without loading the OTA server,  No more OTA updates, no updates over USB...

The Wemos does expose a bunch of pins from the ESP8266 which I think I can use to upload a sketch.



The pins are labeled, so that's not a problem...

Here is the ESP-01 version of the 8266, it contains fewer pins, and requires setting it into programming mode by shorting certain pins, and adding resistors.  The second picture shows the custom programming boards I made for the WebServ er (single board) and maintenance server (dual board)



I'll be doing up some more of the programming boards since I just got 4 more ESP-01's as spares, and I'll do a DIY build post on it with schematics and steps. It''s a simple task.

So I wonder will I need to make up a programming board to plug into these pins, or is it already done for me, I haven't been able to find any info on doing it this way, so we'll see how it goes.

Followups posted on the forum at https://growbywire.boards.net/thread/15/oops


Friday, September 13, 2019

Time to recalibrate?

Since I added the 5v external power supply on the Sensor Modules, it has had an effect on the readings of the sensors. The system looks at historical data to determine the soil moisture as a percentage. If the highest value ever read on a sensor in a pot with dirt was say 800 and the lowest was 200, then rather than calculating the moisture level as a percentage from 0-1023 we would calculate it as a percentage from 200-800. So if the reading on the sensor was 400, that would be roughly 40% if calculated between 0 and 1023, but if you calculate it between 200-800, then 400 is actually about  33%.  With the new external power supply, this could affect the readings, so the sensors should have been re-calibrated to find their values in dry air, and sitting in a glass of water, as this will affect the final calculated value, or percentage.

Here is what I'm seeing now on the web page showing the Grow Room Overview, this is only the Flower section.


There are two plots which are pegged at 100% and have been since they were last watered. It seems the readings now are higher than before, so it will be a while before it sinks below the calibrated WET value, and continue to report 100%. 

Re-calibration involves pulling the sensor out of the pot, touching a button on my phone to calibrate the value in dry air, then putting the sensor in a glass of water, and touching another button. Pretty simple actually, assuming you have easy access to the sensors :)

Also, the estimates of time till next watering are way off, and in some instance, non-existent, they are also based on historical data.


OTA Updates timing out

Now that I've moved all the processing from the Mega 2560 to the ESP8266, the Over The Air firmware updates ate timing out a lot. I presume this is because the 8266 is busy communicating with the 2560 and doing database reads and writes.  Sometimes it can take 5 or 6 tries :(

The unit I'm using for development no longer has the usb connector on it (see previous blog post) it was the switch module, and I caught the cable on my foot and yanked it off the work table, and ripped the connector half off. So now to program it, I use the tx/rx pins on the 2560 (and have to co-ordinate hitting reset and upload at the same time) but without using the CH340 USB-SERIAL chip, I cannot access the ESP8266 except by WiFi using the OTA upload. The ESP's pins are available, but I haven't explored whether I need to use resistors or anything like I do with the ESP-01 boards.

So, my best solution is to keep OTA working.

The solution I came up with takes advantage of the tight coupling between the GBW Terminal software and the Modules themselves. They talk back and forth as it is, exchanging information while you are connected via the USB port. I added a button on the terminal that will pause everything except the esp8266 web server. 

Here's how it works.  Click the button, and it sends {{pauseForOTA}} to the 2560 Module over the serial connection. The 2560 then sends the command PAUSE4OTA to the 8266 and waits for an acknowledgement. It will try 10 times, then abort, and go back to normal processing. If the 8266 acknowledges the command, then the 2560 will no longer do any processing in the loop() method except for a delay(0) and echo received characters to the Terminal program. The only processing the 8266 will do is to run the web server, which will output status info to the serial port, which will be passed to the terminal by the 2560. When the update is finished, you just reboot the whole thing and it goes back to normal processing.

So far, seems to work, sometimes updates are really fast, sometimes slow, but they are much more reliable now.

Windows Updates

I've noticed for a long time now, many years, that when there is a windows update waiting on your computer to be installed, you'll notice your computer misbehaving... Can't put my finger on a particular thing, burt I know that when things aren't working the way they should, I reboot my computer, I've got a LOT going on here with programming, monitoring, running servers, etc. It runs fine normally, but every once in a while, it just needs a reboot, and often when this happens, there's an update waiting to be installed, and my options include update and restart...

That's today's RANT :)