Unicontrol Basics Part 3 – Serial Line Access

To revive the unicontrol module or to set parameters that are inaccessible due to missing Wi-Fi connection, it is possible to access the ESP8266 in an emergency mode via the integrated serial interface. It can be useful, in case of a forgotten password, entering wrong values by mistake during configuration, Wi-Fi malfunction – etc…

Before adjusting the desired values, it is necessary to connect the ESP8266 with a serial cable to the computer. Depending on the currently used module. If it carries an integrated UART converter/serial micro-USB port, it is sufficient to simply connect it to a computer using a USB data cable. Not all cables have all the necessary pins connected. Therefore, it is necessary to use a cable that also allows data transfer. Common charging cables included with mobile phone chargers often do not allow this.

USB cable

Otherwise it is necessary to use a USB to UART TTL converter (most common is CH340) and connect the RX, TX and GND pins directly to the used ESP8266 module. Do not forget that to access the interface the GPIO0 should not be pulled LOW before connecting the wires as this would cause the boot to fail and the module would enter the flashing mode.

CH340 USB/UART
accessing unicontrol via serial line
An example of connecting USB/UART converter to the ESP-12F module.

COM port identification

Working with serial USB devices in Windows is not the easiest. After successfully connecting the ESP8266 to the PC, we need to identify the COM port located in the Device Manager, and then we need to tell our application to use that COM port. This can be done by several methods.

Option 1

The first option directly in Windows is to press Win-X. A pop-up menu will open where you need to select Device Manager.

The COM port with ESP8266 connected can be found in the Ports (COM & LPT) tab. In this case it is COM4. Knowing this number will be important later.

Device manager in Windows

Option 2

The second option for identifying the correct COM port is using a 3rd party software, like the Serial Port Notifier.

This program is very useful when frequently connecting devices to a computer via USB. After connection is established, it informs the user which COM port was assigned to the recently connected device on the information bar. It can also automatically launch PuTTY with the currently connected device and correct parameters directly from the notification bar at the bottom right of the screen. A number of articles can be found online describing installation and usage in detail.

PuTTY

PuTTY is a communication software very suitable for this purpose. It has a wide variety of connection options and protocols including a serial port terminal can be easily downloaded and installed according to the instructions available online. Before connecting, we must enter the required communication parameters first. In this case, the Connection type: in Serial and the line is COM4 as identified above.

Putty COM

Connection speed (baud rate) needs to be set to 115200. Other settings may be left in their defaults, thus 8 Data bits, 1 Stop bit and Parity and Flow control selected as None. The unicontrol interface is expecting communication with these values. Communication will not be established with a different set-up.

PuTTY setup

In order to see the keyboard entries on your screen, please select Local echo: Force on in the Terminal menu. Without this framework, everything will work as it should, but we will not see what we are writing.

These are all the basic settings needed. From now on, we can start communicating with the ESP8266.

If preferred, pressing the SAVE button will save all settings for future use. Before that, you need to enter a name under which the settings will be saved

PuTTY keyboard

Commands via serial line

Now we can use the built-in “serial API” and enter the commands we want to use. A list of all valid orders can be found in the documentation. If allowed, all characters entered via the keyboard will be displayed. Please, pay attention to executing the command afterwards, which is not performed by pressing an ENTER key (interpreted as CR by PuTTY) as one would intuitively expect. To execute the provided command immediately when using PuTTY you need to press the shortcut Ctrl+J (interpreted as LF). If the entered command is valid, the device will confirm its execution.

typing wifi info folowed by Ctrl-J will display the current Wi-Fi connection status on the terminal.

After changing the network name or password for the Wi-Fi connection, it is necessary to reconnect with the command wifi reset. The device will disconnect from the current Wi-Fi and connect to the network according the newly entered parameters.

All commands must be entered exactly as shown in the table. Otherwise, the command will not be executed.

Conclusion

From now on you are able to bring the unicontrol module back to life from almost any situation. In the next continuation, the individual items of the Processes menu will be explained in more detail using an example, and we will create the first “BLINK” application.

DOWNLOAD UNICONTROL