Close

The hardware is complete

A project log for ESP32 Greenhouse Monitor

Collect temp/humidity, soil moisture, sunlight data to be stored on local web server

Jeff TaylorJeff Taylor 04/02/2018 at 15:320 Comments

Looks like it's been a couple months since my last update.  Too many simultaneous projects, however with the weather changing I thought I would try to get some plants going in the greenhouse despite the overnight lows being around freezing temps.  If only I had temperature controlled heaters in the greenhouse... :)

I had to transfer the ESP32 to a larger breadboard to accommodate the 74HC595 chip and then check over the wiring.  The 20A relay board I got has a jumper on it to select if you wish to use active-low or active-high inputs -- in my case I chose active-high so that the default state at power-on will be for all the relays to be off.  I had to make some minor changes to the code including setting the pin numbers I'm using to talk to the 595, but then all the relays lit up.  So at this point it appears the hardware is functioning just fine.  Previously I had just randomized the changing of the relay status to show the outputs, but I wiped out that code and put in some requirements to trigger each relay (as a precursor to how I want to set up the interface for defining the relay settings).  For sitting at my computer desk the settings were fairly simple.  I plan to use two heaters, a fan, and a switch for the lights.  I coded the first heater to come on if the temp drops below 75F, and the second comes on when the temp drops below 72F (in the greenhouse I will probably use temperatures of 55F and 45F).  The fan is currently on all the time, but to save on electricity I thought I would cut that down to 50%, so I added a line to switch the fan on and off every 10 ten minutes.  Finally I programmed the light switch to be on between 6am-7pm, but only if the light sensor is below 25%.  This set of settings allowed the relays to change during the day and everything seems to be responding as expected.

So the software is functional now, although not really complete.  I also added some code to include the relay statuses in the data sent to the server.  I think my next software focus will be on the server side, to actually collect and record the data being sent from the ESP32.  I have also noticed periodic lockups of the software so I'm thinking perhaps having the ESP reboot itself once per day, preferably in the late afternoon so if the reboot fails then I can reset it manually when I get home from work.

The last step on the hardware side is the electrical outlets to plug in my actual devices.  I have seen metal junction boxes that will hold four outlets (to match my four relays).  I have two extension cords going to the greenhouse so I will wire it so that each pair of outlets plugs into one of the cords, however each socket will be individually controlled by a different relay.  I was trying to find cheap power cords online that I could use for plugging in to the cords, then realized I already have a source for that -- I have a ton of computer power cords laying around that should work fine.  They seem to only be 18AWG, although I would have preferred 16AWG, but since I'm splitting up my power requirements between two extension cords I think these will be fine.

I will try to get the code and some schematics posted soon, in case others are interested in trying this out for themselves...

Discussions