Herramientas de usuario

Herramientas del sitio


documentacion-proceso:tecnologicos:taller-esp8266

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
Última revisiónAmbos lados, revisión siguiente
documentacion-proceso:tecnologicos:taller-esp8266 [2016/03/10 06:18] brolindocumentacion-proceso:tecnologicos:taller-esp8266 [2016/03/12 21:32] – [Relevo wifi] miguel
Línea 14: Línea 14:
   * protoboard (AGREGAR IMAGEN)   * protoboard (AGREGAR IMAGEN)
   * soldador (AGREGAR IMAGEN)   * soldador (AGREGAR IMAGEN)
-  * un computador con arduino instalado (AGREGAR IMAGEN)+  * un computador con arduino instalado > 1.6.4 (AGREGAR IMAGEN)
   * ESP12 (AGREGAR IMAGEN)   * ESP12 (AGREGAR IMAGEN)
   * pcb para ESP12 (AGREGAR IMAGEN)   * pcb para ESP12 (AGREGAR IMAGEN)
Línea 46: Línea 46:
 **What is this ESP8266** **What is this ESP8266**
  
-    It's a wireless SoC +  * It's a wireless SoC 
-    It has GPIO, I2C, ADC, SPI, PWM and some more +  It has GPIO, I2C, ADC, SPI, PWM and some more 
-    It's running at 80MHz +  It's running at 80MHz 
-    64KBytes of instruction RAM +  64KBytes of instruction RAM 
-    96KBytes of data RAM +  96KBytes of data RAM 
-    64KBytes boot ROM +  64KBytes boot ROM 
-    It has a Winbond W25Q40BVNIG SPI flash +  It has a Winbond W25Q40BVNIG SPI flash 
-    It's a RISC architecture +  It's a RISC architecture 
-    The core is a 106micro Diamond Standard core (LX3) made by Tensilica +  The core is a 106micro Diamond Standard core (LX3) made by Tensilica 
-    The ESP8266 chip is made by Espressif +  The ESP8266 chip is made by Espressif 
-    Modules bearing this chip are made by various manufacturers+  Modules bearing this chip are made by various manufacturers
  
 **Features** **Features**
  
-    802.11 b/g/n protocol +  * 802.11 b/g/n protocol 
-    Wi-Fi 2.4 GHz, support WPA/WPA2 +  Wi-Fi 2.4 GHz, support WPA/WPA2 
-    Super small module size (11.5mm x 11.5mm) +  Super small module size (11.5mm x 11.5mm) 
-    Integrated 10-bit ADC +  Integrated 10-bit ADC 
-    Integrated TCP/IP protocol stack (ipv4 only at the moment) +  Integrated TCP/IP protocol stack (ipv4 only at the moment) 
-    Integrated TR switch, balun, LNA, power amplifier and matching network Integrated PLL, regulators, and power management units +  Integrated TR switch, balun, LNA, power amplifier and matching network Integrated PLL, regulators, and power management units 
-    +20dBm output power in 802.11b mode +  +20dBm output power in 802.11b mode 
-    Supports antenna diversity +  Supports antenna diversity 
-    Deep sleep power <10uA, Power down leakage current < 5uA +  Deep sleep power <10uA, Power down leakage current < 5uA 
-    Integrated low power 32-bit MCU +  Integrated low power 32-bit MCU 
-    SDIO 2.0, SPI, UART, I2C +  SDIO 2.0, SPI, UART, I2C 
-    STBC, 1x1 MIMO, 2x1 MIMO +  STBC, 1x1 MIMO, 2x1 MIMO 
-    A-MPDU & A-MSDU aggregation & 0.4μs guard interval +  A-MPDU & A-MSDU aggregation & 0.4μs guard interval 
-    Wake up and transmit packets in < 2ms +  Wake up and transmit packets in < 2ms 
-    Standby power consumption of < 1.0mW (DTIM3) +  Standby power consumption of < 1.0mW (DTIM3) 
-    Operating temperature range -40C ~ 125C +  Operating temperature range -40C ~ 125C 
- +    
-    Status API Training Shop Blog About Pricing  +
- +
- +
- +
 ===== 2. ¿Cómo se programa? ===== ===== 2. ¿Cómo se programa? =====
  
