Overview

ESP-01

A network device driver for ESP8266 module (AT command).

Usage

Tested firmware versions:

Module Manufacturer AT version SDK version
ESP-01 Ai-Thinker Technology Co. Ltd. 1.2.0.0 1.5.4.1

Here is a wiring example for UART0 of Kameleon Core.

ESP8266 Kameleon Core
VCC 3V3
GND GND
TXD 7 (UART0 RX)
RXD 6 (UART0 TX)
CH_PD 3V3

You can register ESP8266 network device driver using UART interface as below:

var UART = require('uart').UART;
var serial0 = new UART(0, {baudrate: 115200, bufferSize: 2048});

var esp8266 = require('@niklauslee/esp8266');
esp8266.connect(serial0);

var wifi = require('wifi');
var connectInfo = {ssid: "iptime", password: "12345678"};
wifi.connect(connectInfo, err => {
  if (err) {
    console.error(err);
  } else {
    // You can use networking API ('net', 'http', etc.) after Wi-Fi connection.
  }
})

We recommend you do not place Wi-Fi SSID and password in the code. Instead, you can enter WIFI_SSID and WIFI_PASSWORD using storage API as below in Terminal. Then, you can omit the connectInfo parameter.

storage.setItem('WIFI_SSID', 'iptime');
storage.setItem('WIFI_PASSWORD', '12345678');