Programming ESP-01 for PicGoto Step-dir Telescope Controller
This is a note on programming the small, very common and well known ESP8266 based ESP-01 WiFi transceiver module. Specifically here you will find instructions and suggestion about the programming of this useful and cheap module intended for use with my PicGoto V4 Step-dir Telescope Controller. Because of my DIY passion, for a first try, I built a simple ESP-01 programmer able to upload the firmware via CP2102 USB-TTL module.
It's very simple, only the right connections and a couple of pullup resistors, as you can see here at left. At the mean time I've also ordered a similar commercially available CH340 based module (here on ebay). Later, I realized that this extremely cheap dongle need a small but easy modification in order to effectively work as ESP programmer.

The mod consists of soldering a push-button to connect temporarily the GND and GPIO0 pins of the adapter. Check my image gallery for some pictures showing this simple mod. I've attached the button to the multiple pin yellow header of the adapter using hot glue. Follow the instruction available on the link above to make sure the modified adapter will work properly (simply, follow this procedure: insert the USB plug in the PC port while the push-button is pressed then, after about one second, release the button).

All the pictures in this page are available in bigger size in my Image gallery. Take a look now the options for configuring the ESP-01.
The easy way
You only need a tool for programming the ESP-01. There are several available on the Web. I found EasyFlasher. Simple, free of charge and easy to use.

Download the firmware file from PicGoto repository:
- esp8266pgt.cpp.generic.bin for using ESP-01 and optional OLED display with manual control
- esp8266pgt.nunchuck.generic.bin for using ESP-01 and optional Nunchuck joystick control
Select the COM port of your ESP programmer and the firmware file to upload then click on Flash.

Before move on, we are facing two possible alternative cases depending on the type of ESP board you have. One type, generally blue colored, that carry a 'ready to use' Flash chip on-board. The other, always black, with a PUYA Flash chip on-board. If you, like me, own this second type of ESP-01, you're dealing with a well known chip's memory issue (
info here).
The Angel's PicGoto firmware needs at least 64Kb of SPIFF filesystem for config files. The PUYA based ESP-01 modules need a software patch in order to work as expected.

Option A
Your ESP-01 carry any Flash chip other than the PUYA.
Follow the above instructions to flash the ESP-01 module.

Option B
Your black ESP-01 is equipped with the PUYA P25Q80H Flash chip, known to have issues on reading/writing SPIFFS filesystems. 
You need to compile Angel's firmware code and upload it to the ESP-01 using Arduino IDE.

Before doing this, make sure to:
- install the esp8266 Arduino hardware library. If not already installed, add the following URL in the "Additional Boards Manager URLs" field of the Arduino's IDE Preferences window:

- download and install Arduino OLED library ( by copying the folder content in Arduino installation libraries folder (for me is C:/Program Files (x86)/Arduino/libraries)
- download esp.cpp patched file from the link available here. Replace the original esp.cpp file with the patched one. The esp.cpp is in:
Open the Boards Manager window under Tools > Board, type esp8266 in the search filed and select the 2.4.1 version. Then click on Install

Configure the IDE's options for the black ESP-01 as shown below.

Edit the esp8266pgt.ino file in the source code folder and comment/uncomment the relevant lines.
For an OLED configuration, comment the line 11I decided to use an 1.37" OLED (SH1106 chip) instead of the 0.96" (SSD1306 chip) so my esp8266pgt.ino file is as shown here:

..... snapshot di textpad con esp8266-esp01-ino .....

In Arduino IDE run the command Export compiled binary

After compilation you will find the .bin firmware to upload on ESP-01 in the source code folder.

PGT-stepdir 2018

..... configure ESP-01 and SkySafari .....

Now you are ready to go with the PicGoto V4 Step-dir Controller.

December, 2018