Adding humidity sensors is very easy. And the process is similar with Dallas Temperature Sensor setup.

What you need:

  • Powered V2 Smart Controller
  • DHT11 Humidity Sensor (DHT11 Sensor is set for Default, if you have DHT22 (AM2302) or DHT21 (AM2301), navigate to the end of the page, to find out how to change your controller code)

First of all, you need to wire your sensor to the V2 Smart Controller. Connecting +5, GND and Data cables as shown on the picture below. Humidity sensor has a dedicated pin, which is 27.

1

After connecting your sensor to the controller, you may turn it on and access http://api.kijanigrows.com/ for setup. Navigate to “Map Devise Sensors” page choose your sensor type and pin there, as shown on the picture below.

2

Your sensor will start working right away and you will find your reading at “Device Sensors” page.

If your sensor type is different from DHT11 which is a default sensor, you will need to change the code for the ATmega part of the controller. To do that, first disconnect your controller and change the Switch position. Switch is located above mini-USB port making it locked to the ATmega programming position, as shown on the picture below, it’s marked blue.

3

After you do that you can use V2 Smart Controller as a normal Arduino Mega 2560.

Before you do any changes to the controller code, you need to install Arduino IDE, downloading it from the Arduino website https://www.arduino.cc/en/main/software and update your libraries.

You can download libraries from this link:

http://www.kijanigrows.com/wp-content/uploads/2015/09/libraries.zip

After downloading libraries unzip it and start Arduino IDE.

To add libraries, navigate to Sketch-Include Libraries-Add ZIP Library

4

And then add all unzipped libraries, I did it by adding every single ZIP one by one.

5

It should have no problem when done correctly, which is very simple.

But I have got one problem on my PC, when doing that, since I am using Windows, which is not case sensitive, while extracting folders it missed one file for COZIR CO2 sensor from the sensor library.

To avoid this problem, make sure you have the following files in your Arduino libraries directory.

My path for this directory is C:\Users\user\Documents\Arduino\libraries\cozir

There should be 6 files inside:

1) cozir.cpp.swn

2) cozir.cpp.swo

3) cozir.cpp.swp

4) cozir.cpp

5) Cozir.h

6) cozir.h

On my Windows computer I was lacking cozir.h and had only 5 of them. So, I had to rename file Cozir.h to cozir.h since it’s being used as such in the code, not with an uppercase letter.

So after changing it I got the following files included in cozir folder:

6

When you are done adding libraries, you can proceed with your controller setup, and move to code change.

First you need to download the sketch from this link

http://www.kijanigrows.com/wp-content/uploads/2015/10/v2_json_io.zip

And open it with Adruino IDE.

We need to make sure which sensor type we have setup in the code and change it according to what you have in your hands.

This is the part of the code that must be changed:

7

Just change your line

#define DHTTYPE DHT11   // DHT 27

Writing the correct sensor type that you have. DHT22 for AM2302 or DHT21 for AM2301. When it’s done. Press the “Upload” button. To avoid any problems, check your Board and Port settings in the Tools menu. It must be set to whatever port your Controller is connected to (one option if you are programming one device) and your Board/Processor type is Mega 2560.

8

This is the message that you will get when you are done uploading successfully.

9

After uploading your code successfully turn of your controller, and change the switch position back to AR9331 side. As shown on the picture.

10

That’s very important, if you don’t do that your controller will not be working correctly.