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...

Thursday, November 15, 2018

Development Updates

Major major rewrite!   I've spent the past month completely rewriting the code for Grow By Wire.


I've been using Arduino Pro/Mini boards as my modules, giving me 8 analog inputs on each. I was also arranging them so a MASTER would trip a relay providing power to all the sensors on not only itself, but 2 more SLAVE modules connected via SoftwareSerial connections.  This meant that the power was ON to the soil moisture sensors for the entire time, facilitating faster corrosion on the probes due to electrolysis.

There were 3 MASTER modules, and 2 SLAVE modules, so 5 Pro/Mini boards, one of which used Bluetooth to communicate so it could be placed remotely.

Data from all these modules ended up on an Arduino Mega (WeMos Mega with ESP8266), which uses hardware serial to communicate between the Mega and ESP8266. The ESP8266 then connects to a MySql Database running on my home network via WiFi.

You can imagine the software required to not only scan all the sensors, but to coordinate all that data all the way back to the database, through all those modules...

The new design...

I'm now using just the WeMos Mega with on board ESP8266 (I actually have 2. but only one in the grow room at the moment, using the other for development. I'll order a couple more, they are under $20 each.

Each sensor has an appropriate voltage divider and so the wire terminates in a 3 pin Dupont connector with GND, VCC, and Signal.  The Signal is hooked up to an Analog Pin, GND to Ground, and VCC to a digital pin, which then allows me to toggle the power TO A SPECIFIC sensor in order to measure it's value.  Since the pins can only handle ~40ma, I have also made a"transistor switching module" modules, small PCB with transistor to switch power provided externally. If I need more power than the transistor can supply (~600ma) I can simply plug in a true RELAY, and switch either DC or A/C power (lights, pumps, etc)

Here is what my "voltage divider modules" look like:

Here is what my "transistor switching module" look like:

The Arduino provides GND and Power (from a digital pin, so it can be switched on and off) and reads the Signal on an Analog Pin.  The Power provided is ONLY for switching the transistor, NOT for the sensor itself. The sensor power comes from an external source (actually, just the 5v pin on the Arduino Mega for now) that is capable of providing enough current for the sensor, without blowing up the transistor.

Ground is passed straight through to the output pins, as is the Signal.  The Arduino Power (from a digital pin) is connected to the BASE of the transistor, so when it is HIGH, the transistor will allow current to flow from the collector to the emitter. The collector gets its power from the input on the right hand side of the board, and the emitter outputs it on the Output VCC Pin (2);

In order to hook everything up to the Mega, and keep the wiring from becoming a nightmare, I created some simple "breakout boards" for the Analog and Digital pins. This creates a manageable wiring harness.

No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed