"In recent years, the development of intelligent hardware of Internet of things is no longer limited to large companies and enterprises. Even small start-ups, teams, individuals and even students have the ability to independently develop a simple intelligent hardware product of Internet of things. Of course, this is mainly due to the efforts of some domestic solution providers to create an ecological environment - providing a one-stop intelligent hardware solution of complete software and hardware system + cloud service platform. Far from it, take linksprite for example. Recently, it has frequently "appeared" and released many intelligent hardware platforms of the Internet of things, and the author just got a hardware platform for the control of intelligent appliances of the Internet of things - linknode R4, an on-board highly integrated esp8266 SOC WiFi module (equivalent to the combination of master control and WiFi), so the hardware looks quite simple, The cost is also very cheap, but it is actually very practical. It can be used as an alternative for the research and development of intelligent products of the Internet of things, whether in large or small quantities. Let's see how the real object of linknode R4 is.
Linknode R4 hardware
Because I have also experienced other linksprite products before, I am very familiar with the packaging box of linknode R4. It is simple and not fancy, but the basic instructions and materials are directly printed with the corresponding link address on the packaging box. Even the user who gets the board for the first time can know how to quickly start product learning or development.
In addition to the board, four plastic fixed support columns are provided in the packaging bag. Although they can't be upgraded, they are still very practical in practical use. After all, the current through the relay may be very large according to different loads. The support column can effectively prevent the circuit at the bottom of the board from contacting the desktop and prevent accidents.
From the above figure, some engineers can also guess that the hardware structure of linknode R4 development platform is very simple. In fact, it is a WiFi relay controller. Its main control + WiFi wireless is realized by esp8266 WiFi module.
I believe this module is no stranger to everyone. We have seen it on the so-called Internet of things development platform, such as smart cloud's gokit, fast-growing small e development kit, and even linksprite's previous generation product linknode D1.
Esp8266 is a highly integrated WiFi chip launched by Lexin. It is highly integrated with antenna switch, RF balun, power amplifier, low-noise amplifier, filter and power management module. Therefore, only a few external circuits are needed to realize a complete WiFi network solution.
Eps8266 hardware system block diagram
It can run independently or as a slave on other host MCU, and the connection with external MCU is simple and convenient, just through SPI / SDIO interface or I2C / UART interface. Of course, if the esp8266 is not connected to an external MCU, it can also be started directly from the external flash memory only by the internally integrated application processor, and the built-in cache memory is conducive to improving the system performance and reducing the memory demand. More features of esp8266 chip are as follows:
802.11 B / g / N standard
WiFi Direct (P2P)、soft-AP
Integrated TCP / IP protocol stack
Integrated tr switch, balun, LNA, PA and matching network
Integrated PLL, voltage regulator, dcxo and power management unit
Output power of + 19.5dbm in 802.11b mode
Power off leakage current less than 10uA
Integrated low-power 32-bit CPU, which can also be used as application processor
SDIO 1.1 / 2.0, SPI, UART interface
STBC、 1 × 1 MIMO、2 × 1 MIMO
A-MPDU & A-MSDU aggregation & 0.4ms protection interval
Wake up and transfer data packets within 2ms
Power consumption in standby mode is less than 1.0mw (dtim3)
Internet of things development board recommendations:
Wiznet w7500 evaluation board A single-chip solution based on Cortex-M0 kernel, which is suitable for various embedded application platforms, especially the Internet of things.
Stm32f469ni MCU discovery Kit A cortex-m4 kernel provides killer functions for Internet of things applications that need to implement graphical interactive interfaces.
Mcimx6sx demo board An arm cortex-a9 and cortex-m4 core is used to create safe and interconnected homes and vehicles in Internet of things (IOT) applications.
In addition, the esp8266 also has three different working modes: activation mode, sleep mode and deep sleep mode. The accurate switching between various modes can help the needs of low-power applications. For example, in the sleep mode, the current consumed by the esp8266 is less than 12ua, so we can wake up the WiFi connection under a specific condition by programming, Before that, keep WiFi in sleep mode to save power consumption; For another example, we can program and adjust the PA output power of esp8266 in close range to reduce the overall power consumption.
If compared with the WiFi schemes on the market, it can be clearly found that under similar conditions, esp8266 has an extremely prominent price advantage. Therefore, at present, many engineers will consider that the esp8266 with obvious price advantage will become one of the first schemes under the condition of sufficient product performance.
In addition to the on-board cost-effective WiFi module, the linknode R4 development board can be compatible with Arduino ide tools for programming and power supply. The on-board four relay control channels, each of which supports 10A high-power equipment at most (when 110V mains power is connected, it can appropriately support higher current). It is very suitable for remote switching of smart sockets, fans, water heaters and other equipment.
The QR code on the back of the board is used to add devices during WiFi configuration.
In general, the on-board resources of linknode R4 are relatively simple. For experienced engineers, the circuit is basically clear at a glance and there is no difficulty. Next, let's look at the power on use.
Linknode R4 power on
We learned from the tutorial that we can control the relay switch on linknode R4 through the mobile app like the Internet of things smart products on the market. However, at present, the official only provides the app for demonstration of Android system. In addition, the author found that in the step of adding equipment, the app always flashes back at the place indicated by the arrow in the figure below.
It is suspected that the reason is that the author's mobile phone is upgraded to Android 6.0. Skip this problem first. Anyway, it is not possible to brush the downgrade system for this seemingly "semi-finished" app.
Internet of things development board recommendations:
Wiznet w7500 evaluation board A single-chip solution based on Cortex-M0 kernel, which is suitable for various embedded application platforms, especially the Internet of things.
Stm32f469ni MCU discovery Kit A cortex-m4 kernel provides killer functions for Internet of things applications that need to implement graphical interactive interfaces.
Mcimx6sx demo board An arm cortex-a9 and cortex-m4 core is used to create safe and interconnected homes and vehicles in Internet of things (IOT) applications.
Use the USB to serial port cable to connect linknode R4. When powered on, we can view the log of power on startup through the serial port.
From the log, linknode R4 starts the AP mode, but if you connect directly with your mobile phone, you can't connect to this AP. Forget it, you can only download a new program.
Linknode R4 development environment configuration
For the program development of the board, you can directly use the Arduino ide tool. At present, the latest version is updated to version 1.6.10
Enter file -- > Preferences
In the settings of preferences, add the web address managed by the additional development board
Internet of things development board recommendations:
Wiznet w7500 evaluation board A single-chip solution based on Cortex-M0 kernel, which is suitable for various embedded application platforms, especially the Internet of things.
Stm32f469ni MCU discovery Kit A cortex-m4 kernel provides killer functions for Internet of things applications that need to implement graphical interactive interfaces.
Mcimx6sx demo board An arm cortex-a9 and cortex-m4 core is used to create safe and interconnected homes and vehicles in Internet of things (IOT) applications.
Then open the tools -- > development board manager
Add and install esp8266 module
In addition, we need to add the library of WiFi manger in the library manager of the development board and open the project -- > management library
Add and install WiFi Manager
After the above steps are completed, we can directly use the official source code,
#include
#include
//the library are needed for autoconfig WiFi
#include
#include
#include
// replace with your own API key and device ID,
String apikey = ""xxxxxxxxxxxxxxxxxxxxxxxxxxxx"";
const char* deviceID=""xxxxxxxxxxxxx"";
const char* server = ""www.linksprite.io"";
WiFiClient client;
void setup() {
Serial.begin(115200);
pinMode(12, OUTPUT);
WiFiManager wifiManager;
wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
wifiManager.autoConnect(""LinkNodeAP"");
Serial.print(""WiFi Connected ...\n"");
Serial.println(""WiFi connected"");
}
void loop() {
if (client.connect(server,80)) {
String postStr =""{"";
postStr +=""\""action\"":\""query\"","";
postStr +=""\""apikey\"":\"""";
postStr += apikey;
postStr +=""\"","";
postStr +=""\""deviceid\"":\"""";
postStr += deviceID;
postStr +=""\"","";
postStr += ""\""params\"":"";
postStr += ""["";
postStr += ""\""light\"""";
postStr +=""]"";
postStr +=""}"";
client.print(""POST /api/http HTTP/1.1\n"");
client.print(""Host: "");
client.print(server);
client.print(""\nContent-Type: application/json\n"");
client.print(""Content-Length: "");
client.print(postStr.length());
client.print(""\n\n"");
client.print(postStr);
}
delay(1000);
Serial.println(""Store response..."");
String request = """";
while (client.available()) {
char c = client.read();
request +=c;
}
if (request!= NULL)
{
int index1 = request.indexOf("":{"");
int index2 = request.indexOf(""},"");
String param = reques
Our other product: