HVAC for Root Cellar

Introduction: HVAC for Root Cellar

  1. This is a device to monitor temperature and humidity in a two room cold cellar. It also controls two fans in each room which circulate air from outside into each room, and communicates with a smart switch in each room connected to an ultrasonic mister. The aim is to control the temperature and humidity in the room, ideally to maintain the temperature below 5C and humidity about 90%.

The device uses an ESP8266 microcontroller to read the temperature and humidity sensors, to drive the fans, and to present the information over the local network in a web page.

This instructable will not get into exact detail because:

  1. I forgot to take pictures as I built it, and it is installed at the client's house now!
  2. Your situation will be different. This is meant as a reference design, not to be exactly duplicated.

Supplies

The parts I used are:

  • NodeMCU 1.0 ESP8266 microcontroller. Any ESP8266 will work, as long as it has enough free digital input and output pins for your design. It is not trivial to figure out how many pins ARE free, some are exposed, but used during booting or serial transmission.
  • prototyping board
  • wires, connectors
  • female header socket to hold ESP8266 and make sensor connectors
  • DHT22 temperature and humidity sensors
  • DS18B20 temperature sensor for outside use
  • deconstructed CAT5 cabling for sensor wiring
  • 690 ohm resistors to limit FET gate current
  • 10K resistors to pullup DHT22 data line
  • 2.2K resistor to pull up DS18B20 data line
  • IRLU024NPBF HEXFET power drivers
  • San Ace 80 48VDC fans
  • MeanWell 48VDC 75 watt power supply to power fans
  • cannibalized 5v phone charger to power ESP8266 and sensors
  • miscellaneous diodes across fan to prevent back EMF (maybe P6KE6 TVS?)

If you would like additional links to any of these, comment and I will add them.

