NodeMCU User Guide

Thing+ Guide for NodeMCU/Esp8266

  1. Install Arduino IDE
  2. Environment Setting for NodeMCU
  3. Arduino Firmware install
  4. Gateway Registration
  5. Firmware build and upload

This document is only for the purposes of the education and personal test. Arduino and/or H/W having similar specs with Arduino can’t support the SSL Encryption because they don’t have enough CPU Power for it. Because of that, An extra H/W which support the SSL Encryption is required to use Arduino with ThingPlus Cloud. For Arduino Users’ convenience, we’d like to introduce the new way to use Arduino Board as the ThingPlus IoT Gateway without any extra H/W. All of the communications between your Arduino board and ThingPlus Cloud can be disclosed because they are not encrypted.
API KEY for the non encrypted communication between Arduino and ThingPlus Cloud will be valid only for 30 days. If you want to use the API KEY over 30 days, please extend the valid duration before it is expired

Compatible Board for Thingplus Arduino Library

  • Arduino Board / Orange Board
  • ESP8266 (without Aruino board)
  • Arduino WizFi250
  • NodeMCU
  • Board using ARM CORETEX-M chip

This guide covers how to intergrate the ESP8266 with the NodeMCU. NodeMCU will be dealt with by reference, and ESP8266 will be referenced in the same way. Please note that ESP8266 is 3.3v.

1. Install Arduino IDE

1) Install Arduino IDE upon PC OS environment. Please use above version. 1.6.9.

2. Environment Setting for NodeMCU

1) Only LEDs and temperature sensors are connected in this guide.

  • The grove LED was used for the LED and the grove temperature sensor was used for the temperature sensor.

2) Connect the sensors.

  • Connect temperature SIG to A0 and connect VCC and GND.

  • Connect SIG of LED to D1 and connect VCC and GND.

  • Connect PC and NodeMCU with usb cable.

3) Launch the Arduino IDE.

4) In the Arduino IDE, select board and port.

  • Tools -> Board -> NodeMCU 1.0

    Arduino Select Port

3. Arduino Firmware install

1) Select Firmware to download into Arduino.

  • Have to install Firmware is as the following.
    • Arduino Library
    • ArduinoJson
    • PubSubClient
    • Time
    • Timer
    • wizFi250
  • thingplus Library (above. v1.0.9)
    • Scketch -> Include Library -> Manage Libraries...

      - Search > thingplus > install

      Arduino_json Arduino Lib

  • ArduinoJson
    • Scketch -> Include Library -> Manage Libraries...

      - Search > ArduinoJson > install

      Arduino_json Search Arduino_json

  • PubSubClient
    • Scketch -> Include Library -> Manage Libraries...

      - Search > PubSubClient > install

      Arduino_json Search Arduino_Pubsub

  • Time
    • Scketch -> Include Library -> Manage Libraries...

      - Search > timekeep > install

      Arduino_json Search Arduino_Time

  • Timer
  • WizFi250
    • Scketch -> Include Library -> Manage Libraries...

      - Search > wizFi250 > install

      Arduino_json Search Arduino_Time

2) Modify the header file of PubSubClient

  • Arduino Library Directory Path

    Windows : My Documents\Arduino\libraries\
    Mac : ~/Documents/Arduino/libraries/
    Linux : /home/<your user name>/sketchbook/libraries
  • Open LibrayPath/PubSubClient/src/PubSubClient.h and modify the following.



Notice : If you didn’t modify this part, actuator will be not works.

3) config setting

  • open LibraryPath/Thingplus/src/Thingplus.cpp and modify as the following.(at line: 230)
    • ->
void ThingplusClass::begin(Client& client, byte mac[], const char *apikey) {
	const char *server = "";
	const int port = 1883;

	this->mac = mac;
	snprintf(this->gatewayId, sizeof(this->gatewayId), PSTR("%02x%02x%02x%02x%02x%02x"),
			mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
	this->apikey = apikey;

	this->mqtt.setServer(server, port);

4. Gateway Registration

1) Get API key and register sensors

  • There are 3 examples in LibrayPath/Thingplus/examples/ (above thingplus library v1.0.7)
    • ArduinoEthernet : For Arduino + ethernet shield
    • ArduinoWizFi250 : For Arduino + WizFi250(wifi module of Wiznet)
    • ESP8266 : For ESP8266 (without Arduino board), NodeMCU
  • This guide is guide of Node MCU, so we use LibrayPath/Thingplus/examples/Esp8266/Esp8266.ino.
  • If you want to add another sensors or another actions, then modify/add the scripts.

  • Check the Mac address of the NodeMCU.
    • Upload it without modification from Esp8266.ino file.
    • When the upload is complete, open the serial monitor.
    • Take note of the Mac address on the serial Monitor.
  • Acquire APIKEY from the thingplus portal using the confirmed mac address.
    • I will explain it as an example that the confirmed mac address is 3C:D1:EF:1D:1D:2E.

    • > sign in > Settings > Gateway Management Arduino Register

    • Select Arduino-Developer as Gateway Model. Arduino GW Model

    • Enter the confirmed MAC address in the Gateway ID field.(If you copy from serial monitor, you can paste it.)

    • Select the Get API KEY button. Arduino Get APIKEY

    • API Key is issued. (The API key wil be expired in 30 days) copy ‘API KEY’ Arduino APIKEY

    • Select a Register Gateway button.

    • Input Gateway name.

    • Select grove startkit for Arduino as the device model.

    • Input a Device name. Arduino  Register

    • Select a Register a Gateway, Device and Sensors button. Arduino  Register Finish

    • Move to Gateway Management in thingplus portal

    • You can see the sensor ID. Arduino  Sensor ID

  • Update Esp8266.ino file.

    • Paste the copied API KEY into the Esp8266.ino file that you modified.
    • Change the sensor ID. (Enter the id you checked above.) Arduino APIKEY Register

Notice : The Gateway ID and API KEY is just for help to understand. Above ID and KEY is not available.

5. Firmware build and upload(execute)

1) build(compile) firmware. Arduino Verify

2) Upload Firmware on Arduino.

Arduino Download

3) Check if the below message shown at IDE.

Arduino Download Success

4) Reay to use

  • now, you can use arduino Independently.