LinkNode R4 is a WiFi relay controller and it is powered by ESP-12f ESP8266 WiFi module which is comptiable with Arduino programming. There are 4 relay channels and each channel allows you to control high-power devices (up to 10 A) via the on-board relay. LinkNode R4 can be used to remotely turn lights, fans and other devices on/off. The WiFi interface will allow you to associate the board with your existing WiFi network and send the commands over the network.

The following section will tell you how to remotely control the LinkNode R4 with Arduino programming and Linksprite.io IoT platform.

LinkSprite IO is an IoT platform which supports RESTful API and WebSocket. These make the mobile APP, website application or device connect it very easily. The following I will introduce is about how to use LinkNode R4 to communicate with LinkSprite IO platform.

Check the configuration of Board

Because the LinkNode R4 has not been added into the offcial ESP8266 Arduino core repository yet, so you can’t find this board on the boards list, but you can use the Generic ESP8266 Module, and select Flash Mode as QIO.

3. Install WiFi Manager library

To make it more convinent, we add WiFi manager library in this demo.

The ESP8266 WiFi Connection manager with web captive portal, this Arduino library can make configure AP’s SSID and password via web page when you want LinkNode R4 to connect to AP.

Open Arduino IDE and go to Sketch –> Include Library –> Manage Libraries

Search the wifimanager and install it

4. Develope source code

Device API which the LinkSprite IO support is JSON-based, which means all request and response data is enclosed in JSON format. Currently it supports 3 kind of request.

Update: Update device status to LinkSprite IO

Query: Get device status from LinkSprite IO

This demo will send http POST request to query the param–light on linksprite.io, if the light is on, then turn one relay on, if off, then turn off the relay.