So a while back I backed the Digistump Oak Kickstarter. I thought these boards were great and I'd supported other Digistump projects by backing or purchasing Erik's dev boards.

One of the big drawcards was over the air updates via Particle and at the time the ESP8266 Arduino Core didn't have great OTA support so this was win-win. (It's now waaaay better.)

Now the boards are great and the Oak support for arduino and the firmware was solid. The one thing I never found consistantly solid however was the Particle OTA support. I'd be able to flash it successfully a few times, come back a few months later and then flashing would just randomly and annoyingly fail.

Each time it failed I'd spend days troubleshooting, manually wiping the firmware/bootloader and replacing it until it kinda worked. The Oaks would phone home properly to Particle and show up on the Dashboard but would either stop recieving data during a flash or just stop responding.

Eventually when I came back to work on a project I'd built on the Oak pinout I finally gave in as I spent all the time I'd intended to use for development on fault finding the Particle OTA.

At its core, the Oak is simply an ESP8266 12E with a 4mb flash on it. I've had plenty of experience flashing them using esptool.py and esptool-ck, so I did what any self respecting person did.

Firstly, I wired a Serial -> USB Adaptor to it:

https://digistump.com/wiki/oak/tutorials/serialfirmware was a good primer for how to wire it and install esptool.py.

Make sure you connect P2 to ground, or the ESP8266 will not boot into serial flash mode.
My setup looks like this.

Then I backed it up using esptool.py:

python esptool.py --baud 115200 --port /dev/tty.SLAB_USBtoUART read_flash 0x000000 0x400000 flash_devicenumber.bin

You will definitely need to adjust the --port part of this command to suit your circumstances (COM on windows, usually /dev/tty. on mac and similar on linux) and make sure you put the device number or a friendly name in for your.bin file so if you ever have to go back you're not totally screwed.

Then, I wiped it with esptool.py:

python esptool.py --baud 115200 --port /dev/tty.SLAB_USBtoUART erase_flash

Again, change the port to whatever port your serial-usb adaptor shows up as on your relvant OS.

Your Digispark Oak is now Particle free

But it's still not entirely usable. At this point you could:

I expect most people will want the first option as it means you can use local or HTTP based Over The Air updating.

But we need to tell the Arduino ESP8266 Core about the Digispark Oak as the pin numbers on the board don't match what pins are being used on the ESP8266.

Telling Arduino about Oak's pins.

First thing you'll need to do is to create a variant in the hardware folder for the ESP8266 core. These instructions are assuming you've already installed the core.

On Windows 10, this is in your user's Documents folder. The full address will look something like:
C:\Users\Username\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.3.0\variants

On Mac, it's in your user's Library folder, so the location is:
/Users/<USERNAME>/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/variants

The version numbers may change when new releases of the core come out, so you will need to double-check.

To begin, unzip this zip file in the variants folder. This should create a folder called DigiStumpOak with a file inside it called Pins_Arduino.h . For those of you who'd rather not download a zip file, here's a gist with it.

Then, we will need to add some lines to boards.txt, which is in the folder above the variants folder.

At the end of the boards.txt file, add the following:

Congrats, you're done!

At this point, you can now reopen the Arduino IDE and you should end up seeing another board in your Boards menu under Tools.

I may submit this upstream as a new board definition for the Arduino ESP8266 core, but that will take a little bit to be added.

If you've found this useful, please let me know.