How to Create a Smart Greenhouse with a DIY WiFi Timer/Controller: Page 2 of 3

You can add IoT functionality to any size greenhouse. Here's how to build an Arduino-based timer/controller for controlling lighting, temperature, and humidity.

Two additional timers' functions, labeled L1, L2, each allow two sets of timing qualifications: starton/stopoff1 and starton/stopoff2. Each has an optional temperature trip. These are intended for main or grow lights and fixed time based fans. L1 and L2 temperature criteria are taken from ‘assigned’ sensor. S1 for L1 and S2 for L2 and are configured independently or may be not used at all. For example, a supplemental grow light can be configured to start at 7:00 AM, turn off at 10:00 AM and then on again at 4:00 PM and off at 8:30 PM. The second output could then be used for main lights or for a supplemental night fan coming on at 9:30 AM when the temperature is greater than 69 degrees, off at 12 noon and its second timer set on at 10:00 PM and off at 3:00 AM if the temperature is less than 65 degrees.

Parts List:

Part Digi Key# Notes
     
1 Ardurino Nano 1738-1017  
ESP-01  module optional N/A requires 3.3 volt related Interface
ESP-01 Header  module optional N/A provides 3.3 volt interface
1 HC-05 BT module N/A  
2 HC-12 module optional N/A  
1 RTC module 1738-1054-ND  
1 LED C503B-RAN-CZ0C0AA1  
8-2 wire headers (single in line) 277-1667-ND  
4-2Pin male header 732-5315-ND  
2 NPN transistors (multiplexer) 2N3904FS-ND   
9-4.7 K ohm resistor 311-4.7KLRCT-ND   805 SMT
8-180 ohm resistor 311-180CRCT-ND  805 SMT
1-680 ohm resistor 311-680CRCT-ND  805 SMT
1 1N4001 diode 641-1310-1  
33uF/25V capacitor 493-10938-1-ND  
0.1uF  capacitor 478-4855-ND   
     
Perf Board, single sided clad, 0.1” pattern V2010-ND   
   OR custom PCB N/A see text

The Bluetooth and Arduino USB link can be used both to monitor the link report and to set operational parameters. All parameters, including the override settings, are stored into a non volatile EEPROM/Flash memory and are scheduled into a working register array at power up. (Set once and pretty much ‘forget’).

Each M(ister/fan) selects its temperature and humidity percentage criteria. Each mister/fan can configure up to 2 HCT11 sensors as their qualifying source. Each output allows either sensor, the average of both sensors, or neither sensor to be used. There is also a serial parameter entry to qualify each output with temperature and humidity trips settings and a third parameter to select whether both settings or either setting is required to be set for the M output to be qualified.

The L1, L2, M(ister/fan), M3 thru 5, and pump P6 thru 8 outputs are also coded to provide individual, serial link based override controls.

An alarm pin is asserted when the difference in sensor readings is greater than 8 degrees fahrenheit or greater than 8 percent humidity.

The WiFi uplink, when available, is dedicated to an associated ThingSpeak IoT platform channel, allowing results to also be graphed and monitored anywhere an Internet connection is available. The WiFi connect status is included in the link report.

Operational Parameters are used to configure all functionality. A ‘?’ lf/cr provides the parameters/list.

The 2 L1/L2 functions include 2 set of 2 timing parameters, followed by L1 temperature trip and the L2 temperature trip. The 3 M(ister/fan) functions each have 8 parameters.

In addition functions 10, 11, 12 and 13 allow WiFi and report schedules to be set, sensor temperature offsets to be included, and overrides to be implemented. There is an entry timeout and a ‘x’ lf/cr will also exit the menu(s).

For each Timer (Ltime1,2 outputs):

L1time1 TIME/Temp

2$start1Time$stop1Time$start2Time$stop2Time$Set1Ftrip$Set2Ftrip

Where set trips are: 0-ignore

                                  >0 greater than

                                  <0 less than

eg; 2$9:20$10:45$18:0$20:15$0$-67$

result in:

               func 2 L1 9:20AM to 10:45AM, tmr only

                                6:00PM to 8:15PM when less than 67 degr

For each of 3 M(istr/fan) outputs): TIME

eg: MistrTim3

         4$ start1Time $stop1Time $ on2Time $ off2Time$

              if Start=stop-> ignore if offTime=0->non cycled

              time qualification

eg; 4$9:20$10:45$6$20$ TRIP Qualification

results in:

func 4 (M3) 9:20AM to 10:45AM,cycled 6 minute on 20 minutes off

For each MistrFan(M outputs): CRITERIA

eg; 5$2$69$-40$0$

results in:

func 5 M3 Reference average of S1 and S2, Temp>69deg,H<40%,both trips must be met

JP1 may be shorted to use a single sensor for both S1 and S2 related criteria. (The sensors reads are staggered 30 seconds apart.)

Function 10: Report SCHEDULES

10$WiFiSched$ReportSched$

A 0 schedule will result in report or uplink only if outputs are changed(delta mode report). Time values is entered in minutes.

eg: 10$0$1$ results in

Function 10, WiFi uplink scheduled on change ONLY, serial based report sent every minute.

Function 11: OVERRIDE

eg; 11$55$ results in ‘disabling’ All overrides

11$99$ forces ALL to override = ‘in-active’

11$4$1$ forces MistTim4 to active

11$4$2$ releases override on MistTim4(only)

Function 12: Sensor Temperature Offset

12$0$-1.5$ results in S1 offset = 0 and S2 offset = -1.5

Offsets are added to sensor’s measured values and are reported and used in criteria.

Function 13: WIRELESS DATA

-generates a list of wireless characteristics to be set

Because Wifi name, password and Thingspeak key(s) are all unique variables they are also required to be set manually.

eg; 1$BobsmagicWiFi$

results in the wifi name being stored as BobsmagicWiFi.

All name data fields may be up to 30 characters and MUST be terminated with ‘$’ char.

14 Report : VIEW DATA

ViewReport(F(14)) forces the report to be displayed over the serial link(s) on demand.

**

The report request includes status for each output, alarm, other error indications and override statuses are also included in this report.

The WiFi report, when available, is uplinked to the ThingSpeak service. This a web-based platform providing both display charting of uplinked parameters and reporting features. A free registration is available as well as multiple other packages. The free version allows over 3 million data transfers per year. Each package offering, including the free version, are based on annual registration. This requires a registration with an email address. You would need to then request and open 2 channels, record the provided write keys for each channel, and then enter these into the Timer application as ThingKey1 and ThingKey2.

The graphed data may then be optionally customized with labels and names. The several other reporting features can also be added at no cost. These include tweets and emails based on criteria such as temperature too low or alarm set. It provides a MatLab-based language compiler to provide additional processing, if desired. Additional accounts and feature and resources are available with paid registrations.

The uplinked WiFi list includes average temperature and humidity, M(ister/Timer) output statuses, the L(ight/Fan) output statuses, a binary status byte reflecting the bits found in the report format, the MistrPump related statuses and the Wifi update timing setting.

The sensors inherently provide centigrade but I have included scaling, in code, to allow temperature to be read and reported in Fahrenheit. To disable the conversion to fahrenheit short the analog A6 pin, on the Arduino Nano. This is brought out as a pin on J2.

Comments (1)

Please log in or to post comments.
  • Oldest First
  • Newest First
Loading Comments...