El ESP8266 fue el primer microcontrolador con WiFi integrado accesible para makers. Aunque el ESP32 es más poderoso, el ESP8266 NodeMCU sigue siendo una opción válida cuando el presupuesto es ajustado o el proyecto IoT es simple.
ESP8266 vs ESP32: ¿Cuál usar?
| Característica | ESP8266 | ESP32 |
|---|---|---|
| CPU | 80/160 MHz 32-bit | 240 MHz dual-core |
| RAM | 80 KB | 520 KB |
| WiFi | ✓ 802.11 b/g/n | ✓ 802.11 b/g/n |
| Bluetooth | ✗ | ✓ BT + BLE |
| Pines ADC | 1 (solo A0) | 18 |
| Precio aprox. | ~$4.000 CLP | ~$6.990 CLP |
Instalar ESP8266 en Arduino IDE
- Abre Archivo → Preferencias
- En "URLs adicionales":
http://arduino.esp8266.com/stable/package_esp8266com_index.json - Ve a Herramientas → Placa → Gestor de placas
- Busca "ESP8266" e instala esp8266 by ESP8266 Community
- Selecciona placa: NodeMCU 1.0 (ESP-12E Module)
Blink en ESP8266
// LED interno en NodeMCU = pin D4 = GPIO2
// Activo LOW en NodeMCU (enciende con LOW)
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Encender
delay(500);
digitalWrite(LED_BUILTIN, HIGH); // Apagar
delay(500);
}
Servidor Web Simple
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* SSID = "TuWiFi";
const char* PASS = "TuClave";
ESP8266WebServer server(80);
void setup() {
Serial.begin(115200);
WiFi.begin(SSID, PASS);
while (WiFi.status() != WL_CONNECTED) delay(500);
Serial.println(WiFi.localIP());
server.on("/", []() {
server.send(200, "text/html", "<h1>Hola desde ESP8266</h1>");
});
server.begin();
}
void loop() {
server.handleClient();
}
Cuándo Elegir ESP8266
El ESP8266 es ideal cuando necesitas WiFi simple sin Bluetooth y el presupuesto importa: enviar datos a ThingSpeak, servidor web para controlar un relay, o cliente HTTP para notificaciones. Para proyectos más complejos (BLE, muchos sensores, cámara), prefiere el ESP32.