ESP8266 WiFi Module

ESP devices are low-cost wireless micro-controllers with a full TCP/IP stack produced by Espressif Systems. There are two versions available. The ESP8266 is WiFi only and the ESP32 which has WiFi and Bluetooth.

Electronic technology suppliers have implemented ESP devices in low cost bare-bones and serial programmable development modules. It is beyond the scope of this description to detail all ESP device variations that are being produced but a wealth of information can be found on the Internet.

Galixsys Networks has chosen this module for development and demonstration purposes. The Nebula_BIN project file implements a library for display support. As supplied, the 128x32 I2C OLED display is used for user prompts. Additionally, a red LED connected to D6(GPIO-12) will indicate “no WiFi connection”, a yellow LED connected to D5(GPIO-14) will indicate “SPIFFS file system format is in progress” and a momentary push-button switch connected to D9(GPIO-3) that when pressed with reset, will format the SPIFFS making the device “new” again, and if held after SPIFFS format will delete the WiFi connection.

Galixsys Dev Module

In progress - not available as of this writing but proposed schematic follows. Click the image to enlarge.

../_images/DevModSchematic.png

The development module proposed by Galixsys Networks has the following input/output attachments:

  • Built-in 5 volt power supply
  • 2 LEDs: red and yellow used to indicate device conditions during initial setup.
  • A power relay: for switching up to 10 amps at 120 VAC.
  • 2 push-button momentary switches: For reset(RED) and startup sequence control(BLUE).
  • A 128 x 32 I2C OLED display.
  • A digital temperature sensor.

The RED switch button is connected to the reset line of the ESP. Pressing it at any time will reset the device causing it to restart the program.

The BLUE switch button controls startup software. If it’s not held on power-on or a reset it is just a normal debounced input to the device whose open and closed position is monitored and shown in the log output. If it is held during power-on or reset it will immediately delete the VPN database and the internal EEPROM will be reformatted. The module will then become “new” and have to be added to a Nebula VPN as a new device. If held after the reformat finishes then the WiFi settings (SSID and Password) will be cleared out and the ESP will have to be reconnected to a WiFi network before continuing.

The RED LED indicates that the device does not have an IP address and therefore is not yet usable. A built-in network setup procedure is used to connect the first time. Afterwards the device will auto-connect using the saved SSID and password.

The YELLOW LED indicates that the device is not on a Nebula VPN. When the YELLOW LED is on, the device is hosting its startup screen at its assigned address:port. It is also used to indicate that the device is formatting its EEPROM memory which takes about 30 seconds.

The on/off condition of all LEDs is shown in the Arduino Serial Monitor when they are setup or transition.

Nebula on NodeMCU

After the Development Module, or any ESP device has had Nebula installed and has been added to the VPN via its Install screen, it is ready to use. The Nebula.ino program allows:

  • Command control from other VPN devices.
  • Voice control via Nebula or Alexa. Device name must be “Lights” to test Alexa control.
  • Browser webpage control
  • Display interface and control.
  • Uploading data to a database.

Install ESP module

Connect an ESP module to your computer via USB and open a serial monitor window with either Putty, Arduino IDE or terminal command line. Click the red button on a development module or the RST button on the PC board module. The serial monitor should show:

...Starting
red on <--Indicates no IP address
yellow off
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM: SET AP STA
*WM:
*WM: Configuring access point...
*WM: GLX8266
*WM: AP IP address:
*WM: 192.168.4.1
*WM: HTTP server started

13. The module is now running as a WiFi Access Point. You have to connect to it first in order to connect it to your home WiFi network.

13.1 On your computer, open Settings > Wi-Fi and select GLX8266 from the list. No password is required just click Connect.

../_images/WifiManager-1.png

13.2 Select Configure WiFi

../_images/WifiConnect-3.png

13.3 Select your home network name (SSID). If you don’t see it in the list, click Scan. Enter your network password then click save. After a few seconds the serial output should end up displaying:

connected...
red off <--Indicates has IP address
SSID: *home_wifi_name*
IP Address:Port: 192.168.1.253:80 <--Here is IP address:port
Chip id: 5756159

Please wait 30 secs for SPIFFS to be formatted
yellow on <--Indicates file system being formatted
Spiffs formatted
yellow off <--Indicates format done
New device do setup...
yellow on <--Indicates not on VPN
Web server has started

14. To open the installation screen, find the line that starts with “IP Address:Port:” and note the address:port shown. If your module has the OLED display attached you can see the prompt there.

15. IMPORTANT: If you are using either Putty or Terminal for a serial monitor, you must disconnect them from serial before continuing:
  • For Terminal use Control-C
  • For Putty close the program

16. Click the red button on a development module or the RST button on the PC board module.

17. Open your browser and go to the IP address.

18. Now see the new device installation screen

../_images/Install-BIN.png