Step 1: Construction - Microcontroller and Sensor Wiring

    The circuit is constructed on prototyping board, following techniques similar to these.

    1. Layout the components on the prototyping board to allow easy wiring in the next step. I did not leave enough space around the MOSFET drivers, and the wiring got a bit tight.
    2. Solder the female headers into place, by plugging them onto the NodeMCU as a jig to get a few pins tacked down. Then remove the NodeMCU and finish all pins. I only used sockets on the pins which are used for power and input/output. This helped ensure the device was plugged in with the right orientation each time.
    3. Solder a male connector to the 5VDC power supply.
    4. Solder a matching female connector to the board near the ESP8266 Vin and ground pins, and then solder thin hookup wire between connector 5VDC and ground to the matching socket pins. Consider placing this connector so that it is in the way of the USB port of the NodeMCU. You do NOT want to power the NodeMCU from this power supply and USB at the same time. If you put the connector in an inconvenient location, it will be harder for you to accidentally do this.
    5. Solder 3 pin male headers near the ESP8266 D1, D2 and D3 pins. Leave plenty of room for the pullup resistors and all hookup wire.
    6. Construct matching connectors from female headers for the sensor hookups. I used 4 pin lengths, with one pin removed to make the sensors keyed so they could be connected incorrectly. I put the 3.3V supply and ground on pin 1 and 4 of each connector, and data on pin 2. It would be better to put 3.3V and ground beside each other and data on pin 4, so if a sensor was connected backwards, no damage would be done.
    7. Solder the pullup resistors between 3.3V and data lines for each sensor. The DHT22 uses a 10K pullup, and the DS18B20 (at 3.3V) likes a 2.2K pullup.
    8. Solder hookup wire between the ground pins of each connector and to a ground pin of the NodeMCU socket.
    9. Solder hookup wire between the 3.3V pins of each connector and 3.3 pin of the NodeMCU.
    10. Solder hookup wire from the data pin of one DHT22 connector to pin D1 of the NodeMCU socket
    11. Solder hookup wire from the data pin of the other DHT22 connector to pin D2 of the socket
    12. Solder hookup wire from the data pin of the DS18B20 connector to pin D3.
    13. Measure from the planned sensor installation locations to where the device will be.
    14. Construct wiring harnesses of suitable length. I do this by taking apart a length of CAT 5 ethernet cable, the putting 3 of the wires in the chuck of a drill and twisting them together. This gives the new sensor cable some mechanical strength against getting kinked and a wire breaking.
    15. Solder the sensor on one end of the wire, and a female header on the other. Be careful with the pin assignment. Also put some strain relief on each end, for example silicon caulking, epoxy or hot glue. Silicon caulking is probably best - hot glue can actually soak up humidity, and epoxy might get into the connector.

    Step 2: Construction - Fan Drivers

      This design uses 48 volt fans for two reasons:

      • they were available, and seemed to be higher quality / more efficient than the more usual 12V fans in our junk pile
      • they use less current than lower voltage fans, so wires can be skinnier

      Lower voltage fans may be a better choice in your design.

      This section goes into quite a bit of detail on constructing the driving circuit using a 3 volt digital output from the NodeMCU to power a 48 volt fan. Other than the software, this section is the most unique part of the device. You might benefit from building the circuit on a breadboard at first.

      1. Moving over to the other side of the NodeMCU socket, determine a location for the incoming 48V power connector. It should be adjacent to where the power supply will be mounted and a ground rail on the prototyping board. Don't solder into place yet.
      2. Examine the schematic above to understand how you will be connecting all these components.
      3. Place the four 690 ohm resistors close to pins D5, D6, D7 and D8. Don't solder them down yet.
      4. Place the four transistors into the prototyping board.
      5. Place the four clamping diodes into the prototyping board. For each diode align the anode with the drain of the transistor, and the cathode so a wire from it will have a clear path to the 48V power rail.
      6. Four connectors for the fans, the positive (+) connector to the 48V rail and the negative (-) to the source of the FET and the diode anode
      7. Now adjust all those locations until everything is well placed and there is room to run all hookup wires.
      8. Solder the first of four driver circuits into place. It's OK if the others fall out as you flip the board around. The next steps are focused on one of the driving circuits. Once it is functional, you can move onto the others.
      9. Using hookup wire or the leads of the components, solder one fan driver circuit:
        1. one end of the gate current limiting resistor to pins D5 of the Node MCU
        2. the other end of the resistor to the gate of the FET
        3. the drain of the FET to ground
        4. the source of the FET to the anode of the diode and the negative of the fan connector
      10. Using a multimeter check the connections. Check all connections have zero resistance, but especially check there are no short circuits:
        1. NOT zero resistance between the 3 pins of the FET
        2. NOT zero resistance across the fan connector from negative to positive, and zero resistance from positive to negative showing the diode is working.
        3. Open circuit from each FET pin to 48V
      11. Double check the circuit in some other way.
      12. Connect the 5V power supply to the prototyping board.
      13. Connect the negative of your multimeter to ground.
      14. Plug in the 5V power supply. Verify there is 5 volts on the Vin pin
      15. Connect the 48V power supply and a fan. These fans have some startup torque, so hold it down with a clamp. It may start when you power the circuit.
      16. Temporarily insert one end of a piece of hookup wire in the socket for pin D5. Ground the pin by inserting the other end of the wire in the ground pin. If the fan was running, it should stop, as you have turned off the FET.
      17. Move the wire from ground to VIN. The fan should start.
      18. Celebrate your success, remove power, and complete and test the remaining fan driver circuits. They are driven by pins D6, D7 and D8 respectively.

      Step 3: Program NodeMCU and Initial Configuration

      1. Download the attached Sketch files into a new Arduino project, compile and load into the NodeMCU.
        1. the second pagehtml.h file contains javascript in the form of a huge string which resides in the ESP8266 memory and is server with the web page.
      2. Do NOT power the NodeMCU from the board. Disconnect the 5V supply from the prototyping board.
      3. Disconnect 48V from the main board.
      4. Plug the NodeMCU into the socket, connect your USB cable, and flash the NodeMCU
      5. Open the Arduino serial monitor at 115200 baud.
      6. Using a smart phone, laptop or tablet, connect to the RootCellarMon network which should appear as the NodeMCU acts as a wi-fi access point. Password is "opensesame". I'm using the nifty IOTWebConf library to allow configuration of your network's SSID and password.
      7. Then using a web browser on your device, navigate to http:192.168.4.1. You should see a page as shown above but with errors from the sensors. Click on the Configuration link at the bottom.
      8. Work through the configuration screen to set your network parameters SSID and password, then click APPLY. Reconnect to your normal wi-fi network. You should see something like this on the Arduino serial monitor:
        Password was not set in configuration
        State changing from: 0 to 1
        Setting up AP: RootCellarMon
        With default password: <hidden>
        AP IP address: 192.168.4.1
        State changed from: 0 to 1
        Connection to AP.
        Disconnected from AP.
        Request for <your browser identification> redirected to 192.168.4.1
        Requested non-existing page '/favicon.ico' arguments(GET):0
        Configuration page requested.
        Rendering 'iwcThingName' with value: RootCellarMon
        Rendering 'iwcApPassword' with value: <hidden>
        Rendering 'iwcWifiSsid' with value: your SSID
        Rendering 'iwcWifiPassword' with value: <hidden>
        Rendering 'iwcApTimeout' with value: 30
        Rendering 'tasmota1' with value: 
        Rendering 'tasmota2' with value: 
        Rendering separator
        Rendering separator
        Validating form.
        Updating configuration
        Value of arg 'iwcThingName' is:RootCellarMon
        iwcThingName='RootCellarMon'
        Value of arg 'iwcApPassword' is:opensesame
        iwcApPassword was set
        Value of arg 'iwcWifiSsid' is:your SSID
        iwcWifiSsid='nizkiyRoad'
        Value of arg 'iwcWifiPassword' is:your wi-fi password
        iwcWifiPassword was set
        Value of arg 'iwcApTimeout' is:30
        iwcApTimeout='30'
        Value of arg 'tasmota1' is:
        tasmota1=''
        Value of arg 'tasmota2' is:
        tasmota2=''
        Saving config 'iwcThingName'= 'RootCellarMon'
        Saving config 'iwcApPassword'= <hidden>
        Saving config 'iwcWifiSsid'= 'your SSID'
        Saving config 'iwcWifiPassword'= <hidden>
        Saving config 'iwcApTimeout'= '30'
        Saving config 'tasmota1'= ''
        Saving config 'tasmota2'= ''
        Configuration was updated.
        State changing from: 1 to 3
        Connecting to [your SSID] (password is hidden)
        State changed from: 1 to 3
        WiFi connected
        IP address: 192.168.0.155
        State changing from: 3 to 4
        Accepting connection
        State changed from: 3 to 4
        
      9. Make note of the IP address assigned to your device. Above, it is 192.168.0.155.
      10. Reconnect your laptop/tablet/phone to your normal network if it hasn't already.
      11. Browse to the new address of the device, 192.168.1.155 in my case. You should see the main page again.

      Step 4: Connecting It All Together

      1. Disconnect the USB cable.
      2. Connect 5 volt power. And refresh the web page. You should see the heartbeat incrementing regularly.
      3. The LED on the ESP8266 should flash every 5 seconds as it reads the sensors.
      4. Connect the sensors, and you should start getting readings. Originally I had a DHT22 outside, but found it unreliable, so switched to the simpler and better protected DS18B20.
      5. If you have issues with readings, you can disconnect 5V power, power the NodeMCU with USB, and load example sketches for each sensor to troubleshoot the issue. It's almost always a bad wire.
      6. Connect 48V power and the fans. Click on the fan control buttons.
      7. Build two Tasmota-based smart switches. I used Sonoff Basic switches. There are tutorials on how to flash them with Tasmota elsewhere, including arendst's own page.
      8. Consult your router's client list, and identify the IP addresses assigned to each smart switch. Set these addresses as reserved, so that the switches always get the same address.
      9. Try controlling the smart switches directly, for example
      http://192.168.0.149/cm?cmnd=Power%20ON
      http://192.168.0.149/cm?cmnd=Power%20OFF
    1. Click on Configure at the bottom of the main page, and set the addresses for the smart switches as shown in the screen capture above. Just the IP address, the rest of the URL is built in the software running on the ESP8266. You may need user:password of "admin":"opensesame", or whatever you changed the password to, to access the Configuration page.
    2. Step 5: Installation

      I mounted the parts of the device on a small piece of plywood, with the lid of a plastic food container in between the plywood and the lid. This arrangement was screwed to the wall of the root cellar. Because the lid is off the wall a bit, the body of the food container can easily be snapped on to provide a protective case. All the cabling is routed through the fixed lid to the circuit board.

      The sensors and fan wiring were fastened to the walls loosely, as future work is planned in the root cellar - possibly plastered walls and additional shelving.

      Step 6: Summary

      This is an experiment, so we don't know which parts of the system will prove out in the end.

      Some first notes on how to make success easier:

      • The fans maybe unnecessary. Natural convection may be sufficient. The intake and exhaust vents are placed near the floor and ceiling respectively, so that hot air is exhausted and cold air brought in.
      • Make sure wi-fi is OK in the root cellar before starting the project. In our case, we needed to install a wifi extender in the room above the root cellar.
      • If wi-fi is not good, a wired or different radio frequency design might be required.
      • Paint the board the components are mounted on, or use plastic or something less affected by humidity.
      • Four fans running consume about 60 watts, the power supply is likely 80% efficient at least. So heating inside the case is at most 20% * 60 or 12 watts. Overheating shouldn't be a problem, especially in a cold root cellar. If your case is more airtight, you might want to drill some ventilation holes.
      • There are projects which add environmental sensors to Tasmota-based smart plugs. One of those might be a good alternative for this application.

      Be the First to Share

        Recommendations

        • Raspberry Pi Contest

          Raspberry Pi Contest
        • Anything Goes Contest 2021

          Anything Goes Contest 2021
        • Knitting and Crochet Speed Challenge

          Knitting and Crochet Speed Challenge

        Comments