Línea 95: Línea 90:
  
 The best place to ask questions related to this core is ESP8266 community forum: http://www.esp8266.com/arduino. If you find this forum or the ESP8266 Boards Manager package useful, please consider supporting it with a donation. Donate The best place to ask questions related to this core is ESP8266 community forum: http://www.esp8266.com/arduino. If you find this forum or the ESP8266 Boards Manager package useful, please consider supporting it with a donation. Donate
 +
 +==== AT Firmware ====
 +
 +Manipulación del ESP8266 mediante comandos AT -> http://www.electrodragon.com/w/Category:ESP8266_Basic_Usage
 +Para descargar el firmare binario -> https://github.com/espressif/ESP8266_AT/tree/master/bin
  
 ==== NodeMCU - LUA ==== ==== NodeMCU - LUA ====
Línea 127: Línea 127:
 http://www.micropython.org/ http://www.micropython.org/
  
-MicroPython is a lean and fast implementation of the Python 3 programming language that is optimised to run on a microcontroller. The MicroPython board is a small electronic circuit board that runs MicroPython on the bare metal, and gives you a low-level Python operating system that can be used to control all kinds of electronic projects. +MicroPython is a lean and fast implementation of the Python 3 programming language that is optimised to run on a microcontroller. The MicroPython board is a small electronic circuit board that runs MicroPython on the bare metal, and gives you a low-level Python operating system that can be used to control all kinds of electronic projects. 
 ==== Smart.js - Javascript ==== ==== Smart.js - Javascript ====
  
Línea 157: Línea 158:
 ===== 3. Montaje de un programador para el ESP-12 ===== ===== 3. Montaje de un programador para el ESP-12 =====
  
