Esp-01 01s Site
Once connected:
#define LED 2 // GPIO2, active LOW on ESP-01S void setup() pinMode(LED, OUTPUT); digitalWrite(LED, HIGH); // off esp-01 01s
void loop() digitalWrite(LED, LOW); // on delay(1000); digitalWrite(LED, HIGH); delay(1000); Once connected: #define LED 2 // GPIO2, active
#include <ESP8266WiFi.h> #include <PubSubClient.h> #include <DHT.h> #define DHTPIN 0 #define DHTTYPE DHT11 But GPIO16 is not broken out on the 8-pin header
No user LED. Use GPIO0 (inverted logic, external LED + resistor). Part 8: Common Pitfalls & Fixes | Problem | Cause | Fix | |---------|-------|-----| | Serial gibberish | Baud rate wrong | 74880 baud for boot log, 115200 for AT | | No boot (LED faint) | Low power | Add 100 µF cap, use better 3.3V supply | | Endless reset loop | GPIO0 floating | Add 10k pull-up to 3.3V (ESP-01 only) | | Can't flash | Not in flash mode | Hold GPIO0 low during reset | | Flashing fails at 0% | Wrong flash size | Set correct size in Arduino IDE | | Random resets when WiFi on | Power droop | Add 470 µF capacitor | | GPIO2 won't go low | Pull-up too strong | Use open-drain or external transistor | Part 9: ESP-01 vs ESP-01S – When to Use Which | Scenario | Choose | |----------|--------| | Legacy project, already have ESP-01 | Add 10k pull-ups on GPIO0, GPIO2, EN | | New project, low cost | ESP-01S (same price or $0.20 more) | | Minimal parts count | ESP-01S | | User LED needed | ESP-01S (GPIO2) | | MicroPython | ESP-01S (1 MB) | | OTA updates | Neither (ESP-12 or Wemos D1 Mini better) | | Battery powered | ESP-01S + deep sleep mod (GPIO16 to RST) | Part 10: Deep Sleep on ESP-01/01S The ESP8266 can enter deep sleep (~20 µA). But GPIO16 is not broken out on the 8-pin header. Mod for ESP-01S: Solder a wire from the pad of GPIO16 (under the metal can on the top side) to the RST pin.
| Mode | GPIO0 | GPIO2 | GPIO15 | |------|-------|-------|--------| | UART Download (Flash) | LOW | HIGH | LOW | | Flash Boot (Run) | HIGH | HIGH | LOW | | SDIO/SPI Boot | ? | ? | HIGH (invalid for ESP-01) |