I’ve wasted about three days trying to get OTA upgrades to work on my ESP8266 boards. They take 1-2 OTA’s and then don’t even boot into the sketch. Tried my Gizwits WiFi Witty and ESP12F on a breakout board with an LDO as described in my earlier post. Then I tried my old NodeMCUv2 board and it worked fine, all of the time.
Turns out we need moar powah!
The HT7833 LDO on the white breakout boards from the earlier post, are supposed to be able to put out 500mA so I guess its not a current problem but a voltage one, when measuring what gets through to the ESP its just over 3.3v. I bypassed the LDO and fed a 3.7v LiPo to VCC and it works fine now!
Whilst playing around trying to get it to work I added the 4x 10k resistors and a 100nF capacitor across the ESP’s VCC/GND pins as well as a 470uF capacitor across the power rails feeding the LDO, as per here. Didn’t seem to make any difference.
On a related note, the pinout of those white boards is insane. Turns out the VCC pin on the white board is where you should feed the supply into the LDO. It’s connected to VIN (middle pin). But bizarrely VCC on the ESP is not fed from there, its fed from a via from the LDO’s VOUT (right pin) and it seems CH_PD is fed from that via the leftmost 10k resistor on the breakout. So don’t power other components or connect other ESP pins to VCC as it’ll be running 8v or whatever you’re inputting!
I removed the LDO and had to replace the middle 000 resistor (solder blob) so that the breakout VCC goes to the ESP VCC.
So essentially if you want to use the LDO (I’d advise against it) you have to remove the 000 resistor and feed the LDO up to 8v via the breakout’s VCC pin, then run a jumper wire from VOUT on the LDO to the ESP’s VCC pin. I used the leftmost via as seen from the top, near VCC/GPIO13 pins rather than running a wire over and under the breakout.
If you don’t want to use the LDO, leave the breakout as it was and feed 3.7v into the VCC pin.
I’ve received my free Amazon Echo – wow I need to get another when they’re £80 again! They are amazing! I’ve been using the fauxmoESP library to control the LED on an ESP8266, sooooo easy.
Here’s my sketch, including OTA code. Note to generate an MD5SUM to use as your OTA password, you need to call
echo -n "otapassphrase" | md5sum to ensure you don’t get a newline! Then pass espota.py the plaintext string.
// init vars
const int RED = 15;
const int GREEN = 12;
const int BLUE = 13;
void callback(uint8_t device_id, const char * device_name, bool state)
Serial.print(" state: ");
// configure led
Serial.println("After connection, ask Alexa to 'turn pixel on' or 'off'");
WiFi.config(IPAddress(192, 168, 1, 2), IPAddress(192, 168, 1, 1),
IPAddress(255, 255, 255, 0), IPAddress(8,8,8,8));
while (WiFi.status() != WL_CONNECTED)
I’ve improved my ESP Makefile to handle OTA and debugging etc (mind the word-wrapping on the fqbn line)
ARDUINO_PATH = $(HOME)/arduino-1.8.3
SKETCHBOOK = $(HOME)/arduino16
ESPTOOL = $(SKETCHBOOK)/hardware/esp8266com/esp8266/tools/esptool/esptool
ESPOTA = $(SKETCHBOOK)/hardware/esp8266com/esp8266/tools/espota.py
SKETCH = $(notdir $(CURDIR)).ino
TARGET_DIR = $(CURDIR)/build-esp8266
MONITOR_PORT = /dev/ttyUSB0
OTA_IP = 192.168.1.2
OTA_PASSWD = otapassphrase
#DEBUG = ,Debug=Serial,DebugLevel=all_____
@ mkdir -p $(TARGET_DIR)
$(ARDUINO_PATH)/arduino-builder -compile -logger=machine \
-hardware "$(ARDUINO_PATH)/hardware" \
-hardware "$(SKETCHBOOK)/hardware" \
-tools "$(ARDUINO_PATH)/tools-builder" \
-tools "$(ARDUINO_PATH)/hardware/tools/avr" \
-built-in-libraries "$(ARDUINO_PATH)/libraries" \
-libraries "$(SKETCHBOOK)/libraries" \
-build-path "$(TARGET_DIR)" \
$(ESPTOOL) -v -cd nodemcu -cb 115200 -cp $(MONITOR_PORT) -ca 0x00000 -cf $(TARGET_DIR)/$(SKETCH).bin
$(ESPOTA) -i $(OTA_IP) -I 192.168.1.3 -a $(OTA_PASSWD) -f $(TARGET_DIR)/$(SKETCH).bin
rm -rf $(TARGET_DIR)
screen $(MONITOR_PORT) 115200
Once you’ve discovered your device using the Alexa app (or go to echo.amazon.com then “Smart Home” > Devices > Discover) you just say “Alexa, turn pixel on”.