-El esquema que se muestra a continuación es utilizado para programar el ESP12, se debe tener el cuenta que los+El esquema que se muestra a continuación es utilizado para programar el ESP12, se debe tener el cuenta en cuenta que los pines **GPIO2** y **GPIO0** (cables morados en el esquema de la protoboard) se conectan de manera temporal mientras se programa. Para poner a funcionar el ESP-12 en modo de ejecución de programa estos dos pines deben ser desconectados. Adicionalmente es necesario agregar un cable al pin **REST** (reset - cable verde en el esquema de la protoboard) que justo en el momento que se está subiendo el programa desde el IDE de Arduino, se debe hacer contacto con **GND** para resetear el integrado.
  
 {{http://cdn.instructables.com/FCH/0MSC/I697OYRQ/FCH0MSCI697OYRQ.LARGE.jpg?600}}\\ {{http://cdn.instructables.com/FCH/0MSC/I697OYRQ/FCH0MSCI697OYRQ.LARGE.jpg?600}}\\
Línea 163: Línea 164:
 {{:documentacion-proceso:tecnologicos:20160305_235052.jpg?400 |}}{{:documentacion-proceso:tecnologicos:20160305_235516.jpg?400 |}} {{:documentacion-proceso:tecnologicos:20160305_235052.jpg?400 |}}{{:documentacion-proceso:tecnologicos:20160305_235516.jpg?400 |}}
  
-===== 4. Ejemplo LED-Blink (de ahí lo que se les ocurra) =====+===== 4. Ejemplos ===== 
 + 
 +==== LED-Blink ==== 
 + 
 +El builtin led para el ESP-12 no es el mismo que está definido dentro del código de arduino. Se debe renombrar esta variable y usar el **pin 2**. A continuación se muestra el código probado con la modificación mencionada. 
 + 
 +<code c++> 
 +/* 
 + ESP8266 Blink by Simon Peter 
 + Blink the blue LED on the ESP-01 module 
 + This example code is in the public domain 
 +  
 + The blue LED on the ESP-01 module is connected to GPIO1  
 + (which is also the TXD pin; so we cannot use Serial.print() at the same time) 
 +  
 + Note that this sketch uses BUILTIN_LED to find the pin with the internal LED 
 +*/ 
 + 
 +#define LED 2 
 + 
 +void setup() { 
 +  pinMode(LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output 
 +
 + 
 +// the loop function runs over and over again forever 
 +void loop() { 
 +  digitalWrite(LED, LOW);   // Turn the LED on (Note that LOW is the voltage level 
 +                                    // but actually the LED is on; this is because  
 +                                    // it is acive low on the ESP-01) 
 +  delay(1000);                      // Wait for a second 
 +  digitalWrite(LED, HIGH);  // Turn the LED off by making the voltage HIGH 
 +  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED) 
 +
 +</code> 
 + 
 +==== Relevo wifi ==== 
 + 
 +La idea es programar el ESP8266 para que de manera remota a través de una petición a un servidor web que se crea dentro del chip se encienda o se apage un pin. El código a continuación es tomado del ejemplo **WifiWebServer** de Arduino para ESP8266. Probamos usando el **pin GPIO2** para activar el relevo pero presentaba problemas con la conexión a la red. Lo cambiamos para el **pin GPIO4** 
 + 
 +<code c> 
 +/* 
 +  This sketch demonstrates how to set up a simple HTTP-like server. 
 +  The server will set a GPIO pin depending on the request 
 +    http://server_ip/gpio/0 will set the GPIO2 low, 
 +    http://server_ip/gpio/1 will set the GPIO2 high 
 +  server_ip is the IP address of the ESP8266 module, will be  
 +  printed to Serial when the module is connected. 
 + */ 
 + 
 +#include <ESP8266WiFi.h> 
 + 
 +const char* ssid = "ElNombreDeLaRed"; 
 +const char* password = "LaClaveDeLaRed"; 
 + 
 +// Create an instance of the server 
 +// specify the port to listen on as an argument 
 +WiFiServer server(80); 
 + 
 +void setup() { 
 +  Serial.begin(115200); 
 +  delay(10); 
 + 
 +  // prepare GPIO2 
 +  pinMode(4, OUTPUT); 
 +  digitalWrite(4, 0); 
 +   
 +  // Connect to WiFi network 
 +  Serial.println(); 
 +  Serial.println(); 
 +  Serial.print("Connecting to "); 
 +  Serial.println(ssid); 
 +   
 +  WiFi.begin(ssid, password); 
 +   
 +  while (WiFi.status() != WL_CONNECTED) { 
 +    delay(500); 
 +    Serial.print("."); 
 +  } 
 +  Serial.println(""); 
 +  Serial.println("WiFi connected"); 
 +   
 +  // Start the server 
 +  server.begin(); 
 +  Serial.println("Server started"); 
 + 
 +  // Print the IP address 
 +  Serial.println(WiFi.localIP()); 
 +
 + 
 +void loop() { 
 +  // Check if a client has connected 
 +  WiFiClient client = server.available(); 
 +  if (!client) { 
 +    return; 
 +  } 
 +   
 +  // Wait until the client sends some data 
 +  Serial.println("new client"); 
 +  while(!client.available()){ 
 +    delay(1); 
 +  } 
 +   
 +  // Read the first line of the request 
 +  String req = client.readStringUntil('\r'); 
 +  Serial.println(req); 
 +  client.flush(); 
 +   
 +  // Match the request 
 +  int val; 
 +  if (req.indexOf("/gpio/0") != -1) 
 +    val = 0; 
 +  else if (req.indexOf("/gpio/1") != -1) 
 +    val = 1; 
 +  else { 
 +    Serial.println("invalid request"); 
 +    client.stop(); 
 +    return; 
 +  } 
 + 
 +  // Set GPIO2 according to the request 
 +  digitalWrite(4, val); 
 +   
 +  client.flush(); 
 + 
 +  // Prepare the response 
 +  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now "; 
 +  s += (val)?"high":"low"; 
 +  s += "</html>\n"; 
 + 
 +  // Send the response to the client 
 +  client.print(s); 
 +  delay(1); 
 +  Serial.println("Client disonnected")
 + 
 +  // The client will actually be disconnected  
 +  // when the function returns and 'client' object is detroyed 
 +
 +</code> 
 + 
 +{{https://ia801505.us.archive.org/7/items/VID20160312240306565/VID_20160312_240306565.ogv?600}} 
 + 
 + 
 + 
 +===== Registro =====
  
-#define LED_BUILTIN 2+{{:documentacion-proceso:tecnologicos:20160309_174236.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_174236.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_174245.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_174302.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_174954.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_175020.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_195005.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_195017.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160309_195023.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160311_181625.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160311_181630.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:20160311_182318.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_174035721.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_174035721.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_225111575.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_230635217.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_231703366.jpg?400 |}} 
 +{{:documentacion-proceso:tecnologicos:img_20160311_231703622.jpg?400 |}}
  
-gpio15 no se desconecta de tierra