NodeMCU firmware

The otgwmcu firmware was originally created for the WiFi version of the OTGW offered by Nodo Shop, which contained a NodeMCU to provide the WiFi connection. Newer revisions of the board use a Wemos D1 mini for this purpose. Both the NodeMCU and the Wemos D1 mini are basically an ESP8266, with some additional hardware to convert the 5V power supply to 3.3V and provide a USB interface. The otgwmcu firmware can be used with both devices. The text below uses the collective term "ESP8266" for information applicable to both devices.

The otgwmcu firmware only provides very basic functionality. After configuring the local WiFi network, it can be used to connect the OTMonitor to the OTGW. But its primary purpose is to be able to upgrade the OTGW PIC firmware without relying on a (stable) WiFi connection.

Starting with version 0.3, the EEPROM settings are transferred from the old firmware to the new firmware. Version 0.8 of the otgwmcu firmware will flash the PIC with gateway firmware version 6.2 (PIC16F1847) or 5.5 (PIC16F88). Other options are available via the built-in web server.

Installation

  1. Download the appropriate esptool binary for the platform that is going to be used to flash the ESP8266, and unpack the archive.
  2. Download the otgwmcu firmware and unzip it in the same directory as the esptool.
  3. Power off the OTGW, remove the ESP8266 board and connect it to the computer using a microUSB cable.
  4. Open a terminal and navigate to the directory where the files from step 1 and 2 have been unpacked.
  5. Run the following command (adjust the -cp option if your ESP8266 board appears as a different serial device):
    Linux:
    ./esptool -cp /dev/ttyUSB0 -cd nodemcu -cb 921600 -cf otgwmcu-fw.bin -ca 0x300000 -cf otgwmcu-fs.bin
    Windows:
    esptool -cp COM5 -cd nodemcu -cb 921600 -cf otgwmcu-fw.bin -ca 0x300000 -cf otgwmcu-fs.bin
  6. Wait for the two-part upload to complete.
  7. Optionally configure your WiFi credentials.
  8. Disconnect the microUSB cable from the ESP8266 board and reinstall it in the OTGW.
  9. Reconnect the power to the OTGW.

PIC Recovery

To attempt to recover a PIC that has experienced a failed firmware upgrade, the device doesn't need to connect to WiFi. Simply press the FLASH button on the NodeMCU for 2 seconds, until the WiFi LED (next to the antenna) lights up. When using a Wemos D1 mini, use a wire to connect the pin marked D3 to GND for 2 seconds.

After about a second the NodeMCU LED (near the USB connector) should start blinking. A Wemos D1 mini doesn't have this LED. But if the WiFi LED remains lit for more than 5 seconds, you can assume the download is running. A normal recovery takes about 30 seconds. At the end the WiFi LED indicates the result:

  • Off: Recovery succeeded.
  • Slow blink (1Hz): Invalid firmware file.
  • Fast blink (5Hz): Recovery failed.
If the NodeMCU LED never blinks at all and the WiFi LED starts to blink fast after about 5 seconds, no self programming code could be detected. This can happen in the following scenarios:
  • The ESP8266 board is not (or not correctly) installed in the OTGW
  • The PIC is not (or not correctly) installed in the OTGW
  • The PIC is damaged.
  • A blank PIC is installed, or the firmware got corrupted beyond repair without the use of a PIC programmer.

Connect to WiFi

When the ESP8266 is connected to a WiFi network, additional functions are available.

When a WiFi network has not yet been configured, the ESP8266 creates its own WiFi network, called "OTGW-MCU". Connect to this network with a laptop, mobile phone, or tablet and sign in (no password) and configure the WiFi network you want to use.

Once the WiFi has been configured, check your router or other DHCP server for your network to figure out the IP address that has been assigned to the ESP8266.

Web server

The ESP8266 runs a web server that provides a few different pages. The links provided below assume the ESP8266 can be reached as otgwmcu1. Substitute its real name or IP address if this is not the case:
http://otgwmcu1/
Basic information about the messages being exchanged on the Opentherm interface(s).
http://otgwmcu1/firmware.html
Select which firmware to load into the PIC. There are 3 actions available for each firmware file:
Delete
Remove the firmware from the ESP8266, making it no longer available for loading into the PIC.
Update
Check the otgw.tclcode.com site for a new version of the file. If found, it is downloaded onto the ESP8266, making it available for loading into the PIC.
Download
Load the firmware into the PIC. The LED on the ESP8266 will show the progress as described above.
http://otgwmcu1/phone.html
A simple web page to control the thermostat from a mobile phone.
http://otgwmcu1/flash.html
Program a blank PIC16(L)F1847. This requires some jumpers to be added to the OTGW. The page explains the necessary details.
http://otgwmcu1/upload.html
Upload a file to the internal file system. This allows the user to update the existing web pages, or add their own.
http://otgwmcu1/update.html
Update the otgwmcu firmware or filesystem by uploading a bin file.

OTMonitor

For more extensive interaction with the OTGW, the OTMonitor application can be used. In OTMonitor, go to Options → Connection. Select "TCP Connection" and fill in the IP address of the ESP8266 in the "Remote host" field. Leave the "Remote port" at its default of 25238. Then click "Connect".