A simple tutorial on how to control an LED using Dialog IoT Platform
- NodeMCU
- Micro USB cable
- LED
- 330Ω resistor
- Male-female jumper wires
- Breadboard
Create your developer account at https://portal.iot.ideamart.io
- Once you have completed the registration process, Please click the email confirmation link which is sent to your registered email address & then contact one of our ideamart admins to activate your account.
- After the approval, login to your account and follow the steps below
- Create your device configuration in the developer portal
- Now go to Device Operation under Device Management and click Add Device
- Enter the required parameters as follows and click Save
- Once sucessfully saved, your new device will be visible under the Devices tab as shown below
-
If you haven't setup the ESP8266 environment in your Arduino IDE, then follow these steps, otherwise skip & continue to step 2
- Firstly open the Arduino IDE
- Go to files and click on the preference in the Arduino IDE
- Copy the below URL to the Additional boards Manager URLs & click OK to close the preference Tab http://arduino.esp8266.com/stable/package_esp8266com_index.json
- After completing the above steps , go to Tools -> board, and then select board Manager
- Navigate to 'esp8266 by esp8266 community' and install it.
-
Follow this youtube tutorial & install the ArduinoJson library stable version 5.13.2
-
Similarly install PubSubClient library from the Library Manager
Once all the above processes have been completed we are ready to program our NodeMCU with Arduino IDE. 👍
-
Download the LED_Controller.zip and extract it to your preferred location
-
Open the .ino file inside the folder named LED_Controller
-
The code has 3 differnt parts namely LED_controller, main, your_actions_events. You have to modify only the LED_Controller to sucessfully control your LED
- Please change the values of BRAND,TYPE,VERSION,MAC_ADDRESS under Device Details to your device's properties [use only lowercase letters]
- Also change the username & password under WiFi Credentials to your own WiFi username & password (Home router/Mobile hotspot) See the example below for a clear understanding:
- Connect the anode (+ve) of the LED to 330Ω resistor on the breadboard
- Using a jumper wire, connect the free terminal of the resistor to pin D1 of the NodeMCU
- Finally connect the cathode (-ve) of the LED to GND (ground) of the NodCMU
Now connect the NodeMCUto your PC using the USB cable and before uploading make sure you have selected the correct COM PORT and other settings as below
After successful upload you will see 2 LED blinks to indicate that your LED is now connected to the Dialog IoT platform and ready to receive your commands
You can also open the Arduino Serial Monitor in order to debug and check the device status
Follow these steps to execute the ON & OFF actions
- Go to your developer account -> Device Operation -> Devices & select your device
- Select your desired action from the drop down menu under Device Actions & click Execute