ABOUT THE PROJECT

PROJECT INFO

Type: Work in progress

Difficulty: Advanced

Estimated time: 2 hours

License: GPL3+

THINGS USED IN THE PROJECT

Hardware components:

Software apps and online services:

Hand tools and fabrication machines:

STORY

Basically, the project will transfer data with DHT11 over wireless through NodeMCU.
This transfer will be done by using an AndroidThings as a gateway and light a led by a rule we set.


1 Devzone Register and Application Download

2 Getting Ready for Android as IoT Gateway

3 AndroidThings Configuration – ADB Connect, IoT Agent Installation

4 AndroidThings Configuration – Wi-Fi (DROM) Connect, IoT Agent Installation

DROM is a recently developed ARDIC Technology that enables the device’s mac ID to be matched remotely on the cloud. DROM establishes connection with the tenant and completes the registration process automatically.

5 Prepare NodeMCU for Gateway Registration

Step 1: Components Connect the DHT11, Resistor and the LED

Connect the pins as shown below for device’s physical connection (this connection is configured for the provided sample codes).

The set is physically ready. Now follow the steps to make the set ready for computer installation of the necessary software.

Step 2: Getting Ready for NodeMCU

Go to File/Preferences and add additional esp8266 library from the link below to introduce Arduino IDE with NodeMCU to make it programmable.

http://arduino.esp8266.com/versions/2.3.0/package_esp8266com_index.json

Go to Tool menu and enter esp8266 on board manager screen and click install to finish installation.

Step 3: Installing File System and Libraries

Getting ready for installing NodeMCU file system. Download filesystem uploader plugin here for this https://github.com/esp8266/arduino-esp8266fs-plugin/releases/tag/0.2.0, and extract under Arduino IDE as C:\Program Files (x86)\Arduino\tools\ESP8266FS\tool

Re-start Arduino IDE and make it ready by data upload under Tools menu.

Here we will install the libraries to be used for the application.

For timer library; download from https://github.com/JChristensen/Timer, and add the file to IDE by “sketch include library, add zip library”.

Install other general libraries such as ESP8266WiFi, ESP8266mDNS, WiFiUdp, FS ve DHT as well (Sketch > Include Library > Manage Library).

Add the program code to Arduino and make sure about the computer port we connect the NodeMCU.

Step 5: Generate, Compile, and Upload Code

Copy the library in files within the Github library to extract in Ardunio IDE, i.e: C:\Users\{name}\Documents\Arduino\DynamicNodeRegistrationNodeMCU-IotIgnite

Make sure the data files are under C:\Users\{name}\Documents\Arduino\DynamicNodeRegistrationNodeMCU-IotIgnite\data , and double click file to open.

Now the set is ready with NodeMCU after uploading is done.

NodeMCU must be acces point when your upload complete. Now we can register NodeMCU to Gateway with our open source sample application as called Service Privoder Application.

Additional info: DHT11

There are two versions of DHT11 sensors, 3 pins and 4 pins. Basically the transmitted data with both versions is same, they differ with Arduino connection. By adding a 10K resistor to the 4 pins sensor it can directly be connected to Arduino. The 3 pins sensor is already have a resistor on it.

3 Pins and 4 Pins DHT11

6 Service Provider Application and Register NodeMCU for Gateway

Service provider application(SPA) is a template application for developer’s mass deployment process. You can use one distribution for all of customer.

When NodeMCU is flashed for the first time, it starts as a server and Wi-Fi hotspot. Hotspot name starts with “Ignite” prefix. Configuration sent from SPA to node includes the following parameters:

Configured NodeMcu tries to connect to the Wifi network with the given credentials. If an error occurs during Wifi connection, it returns to hotspot mode. If connection is a success, it scans for the gateway with the given gateway id. If maximum of gateway discovery attempts is reached, it returns to hotspot mode. Number of maximum attemps is 30 by default.
When it discovers gateway, it sends node inventory to customer application and waits for data configuration.

There are two ways of node registration;

Connect NodeMCU wireless network.

Browse 192.168.1.4

Configure Dateway ID and wireless configuration (SSID, Password)

SPA connect your NodeMCU, provides wireless and gateway information to NodeMCU.

7 Devzone Data Configuration - Devzone Rule

When your NodeMCU get registered, it time to configure for data configuration. Login your Devzone panel; https://devzone.iot-ignite.com

Click Developments menu item then select Nodes item.

Data configuration provides options for NodeMCU;

Our example data reading and sending frequency type must be custom and min value is 1 sec. Set the the values. After the configuration, must be pushed to device after change.

Finally IoT-Ignite will collecting data from sensors in the selected time range.

8 Play Time: Devzone Dashboard - Devzone Report

Devzone have two visual reporting tool. You can use report tab and dashboard tab. Report tab is simple data listing and visualization tool.

Dashboard is real-time, interactive dashboards and visualizations in minutes using the intuitive drag & drop interface. When you open dashboard you can use various type of tool and you can play configuration options.

There are behind the beauty. Every board is built upon a secure, high-performance, enterprise-class cloud system, every dashboard has a unique URL that you can share.

9 Bonus: IFTT Connection – Google Drive Integration

SCHEMATICS

Circuit

NodeMCU DHT11 and Led Circuit

CODE

Github

You can access the project files on git hub. Click here to access; ino files to code on NodeMCU as well as all application source code for Android.

Source Code:
NodeMCU: https://github.com/IoT-Ignite/arduino-sketch-dynamic-node-example

Service Provider Application (NodeMCU registration for AndroidThings GW): https://download.iot-ignite.com/ServicePlatformApp/

Arduino ESP8266 filesystem uploader plugin: https://github.com/esp8266/arduino-esp8266fs-plugin