“An ESP8266? That’s easy! Feel free to follow along with my simple step by step instructions. I make codeloading FUN!!”
(with apologies to Strong Bad)
Beware: There be dragons here! While this information should enable you to recover even if you screw up the ESP8266 firmware, I can’t guarantee that will always work (though I am far more confident now that I have serial recovery working…)
Here’s a close-up showing the OTTO’s master reset button, the ESP8266 module, the ESP8266’s bootloader button (“ESP B/L”) and the OTTO’s bootloader button (at the very bottom).
In my previous post I noted that the terminal serial device for the OTTO is SerialUSB, not the usual Serial. In fact, it appears the Serial device is what talks directly to the ESP8266. More on that below…
First, install the Arduino 1.8.2 (or later) IDE (I don’t think it really matters if it’s the .org or .cc one – they both seem to work here).
Next, install the very latest ESP8266 hardware library for Arduino, per the instructions for doing it via Git. (I tried installing the Boards Manager version of the library and that was too out of date for this.) In a nutshell:
cd hardware mkdir esp8266com cd esp8266com git clone https://github.com/esp8266/Arduino.git esp8266 cd esp8266/tools python get.py
Get the WifiLink firmware from Github.
Once that’s all installed, restart the Arduino IDE.
In the board manager, under “ESP8266 modules”, select board “Arduino”. The other settings should be as follows:
Board: "Arduino" Flash Size: "4M (1M SPIFFS)" Model: "Star OTTO" Upload speed: "230400" (for serial recovery) or "9600" (for network port) Port: the serial port (preferably) or the network port for the OTTO
Flashing the ESP8266 via the serial port (preferable!):
If Wifi isn’t working right, this is the only easy way to fix things.
Install the WiFi Link library via the library manager (1.0.1 or later)
Build WiFi_Link\examples\Tools\EspRecovery.ino for the Star Otto and flash it normally.
Note: In EspRecovery.ino, we see SerialWiFi referenced… which is defined in arduino-library-wifilink/src/utility/uart/serial.h as an alias to Serial.
Load up ArduinoFirmwareEsp.ino and target the ESP8266 Arduino device via serial (The key here is that the codeload for the Star OTTO using EspRecovery will expect a 230400 baud rate).
Uncomment the following line in config.h:
For the purpose of seeing things work, change the BUILD_DATE value in config.h slightly. Don’t go overboard: just change a digit. The fields are fixed-length and weird values can surprise you later with weird behavior from apps that depend on them (especially the version number).
Compile and flash the firmware over serial – it should work, and no weird errors either. If it fails to flash, check your settings. To force the ESP8266 into bootloader mode, unplug the Star OTTO, hold the ESP B/L button, plug the board back in, and release the ESP B/L button – the ESP8266 should now be in its bootloader mode, while the Star OTTO itself should be in normal mode, with the recovery script running. Try flashing the ESP8266 again.
(Note: Even just holding the “ESP B/L” button and resetting the board seems to do the trick… I suspect it’s a Windows thing, as the ESP32 is a tricky board to codeload as well on Windows. Sometimes it all “just works”, sometimes it needs that manual intervention.)
Observe the Star OTTO’s wifi welcome page (refresh it – you might need to open it in a new browser instance). Notice the version number and date in the lower left…. did it change to what you changed it to? If so, that tells you it worked!
Flashing the ESP8266 via the network port (quirky):
While this works, it is rough around the edges. Also, if anything goes wrong you’ll need the serial method so learn that first!
As above, make a tiny change to the build date.
When you flash over the network port, it does the following:
Uploading...... [many dots then long pause] 12:36:52 [ERROR]: No Result! 12:36:52 [ERROR]: No Result!
It appears to upload nonetheless.
If you get messages like these:
[ERROR]: No Answer [ERROR]: Listen Failed
It’s time to reset and/or power cycle the Star OTTO and try again.
Observe the change you made as it is reflected in the wifi webpage or functionality.
That’s basically it!
Again, BE CAREFUL. I don’t think you can cause any problems that you can’t recover by flashing the ESP8266 again with good firmware, but I am not certain.
(In the process of this I managed to screw up and then fix my ESP8266 flash image… and in the process I closed the last gap on how to fully re-flash the Star OTTO.)
I noticed that the SPIFFS config file at
suggests 2M SPIFFS, so I added a 4M (2M SPIFFS) entry in
That did not have the desired effect. Only the 4M (1M SPIFFS) setting seems to work properly.
I started the Arduino IDE and ensured my settings were correct. At this point I still had the EspRecovery sketch running on the main MPU.
I built and uploaded the ArduinoFirmwareEsp firmware to the ESP8266 as usual (entering the ESP8266’s bootloader mode the usual way before upload).
Then (taking care to again enter the ESP8266’s bootloader mode) I used that plugin (via Tools -> ESP8266 Sketch Data Upload) to upload the SPIFFS image (that takes somewhat longer than the sketch).
Finally, I switched to the (insecure!) Arduino-Star-Otto-***** network and ran through the OTTO AP network setup again. It worked!
That last step is necessary because the config is stored in SPIFFS (as… plaintext.) Every time I flashed I kept reverting it, which was a distraction. Remember: if you change SPIFFS data, you’ll need to re-do the setup (the code alone shouldn’t affect the SPIFFS data block). If in doubt, upload both code and SPIFFS data.
For all this, in addition to making the Star OTTO more secure, serial config would eliminate this back-and-forth between networks.