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.
- NodeMCU will be Wi-Fi Access Point; start transmitting your IP and port number to network.
- Save device to system on AP mode, and establish wireless connection.
- Once the client connection is set; read the frequency of temperature and humidity transmission, and start transmitting the data to client in this frequency.
- Re-connect to network if connection is lost, end client connection and wait for the re-connection.
- Execute when LED event happened.
- Set rule and connect IFTTT connection, use your data for channels.
- Register and login free developer account at https://devzone.iot-ignite.com/dpanel/login.php?page=development ,
- Download AndroidThings agent,
- Download AndroidThings from this link,
- Download and setup win32 disk imager application,
- Flash the SD Card with Android Things Image, you will need the following this link,
- Boot gateway with Android Things and connect Ethernet,
- Run PowerShell and connect Android Things with ADB console,
- Download and install Android Things agent with ADB console command,
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.
- Enter https://enterprise.iot-ignite.com with your devzone credentials,
- Follow; Administration > DROM > DROM Configuration > Add DROM Configuration step,
- Type a new DROM configuration name and click save button,
- Follow; Administration > DROM > DROM Gateway Configuration > Add DROM Configuration step, type Raspberry MAC ID (Example FF:FF:FF:FF:FF:FF@ignite.com) , click add button,
- Click the push button and registration will done.
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 NodeMCUGo 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 LibrariesGetting 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 4: Generate, Compile, and Upload CodeCopy 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: DHT11There 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
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:
- NodeID // Customer application registers NodeMCU to IoT Ignite agent with this given unique id. This id should be unique in gateway domain.
- GatewayID // NodeMCU can only be connected to the given gateway id.
- SSID Credentials // Node uses SSID name and password to connect to the local network
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;
1. Register from Node’s page
Connect NodeMCU wireless network.
Browse 192.168.1.4
Configure Dateway ID and wireless configuration (SSID, Password)
2. Register with Service Provider Application
- Install Service Provider Application: https://download.iot-ignite.com/ServicePlatformApp/
- Login with your devzone credentials on your service provide application.
- List your AndroidThings Gateway and click Thing List and Add Node Manually button.
- Type your wireless information for connecting to NodeMCU
SPA connect your NodeMCU, provides wireless and gateway information to NodeMCU.
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;
- Data Reading Frequency
- Data Sending Frequency
- Threshold Type
- Offline Data
- Custom Configuration
Our example data reading and sending frequency type must be custom and min value is 1 min.
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 ReportDevzone 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- Login with your credentials: https://enterprise.iot-ignite.com
- Follow: Administration > Settings > External Settings step,
- Login your IFTTT account, and create Maker Channel API and copy the key,
- Paste the API key information and go to CEP Rules > Cloud Rules menu,
- Click New Cloud Rule button and setup rule configuration for data exchange,
- Go IFTTT account and create applet with you maker channel and google drive channel.
Comments