From 90fb9ce5320b7ee96d9c2d2a6655152eafb9bbf8 Mon Sep 17 00:00:00 2001 From: Noah Date: Sun, 12 Jul 2015 20:39:15 +0200 Subject: [PATCH 01/18] README.md: Remove semicolons from inline function call examples Conflicts: README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index db43813bb3..8cbe48e1ea 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $ ant dist ```pinMode```, ```digitalRead```, ```digitalWrite```, ```analogWrite``` work as usual. Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, -call ```digitalRead(2);``` +call ```digitalRead(2)``` GPIO0-GPIO15 can be ```INPUT```, ```OUTPUT```, ```INPUT_PULLUP```, and ```INPUT_PULLDOWN```. GPIO16 can be ```INPUT```, ```OUTPUT``` or ```INPUT_PULLDOWN```. @@ -77,15 +77,15 @@ more than 20 milliseconds is not recommended. ```Serial``` object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty. -```Serial``` uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling ```Serial.swap();``` after ```Serial.begin();```. Calling ```swap``` again maps UART0 back to GPIO1 and GPIO3. +```Serial``` uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling ```Serial.swap()``` after ```Serial.begin()```. Calling ```swap``` again maps UART0 back to GPIO1 and GPIO3. ```Serial1``` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use ```Serial1```, call ```Serial1.begin```. -By default the diagnostic output from WiFi libraries is disabled when you call ```Serial.begin```. To enable debug output again, call ```Serial.setDebugOutput(true);```. To redirect debug output to ```Serial1``` instead, call ```Serial1.setDebugOutput(true);```. +By default the diagnostic output from WiFi libraries is disabled when you call ```Serial.begin```. To enable debug output again, call ```Serial.setDebugOutput(true)```. To redirect debug output to ```Serial1``` instead, call ```Serial1.setDebugOutput(true)```. You also need to use ```Serial.setDebugOutput(true)``` to enable output from the Arduino ```printf()``` function. -Both ```Serial``` and ```Serial1``` objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call ```Serial.begin(baudrate, SERIAL_8N1);```, ```Serial.begin(baudrate, SERIAL_6E2);```, etc. +Both ```Serial``` and ```Serial1``` objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call ```Serial.begin(baudrate, SERIAL_8N1)```, ```Serial.begin(baudrate, SERIAL_6E2)```, etc. #### Progmem #### @@ -102,7 +102,7 @@ This is mostly similar to WiFi shield library. Differences include: - ```WiFi.macAddress(mac)``` is for STA, ```WiFi.softAPmacAddress(mac)``` is for AP. - ```WiFi.localIP()``` is for STA, ```WiFi.softAPIP()``` is for AP. - ```WiFi.RSSI()``` doesn't work -- ```WiFi.printDiag(Serial);``` will print out some diagnostic info +- ```WiFi.printDiag(Serial)``` will print out some diagnostic info - ```WiFiUDP``` class supports sending and receiving multicast packets on STA interface. When sending a multicast packet, replace ```udp.beginPacket(addr, port)``` with ```udp.beginPacketMulticast(addr, port, WiFi.localIP())```. @@ -141,7 +141,7 @@ Three examples included. Wire library currently supports master mode up to approximately 450KHz. Before using I2C, pins for SDA and SCL need to be set by calling -```Wire.begin(int sda, int scl)```, i.e. ```Wire.begin(0, 2);``` on ESP-01, +```Wire.begin(int sda, int scl)```, i.e. ```Wire.begin(0, 2)``` on ESP-01, else they default to pins 4(SDA) and 5(SCL). #### SPI #### @@ -212,7 +212,7 @@ Libraries that don't rely on low-level access to AVR registers should work well. - [aREST](https://github.com/marcoschwartz/aREST) REST API handler library. - [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)). - [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git) -- [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: ```DHT dht(DHTPIN, DHTTYPE, 15);``` +- [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: ```DHT dht(DHTPIN, DHTTYPE, 15)``` - [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager). - [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266. Use the "NeoPixelAnimator" branch for esp8266 to get HSL color support and more. - [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. From 0c03552dbadb5b51968d856dac01ff6a424faf8c Mon Sep 17 00:00:00 2001 From: Noah Date: Sun, 12 Jul 2015 20:51:26 +0200 Subject: [PATCH 02/18] README.md: Improve markdown for code example Conflicts: README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8cbe48e1ea..16625f3d96 100644 --- a/README.md +++ b/README.md @@ -174,9 +174,9 @@ Several APIs may be used to get flash chip info: ```ESP.getVcc()``` may be used to measure supply voltage. ESP needs to reconfigure the ADC at startup in order for this feature to be available. Add the following line to the top of your sketch to use ```getVcc```: -``` -ADC_MODE(ADC_VCC); -``` + + ADC_MODE(ADC_VCC); + TOUT pin has to be disconnected in this mode. Note that by default ADC is configured to read from TOUT pin using ```analogRead(A0)```, and From d487398d76f525cfe242907bf438b160c56f642e Mon Sep 17 00:00:00 2001 From: Noah Date: Sun, 12 Jul 2015 20:52:26 +0200 Subject: [PATCH 03/18] README.md: Mark WiFiServer, WiFiClient and WiFiUDP as classes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16625f3d96..a1df4d799f 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ You can use ```udp.destinationIP()``` to tell whether the packet received was sent to the multicast or unicast address. Also note that multicast doesn't work on softAP interface. -WiFiServer, WiFiClient, and WiFiUDP behave mostly the same way as with WiFi shield library. +```WiFiServer```, ```WiFiClient```, and ```WiFiUDP``` behave mostly the same way as with WiFi shield library. Four samples are provided for this library. You can see more commands here: [http://www.arduino.cc/en/Reference/WiFi](http://www.arduino.cc/en/Reference/WiFi) From f100d4d58ca85a7db90a8c9dadb14342e5732a24 Mon Sep 17 00:00:00 2001 From: Noah Date: Sun, 12 Jul 2015 20:52:55 +0200 Subject: [PATCH 04/18] README.md: Use 3.3V consistently --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a1df4d799f..ae3169ea03 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ See attached example for details. #### Servo #### This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected. -While many RC servo motors will accept the 3.3v IO data pin from a esp8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the esp8266 and the servo motor power supply. +While many RC servo motors will accept the 3.3V IO data pin from a esp8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the esp8266 and the servo motor power supply. #### Other libraries (not included with the IDE) @@ -226,7 +226,7 @@ You need to put ESP8266 into bootloader mode before uploading code. #### Power Supply #### -For stable use of the ESP8266 a power supply with 3V3 and >= 250mA is required. +For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. * Note - using Power from USB to Serial is may unstable, they not deliver enough current. @@ -237,7 +237,7 @@ There are many different USB to Serial adapters / boards. * Note - for full upload management you need RTS and DTR - - the chip need to have 3V3 TTL (5V may damage the chip) + - the chip need to have 3.3V TTL (5V may damage the chip) - not all board have all pins of the ICs as breakout (check before order) - CTS and DSR are not useful for upload (they are Inputs) From c8310b7b70886700832b6f74e685021cc5827a8f Mon Sep 17 00:00:00 2001 From: Noah Date: Sun, 12 Jul 2015 21:12:30 +0200 Subject: [PATCH 05/18] README.md: Add trailing dot after inline function call example --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ae3169ea03..c790ef3696 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ $ ant dist ```pinMode```, ```digitalRead```, ```digitalWrite```, ```analogWrite``` work as usual. -Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, -call ```digitalRead(2)``` +Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, call ```digitalRead(2)```. GPIO0-GPIO15 can be ```INPUT```, ```OUTPUT```, ```INPUT_PULLUP```, and ```INPUT_PULLDOWN```. GPIO16 can be ```INPUT```, ```OUTPUT``` or ```INPUT_PULLDOWN```. From bafa5b4f3dce77c2df718f17881192c67644bd7e Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 14 Jul 2015 23:53:32 +0300 Subject: [PATCH 06/18] Separate project readme and core reference --- README.md | 292 +--------------------- hardware/esp8266com/esp8266/doc/README.md | 274 ++++++++++++++++++++ 2 files changed, 285 insertions(+), 281 deletions(-) create mode 100644 hardware/esp8266com/esp8266/doc/README.md diff --git a/README.md b/README.md index c790ef3696..de923288ff 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,6 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package - Enter ```http://arduino.esp8266.com/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation). -### [Change log](hardware/esp8266com/esp8266/changes.md) - ### Building latest version from source ### ``` $ git clone https://github.com/esp8266/Arduino.git @@ -24,285 +22,17 @@ $ cd Arduino/build $ ant dist ``` +### Documentation ### +Latest development version: [Reference](hardware/esp8266com/esp8266/doc/README.md) + ### Supported boards ### - Generic esp8266 modules (without auto-reset support) -- NodeMCU +- NodeMCU 0.9 +- NodeMCU 1.0 - Olimex MOD-WIFI-ESP8266 - -### Things that work ### - -#### Basic Wiring functions #### - -```pinMode```, ```digitalRead```, ```digitalWrite```, ```analogWrite``` work as usual. - -Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, call ```digitalRead(2)```. - -GPIO0-GPIO15 can be ```INPUT```, ```OUTPUT```, ```INPUT_PULLUP```, and ```INPUT_PULLDOWN```. -GPIO16 can be ```INPUT```, ```OUTPUT``` or ```INPUT_PULLDOWN```. - -```analogRead(A0)``` reads the value of the ADC channel connected to the TOUT pin. - -```analogWrite(pin, value)``` enables software PWM on the given pin. PWM may be used on pins 0 to 15. -Call ```analogWrite(pin, 0)``` to disable PWM on the pin. ```value``` may be in range from 0 to ```PWMRANGE```, which is currently equal to 1023. - -Pin interrupts are supported through ```attachInterrupt```, ```detachInterrupt``` functions. -Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt -types are supported: ```CHANGE```, ```RISING```, ```FALLING```. - -#### Pin Functions #### - -![Pin Functions](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/pin_functions.png) -The most usable pin functions are mapped to the macro ```SPECIAL```, so calling ```pinMode(pin, SPECIAL)``` -will switch that pin in the most usable FUNCTION_X. Those are UART RX/TX on pins 1 - 3, HSPI for pins 12-15 and CLK functions for pins 0, 4 and 5. - -#### Timing and delays #### -```millis``` and ```micros``` return the number of milliseconds and microseconds elapsed after reset, respectively. - -```delay``` pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run. -```delayMicroseconds``` pauses for a given number of microseconds. - -Remember that there is a lot of code that needs to run on the chip besides the sketch -when WiFi is connected. WiFi and TCP/IP libraries get a chance to handle any pending -events each time the ```loop()``` function completes, OR when ```delay(...)``` is called. -If you have a loop somewhere in your sketch that takes a lot of time (>50ms) without -calling ```delay()```, you might consider adding a call to delay function to keep the WiFi -stack running smoothly. - -There is also a ```yield()``` function which is equivalent to ```delay(0)```. The delayMicroseconds -function, on the other hand, does not yield to other tasks, so using it for delays -more than 20 milliseconds is not recommended. - -#### Serial #### - -```Serial``` object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty. - -```Serial``` uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling ```Serial.swap()``` after ```Serial.begin()```. Calling ```swap``` again maps UART0 back to GPIO1 and GPIO3. - -```Serial1``` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use ```Serial1```, call ```Serial1.begin```. - -By default the diagnostic output from WiFi libraries is disabled when you call ```Serial.begin```. To enable debug output again, call ```Serial.setDebugOutput(true)```. To redirect debug output to ```Serial1``` instead, call ```Serial1.setDebugOutput(true)```. - -You also need to use ```Serial.setDebugOutput(true)``` to enable output from the Arduino ```printf()``` function. - -Both ```Serial``` and ```Serial1``` objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call ```Serial.begin(baudrate, SERIAL_8N1)```, ```Serial.begin(baudrate, SERIAL_6E2)```, etc. - -#### Progmem #### - -The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application. -The important difference is that on the esp8266 the literal strings are not pooled. This means that the same literal string defined inside a ```F("")``` and/or ```PSTR("")``` will take up space for each instance in the code. So you will need to manage the duplicate strings yourself. - -#### WiFi(ESP8266WiFi library) #### - -This is mostly similar to WiFi shield library. Differences include: - -- ```WiFi.mode(m)```: set mode to ```WIFI_AP```, ```WIFI_STA```, or ```WIFI_AP_STA```. -- call ```WiFi.softAP(ssid)``` to set up an open network -- call ```WiFi.softAP(ssid, password)``` to set up a WPA2-PSK network (password should be at least 8 characters) -- ```WiFi.macAddress(mac)``` is for STA, ```WiFi.softAPmacAddress(mac)``` is for AP. -- ```WiFi.localIP()``` is for STA, ```WiFi.softAPIP()``` is for AP. -- ```WiFi.RSSI()``` doesn't work -- ```WiFi.printDiag(Serial)``` will print out some diagnostic info -- ```WiFiUDP``` class supports sending and receiving multicast packets on STA interface. -When sending a multicast packet, replace ```udp.beginPacket(addr, port)``` with -```udp.beginPacketMulticast(addr, port, WiFi.localIP())```. -When listening to multicast packets, replace ```udp.begin(port)``` with -```udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port)```. -You can use ```udp.destinationIP()``` to tell whether the packet received was -sent to the multicast or unicast address. -Also note that multicast doesn't work on softAP interface. - -```WiFiServer```, ```WiFiClient```, and ```WiFiUDP``` behave mostly the same way as with WiFi shield library. -Four samples are provided for this library. -You can see more commands here: [http://www.arduino.cc/en/Reference/WiFi](http://www.arduino.cc/en/Reference/WiFi) - -#### Ticker #### - -Library for calling functions repeatedly with a certain period. Two examples included. - -It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker -callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function. - -#### EEPROM #### - -This is a bit different from standard EEPROM class. You need to call ```EEPROM.begin(size)``` -before you start reading or writing, size being the number of bytes you want to use. -Size can be anywhere between 4 and 4096 bytes. - -```EEPROM.write``` does not write to flash immediately, instead you must call ```EEPROM.commit()``` -whenever you wish to save changes to flash. ```EEPROM.end()``` will also commit, and will -release the RAM copy of EEPROM contents. - -EEPROM library uses one sector of flash located at 0x7b000 for storage. - -Three examples included. - -#### I2C (Wire library) #### - -Wire library currently supports master mode up to approximately 450KHz. -Before using I2C, pins for SDA and SCL need to be set by calling -```Wire.begin(int sda, int scl)```, i.e. ```Wire.begin(0, 2)``` on ESP-01, -else they default to pins 4(SDA) and 5(SCL). - -#### SPI #### - -SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA). -Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working). - -#### ESP-specific APIs #### - -APIs related to deep sleep and watchdog timer are available in the ```ESP``` object, only available in Alpha version. - -```ESP.deepSleep(microseconds, mode)``` will put the chip into deep sleep. ```mode``` is one of ```WAKE_RF_DEFAULT```, ```WAKE_RFCAL```, ```WAKE_NO_RFCAL```, ```WAKE_RF_DISABLED```. (GPIO16 needs to be tied to RST to wake from deepSleep.) - -```ESP.restart()``` restarts the CPU. - -```ESP.getFreeHeap()``` returns the free heap size. - -```ESP.getChipId()``` returns the ESP8266 chip ID as a 32-bit integer. - -Several APIs may be used to get flash chip info: - -```ESP.getFlashChipId()``` returns the flash chip ID as a 32-bit integer. - -```ESP.getFlashChipSize()``` returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size). - -```ESP.getFlashChipSpeed(void)``` returns the flash chip frequency, in Hz. - -```ESP.getCycleCount()``` returns the cpu instruction cycle count since start as an unsigned 32-bit. This is useful for accurate timing of very short actions like bit banging. - -```ESP.getVcc()``` may be used to measure supply voltage. ESP needs to reconfigure the ADC -at startup in order for this feature to be available. Add the following line to the top -of your sketch to use ```getVcc```: - - ADC_MODE(ADC_VCC); - -TOUT pin has to be disconnected in this mode. - -Note that by default ADC is configured to read from TOUT pin using ```analogRead(A0)```, and -```ESP.getVCC()``` is not available. - -#### OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) #### - -Library was adapted to work with ESP8266 by including register definitions into OneWire.h -Note that if you already have OneWire library in your Arduino/libraries folder, it will be used -instead of the one that comes with this package. - -#### mDNS responder (ESP8266mDNS library) #### - -Allows the sketch to respond to multicast DNS queries for domain names like "foo.local". -Currently the library only works on STA interface, AP interface is not supported. -See attached example and library README file for details. - -#### DNS server (DNSServer library) #### - -Implements a simple DNS server that can be used in both STA and AP modes. The DNS server currently supports only one domain (for all other domains it will reply with NXDOMAIN or custom status code). With it clients can open a web server running on ESP8266 using a domain name, not an IP address. -See attached example for details. - -#### Servo #### - -This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected. -While many RC servo motors will accept the 3.3V IO data pin from a esp8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the esp8266 and the servo motor power supply. - -#### Other libraries (not included with the IDE) - -Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work: - -- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with esp8266 (RFC6455) -- [aREST](https://github.com/marcoschwartz/aREST) REST API handler library. -- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)). -- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git) -- [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: ```DHT dht(DHTPIN, DHTTYPE, 15)``` -- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager). -- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266. Use the "NeoPixelAnimator" branch for esp8266 to get HSL color support and more. -- [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. -- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266. -- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB. +- Adafruit HUZZAH ESP8266 (ESP-12) - [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with esp8266. Just make sure to modify the pins in the examples as they are still AVR specific. -#### Upload via serial port #### -Pick the correct serial port. -You need to put ESP8266 into bootloader mode before uploading code. - -#### Power Supply #### - -For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. - -* Note - - using Power from USB to Serial is may unstable, they not deliver enough current. - -#### Serial Adapter #### - -There are many different USB to Serial adapters / boards. - -* Note - - for full upload management you need RTS and DTR - - the chip need to have 3.3V TTL (5V may damage the chip) - - not all board have all pins of the ICs as breakout (check before order) - - CTS and DSR are not useful for upload (they are Inputs) - -* Working ICs - - FT232RL - - CP2102 - - may others (drop a comment) - -#### Minimal hardware Setup for Bootloading and usage #### - -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | -------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2* | | RX | -| RX | | TX | -| GPIO0 | PullUp | DTR | -| Reset* | | RTS | -| GPIO15* | PullDown | | -| CH_PD | PullUp | | - -* Note - - GPIO15 is also named MTDO - - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) - - GPIO2 is alternative TX for the boot loader mode - -###### esp to Serial -![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) - -#### Minimal hardware Setup for Bootloading only #### -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2 | | RX | -| RX | | TX | -| GPIO0 | | GND | -| Reset | | RTS* | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -* Note - - if no RTS is used a manual power toggle is needed - -#### Minimal hardware Setup for running only #### - -ESPxx Hardware - -| PIN | Resistor | Power supply | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| GPIO0 | PullUp | | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -###### minimal -![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) - -###### improved stability -![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) - ### Issues and support ### Forum: http://www.esp8266.com/arduino @@ -311,14 +41,14 @@ Submit issues on Github: https://github.com/esp8266/Arduino/issues ### License and credits ### -Arduino IDE is based on Wiring and Processing. It is developed and maintained by the Arduino team. The IDE is licensed under GPL, and the core libraries are licensed under LGPL. +Arduino IDE is based on Wiring and Processing. It is developed and maintained by the Arduino team. The IDE is licensed under GPL. -This build includes an xtensa gcc toolchain, which is also under GPL. - -Espressif SDK included in this build is under Espressif Public License. +ESP8266 core includes an xtensa gcc toolchain, which is also under GPL. Esptool written by Christian Klippel is licensed under GPLv2, currently maintained by Ivan Grokhotkov: https://github.com/igrr/esptool-ck. -ESP8266 core support, ESP8266WiFi, Ticker, ESP8266WebServer libraries were written by Ivan Grokhotkov, ivan@esp8266.com. +Espressif SDK included in this build is under Espressif MIT License. + +ESP8266 core files are licensed under LGPL. [SPI Flash File System (SPIFFS)](https://github.com/pellepl/spiffs) written by Peter Andersson is used in this project. It is distributed under MIT license. diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md new file mode 100644 index 0000000000..b607fb43be --- /dev/null +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -0,0 +1,274 @@ +### ESP8266 Arduino Core Reference + +#### [Change log](hardware/esp8266com/esp8266/changes.md) + +#### GPIO functions #### + +`pinMode`, `digitalRead`, `digitalWrite`, `analogWrite` functions work as usual. + +Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, call `digitalRead(2)`. + +GPIO0 — GPIO15 can be `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. +GPIO16 can be `INPUT`, `OUTPUT` or `INPUT_PULLDOWN`. + +`analogRead(A0)` reads the value of the ADC channel connected to the TOUT pin. + +`analogWrite(pin, value)` enables software PWM on the given pin. PWM may be used on pins 0 to 15. +Call `analogWrite(pin, 0)` to disable PWM on the pin. `value` may be in range from 0 to `PWMRANGE`, which is currently equal to 1023. + +Pin interrupts are supported through `attachInterrupt`, `detachInterrupt` functions. +Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt +types are supported: `CHANGE`, `RISING`, `FALLING`. + +#### Pin Functions #### + +![Pin Functions](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/pin_functions.png) +The most usable pin functions are mapped to the macro `SPECIAL`, so calling `pinMode(pin, SPECIAL)` +will switch that pin in the most usable `FUNCTION_X`. Those are UART RX/TX on pins 1 - 3, HSPI for pins 12-15 and CLK functions for pins 0, 4 and 5. + +#### Timing and delays #### +`millis()` and `micros()` return the number of milliseconds and microseconds elapsed after reset, respectively. + +`delay(ms)` pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run. +`delayMicroseconds(us)` pauses for a given number of microseconds. + +Remember that there is a lot of code that needs to run on the chip besides the sketch +when WiFi is connected. WiFi and TCP/IP libraries get a chance to handle any pending +events each time the `loop()` function completes, OR when `delay` is called. +If you have a loop somewhere in your sketch that takes a lot of time (>50ms) without +calling `delay`, you might consider adding a call to `delay` function to keep the WiFi +stack running smoothly. + +There is also a `yield()` function which is equivalent to `delay(0)`. The `delayMicroseconds` +function, on the other hand, does not yield to other tasks, so using it for delays +more than 20 milliseconds is not recommended. + +#### Serial #### + +`Serial` object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty. + +`Serial` uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling `Serial.swap()` after `Serial.begin`. Calling `swap` again maps UART0 back to GPIO1 and GPIO3. + +`Serial1` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use `Serial1`, call `Serial1.begin(baudrate)`. + +By default the diagnostic output from WiFi libraries is disabled when you call `Serial.begin`. To enable debug output again, call `Serial.setDebugOutput(true)`. To redirect debug output to `Serial1` instead, call `Serial1.setDebugOutput(true)`. + +You also need to use `Serial.setDebugOutput(true)` to enable output from `printf()` function. + +Both `Serial` and `Serial1` objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call `Serial.begin(baudrate, SERIAL_8N1)`, `Serial.begin(baudrate, SERIAL_6E2)`, etc. + +#### Progmem #### + +The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application. +The important difference is that on the esp8266 the literal strings are not pooled. This means that the same literal string defined inside a `F("")` and/or `PSTR("")` will take up space for each instance in the code. So you will need to manage the duplicate strings yourself. + +#### WiFi(ESP8266WiFi library) #### + +This is mostly similar to WiFi shield library. Differences include: + +- `WiFi.mode(m)`: set mode to `WIFI_AP`, `WIFI_STA`, or `WIFI_AP_STA`. +- call `WiFi.softAP(ssid)` to set up an open network +- call `WiFi.softAP(ssid, password)` to set up a WPA2-PSK network (password should be at least 8 characters) +- `WiFi.macAddress(mac)` is for STA, `WiFi.softAPmacAddress(mac)` is for AP. +- `WiFi.localIP()` is for STA, `WiFi.softAPIP()` is for AP. +- `WiFi.RSSI()` doesn't work +- `WiFi.printDiag(Serial)` will print out some diagnostic info +- `WiFiUDP` class supports sending and receiving multicast packets on STA interface. +When sending a multicast packet, replace `udp.beginPacket(addr, port)` with +`udp.beginPacketMulticast(addr, port, WiFi.localIP())`. +When listening to multicast packets, replace `udp.begin(port)` with +`udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port)`. +You can use `udp.destinationIP()` to tell whether the packet received was +sent to the multicast or unicast address. +Also note that multicast doesn't work on softAP interface. + +`WiFiServer`, `WiFiClient`, and `WiFiUDP` behave mostly the same way as with WiFi shield library. +Four samples are provided for this library. +You can see more commands here: [http://www.arduino.cc/en/Reference/WiFi](http://www.arduino.cc/en/Reference/WiFi) + +#### Ticker #### + +Library for calling functions repeatedly with a certain period. Two examples included. + +It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker +callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function. + +#### EEPROM #### + +This is a bit different from standard EEPROM class. You need to call `EEPROM.begin(size)` +before you start reading or writing, size being the number of bytes you want to use. +Size can be anywhere between 4 and 4096 bytes. + +`EEPROM.write` does not write to flash immediately, instead you must call `EEPROM.commit()` +whenever you wish to save changes to flash. `EEPROM.end()` will also commit, and will +release the RAM copy of EEPROM contents. + +EEPROM library uses one sector of flash located at 0x7b000 for storage. + +Three examples included. + +#### I2C (Wire library) #### + +Wire library currently supports master mode up to approximately 450KHz. +Before using I2C, pins for SDA and SCL need to be set by calling +`Wire.begin(int sda, int scl)`, i.e. `Wire.begin(0, 2)` on ESP-01, +else they default to pins 4(SDA) and 5(SCL). + +#### SPI #### + +SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA). +Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working). + +#### ESP-specific APIs #### + +APIs related to deep sleep and watchdog timer are available in the `ESP` object, only available in Alpha version. + +`ESP.deepSleep(microseconds, mode)` will put the chip into deep sleep. `mode` is one of `WAKE_RF_DEFAULT`, `WAKE_RFCAL`, `WAKE_NO_RFCAL`, `WAKE_RF_DISABLED`. (GPIO16 needs to be tied to RST to wake from deepSleep.) + +`ESP.restart()` restarts the CPU. + +`ESP.getFreeHeap()` returns the free heap size. + +`ESP.getChipId()` returns the ESP8266 chip ID as a 32-bit integer. + +Several APIs may be used to get flash chip info: + +`ESP.getFlashChipId()` returns the flash chip ID as a 32-bit integer. + +`ESP.getFlashChipSize()` returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size). + +`ESP.getFlashChipSpeed(void)` returns the flash chip frequency, in Hz. + +`ESP.getCycleCount()` returns the cpu instruction cycle count since start as an unsigned 32-bit. This is useful for accurate timing of very short actions like bit banging. + +`ESP.getVcc()` may be used to measure supply voltage. ESP needs to reconfigure the ADC +at startup in order for this feature to be available. Add the following line to the top +of your sketch to use `getVcc`: + + ADC_MODE(ADC_VCC); + +TOUT pin has to be disconnected in this mode. + +Note that by default ADC is configured to read from TOUT pin using `analogRead(A0)`, and +`ESP.getVCC()` is not available. + +#### OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) #### + +Library was adapted to work with ESP8266 by including register definitions into OneWire.h +Note that if you already have OneWire library in your Arduino/libraries folder, it will be used +instead of the one that comes with this package. + +#### mDNS responder (ESP8266mDNS library) #### + +Allows the sketch to respond to multicast DNS queries for domain names like "foo.local". +Currently the library only works on STA interface, AP interface is not supported. +See attached example and library README file for details. + +#### DNS server (DNSServer library) #### + +Implements a simple DNS server that can be used in both STA and AP modes. The DNS server currently supports only one domain (for all other domains it will reply with NXDOMAIN or custom status code). With it clients can open a web server running on ESP8266 using a domain name, not an IP address. +See attached example for details. + +#### Servo #### + +This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected. +While many RC servo motors will accept the 3.3V IO data pin from a esp8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the esp8266 and the servo motor power supply. + +#### Other libraries (not included with the IDE) + +Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work: + +- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with esp8266 (RFC6455) +- [aREST](https://github.com/marcoschwartz/aREST) REST API handler library. +- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)). +- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git) +- [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: `DHT dht(DHTPIN, DHTTYPE, 15)` +- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager). +- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266. Use the "NeoPixelAnimator" branch for esp8266 to get HSL color support and more. +- [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. +- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266. +- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB. + +#### Upload via serial port #### +Pick the correct serial port. +You need to put ESP8266 into bootloader mode before uploading code. + +#### Power Supply #### + +For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. + +* Note + - using Power from USB to Serial is may unstable, they not deliver enough current. + +#### Serial Adapter #### + +There are many different USB to Serial adapters / boards. + +* Note + - for full upload management you need RTS and DTR + - the chip need to have 3.3V TTL (5V may damage the chip) + - not all board have all pins of the ICs as breakout (check before order) + - CTS and DSR are not useful for upload (they are Inputs) + +* Working ICs + - FT232RL + - CP2102 + - may others (drop a comment) + +#### Minimal hardware Setup for Bootloading and usage #### + +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | -------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2* | | RX | +| RX | | TX | +| GPIO0 | PullUp | DTR | +| Reset* | | RTS | +| GPIO15* | PullDown | | +| CH_PD | PullUp | | + +* Note + - GPIO15 is also named MTDO + - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) + - GPIO2 is alternative TX for the boot loader mode + +###### esp to Serial +![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) + +#### Minimal hardware Setup for Bootloading only #### +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2 | | RX | +| RX | | TX | +| GPIO0 | | GND | +| Reset | | RTS* | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +* Note + - if no RTS is used a manual power toggle is needed + +#### Minimal hardware Setup for running only #### + +ESPxx Hardware + +| PIN | Resistor | Power supply | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| GPIO0 | PullUp | | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +###### Minimal +![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) + +###### Improved stability +![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) From 6811610db3bc54ddf0488ba25f72d097385c0463 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 15 Jul 2015 13:51:17 +0300 Subject: [PATCH 07/18] Documentation update - mention stable and staging package - add release date badges - add a pin map diagram which is easier to understand (#424) - consistently use ESP8266 in capital letters - digital, analog IO sections rewrite --- README.md | 20 +- build/build_board_manager_package.sh | 28 +- hardware/esp8266com/esp8266/doc/README.md | 49 +- hardware/esp8266com/esp8266/doc/esp12.svg | 1187 +++++++++++++++++++++ 4 files changed, 1254 insertions(+), 30 deletions(-) create mode 100644 hardware/esp8266com/esp8266/doc/esp12.svg diff --git a/README.md b/README.md index de923288ff..f4070002e0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ Arduino-compatible IDE with ESP8266 support =========================================== [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) -[![Donate](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=4M56YCWV6PX66) This project brings support for ESP8266 chip to the Arduino environment. ESP8266WiFi library bundled with this project has the same interface as the WiFi Shield library, making it easy to re-use existing code and libraries. @@ -10,11 +9,18 @@ This project brings support for ESP8266 chip to the Arduino environment. ESP8266 Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit). -- Install Arduino 1.6.4 from the [Arduino website](http://www.arduino.cc/en/main/software). +- Install Arduino 1.6.5 from the [Arduino website](http://www.arduino.cc/en/main/software). - Start Arduino and open Perferences window. - Enter ```http://arduino.esp8266.com/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation). +#### Available versions +Release | URL | Documentation +----|----|---- +![](http://arduino.esp8266.com/badge.svg) | http://arduino.esp8266.com/package_esp8266com_index.json | [Reference](http://arduino.esp8266.com/doc) +![](http://arduino.esp8266.com/staging/badge.svg) | http://arduino.esp8266.com/staging/package_esp8266com_index.json | [Reference](http://arduino.esp8266.com/staging/doc) + + ### Building latest version from source ### ``` $ git clone https://github.com/esp8266/Arduino.git @@ -26,7 +32,7 @@ $ ant dist Latest development version: [Reference](hardware/esp8266com/esp8266/doc/README.md) ### Supported boards ### -- Generic esp8266 modules (without auto-reset support) +- Generic ESP8266 modules (without auto-reset support) - NodeMCU 0.9 - NodeMCU 1.0 - Olimex MOD-WIFI-ESP8266 @@ -39,6 +45,14 @@ Forum: http://www.esp8266.com/arduino Submit issues on Github: https://github.com/esp8266/Arduino/issues +### Contributing + +For minor fixes of code and documentation, go ahead and submit a pull request. + +Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed first [in the chat](https://gitter.im/esp8266/Arduino). + +Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request. + ### License and credits ### Arduino IDE is based on Wiring and Processing. It is developed and maintained by the Arduino team. The IDE is licensed under GPL. diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh index 64834f7001..3b4a6afdfd 100755 --- a/build/build_board_manager_package.sh +++ b/build/build_board_manager_package.sh @@ -27,17 +27,29 @@ size=`/bin/ls -l $outdir.zip | awk '{print $5}'` echo Size: $size echo SHA-256: $sha -if [ "$upload" == "prod" ]; then - remote="http://arduino.esp8266.com" +if [ "$upload" == "stable" ]; then + badge_title="stable" + badge_color="blue" path="" -elif [ "$upload" == "stag" ]; then - remote="http://arduino.esp8266.com" +elif [ "$upload" == "staging" ]; then + badge_title="staging" + badge_color="yellow" path="staging/" +elif [ "$upload" == "test" ]; then + badge_title="test" + badge_color="red" + path="test/" else upload="" remote="http://localhost:8000" fi +if [ ! -z "$upload" ]; then + remote="http://arduino.esp8266.com" + release_date=$(date "+%b_%d,_%Y") + wget -O badge.svg https://img.shields.io/badge/$badge_title-$release_date-$badge_color.svg +fi + cat << EOF > package_esp8266com_index.json { "packages": [ { @@ -120,7 +132,7 @@ cat << EOF > package_esp8266com_index.json "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.5/esptool-0.4.5-linux32.tar.gz", "archiveFileName":"esptool-0.4.5-linux32.tar.gz", "checksum":"SHA-256:4aa81b97a470641771cf371e5d470ac92d3b177adbe8263c4aae66e607b67755", - "size":"12044" + "size":"12044" } ] }, @@ -168,9 +180,7 @@ if [ ! -z "$upload" ]; then scp $outdir.zip $remote_path scp package_esp8266com_index.json $remote_path scp -r $srcdir/doc $remote_path + scp badge.svg $remote_path else - python -m SimpleHTTPServer + python -m SimpleHTTPServer fi - - - diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index b607fb43be..c7b3db784f 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -1,17 +1,35 @@ ### ESP8266 Arduino Core Reference -#### [Change log](hardware/esp8266com/esp8266/changes.md) +#### [Change log](changes.md) -#### GPIO functions #### +#### Digital IO #### -`pinMode`, `digitalRead`, `digitalWrite`, `analogWrite` functions work as usual. +Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers. `pinMode`, `digitalRead`, and `digitalWrite` functions work as usual, so to read GPIO2, call `digitalRead(2)`. -Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2, call `digitalRead(2)`. +Digital pins 0—15 can be `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. +Pin 16 can be `INPUT`, `OUTPUT` or `INPUT_PULLDOWN`. At startup, pins are configured as `INPUT`. -GPIO0 — GPIO15 can be `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. -GPIO16 can be `INPUT`, `OUTPUT` or `INPUT_PULLDOWN`. +Pins may also serve other functions, like Serial, I2C, SPI. These functions are normally activated by the corresponding library. The diagram below shows pin mapping for the popular ESP-12 module. -`analogRead(A0)` reads the value of the ADC channel connected to the TOUT pin. +![Pin Functions](esp12.svg) + +Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash. + +Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one). + +#### Analog input + +ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC). + +To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V, and the reference voltage is derived from VCC, which is assumed to be 3.3V. + +To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch: +```C++ +ADC_MODE(ADC_VCC); +``` +This line has to appear outside of any functions, for instance right after the `#include ` lines of your sketch. + +#### Analog output `analogWrite(pin, value)` enables software PWM on the given pin. PWM may be used on pins 0 to 15. Call `analogWrite(pin, 0)` to disable PWM on the pin. `value` may be in range from 0 to `PWMRANGE`, which is currently equal to 1023. @@ -20,11 +38,6 @@ Pin interrupts are supported through `attachInterrupt`, `detachInterrupt` functi Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt types are supported: `CHANGE`, `RISING`, `FALLING`. -#### Pin Functions #### - -![Pin Functions](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/pin_functions.png) -The most usable pin functions are mapped to the macro `SPECIAL`, so calling `pinMode(pin, SPECIAL)` -will switch that pin in the most usable `FUNCTION_X`. Those are UART RX/TX on pins 1 - 3, HSPI for pins 12-15 and CLK functions for pins 0, 4 and 5. #### Timing and delays #### `millis()` and `micros()` return the number of milliseconds and microseconds elapsed after reset, respectively. @@ -49,7 +62,7 @@ more than 20 milliseconds is not recommended. `Serial` uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling `Serial.swap()` after `Serial.begin`. Calling `swap` again maps UART0 back to GPIO1 and GPIO3. -`Serial1` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use `Serial1`, call `Serial1.begin(baudrate)`. +`Serial1` uses UART1, TX pin is GPIO2. UART1 can not be used to receive data because normally it's RX pin is occupied for flash chip connection. To use `Serial1`, call `Serial1.begin(baudrate)`. By default the diagnostic output from WiFi libraries is disabled when you call `Serial.begin`. To enable debug output again, call `Serial.setDebugOutput(true)`. To redirect debug output to `Serial1` instead, call `Serial1.setDebugOutput(true)`. @@ -60,7 +73,7 @@ Both `Serial` and `Serial1` objects support 5, 6, 7, 8 data bits, odd (O), even #### Progmem #### The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application. -The important difference is that on the esp8266 the literal strings are not pooled. This means that the same literal string defined inside a `F("")` and/or `PSTR("")` will take up space for each instance in the code. So you will need to manage the duplicate strings yourself. +The important difference is that on the ESP8266 the literal strings are not pooled. This means that the same literal string defined inside a `F("")` and/or `PSTR("")` will take up space for each instance in the code. So you will need to manage the duplicate strings yourself. #### WiFi(ESP8266WiFi library) #### @@ -172,21 +185,21 @@ See attached example for details. #### Servo #### This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected. -While many RC servo motors will accept the 3.3V IO data pin from a esp8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the esp8266 and the servo motor power supply. +While many RC servo motors will accept the 3.3V IO data pin from a ESP8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the ESP8266 and the servo motor power supply. #### Other libraries (not included with the IDE) Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work: -- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with esp8266 (RFC6455) +- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with ESP8266 (RFC6455) - [aREST](https://github.com/marcoschwartz/aREST) REST API handler library. - [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)). - [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git) - [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: `DHT dht(DHTPIN, DHTTYPE, 15)` - [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager). -- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266. Use the "NeoPixelAnimator" branch for esp8266 to get HSL color support and more. +- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with ESP8266. Use the "NeoPixelAnimator" branch for ESP8266 to get HSL color support and more. - [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. -- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266. +- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266. - [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB. #### Upload via serial port #### diff --git a/hardware/esp8266com/esp8266/doc/esp12.svg b/hardware/esp8266com/esp8266/doc/esp12.svg new file mode 100644 index 0000000000..a4daabbf81 --- /dev/null +++ b/hardware/esp8266com/esp8266/doc/esp12.svg @@ -0,0 +1,1187 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RESET + + + + RESET + + + + + ADC + + + + GPIO16 + + + + + D16 + + + + CHPD + + + + D14~ + + + + D12~ + + + + D13~ + + + + D15~ + + + + RESET + + + + VCC + + + + GND + + + + D2~ + + + + D0~ + + + + D4~ + + + + D5~ + + + + D3~ + + + + D1~ + + + + TX0 + + + + RX0 + + + + RX0* + + + + TX0* + + + + TX1 + + + + SDA + + + + SCL + + + + SS + + + + MISO + + + + MOSI + + + + SCK + + ESP-12 + + From 6b67905b5d5b1d41d8a81a288de9bbfccbe4712a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 16 Jul 2015 06:05:53 +0300 Subject: [PATCH 08/18] Documentation update --- README.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f4070002e0..eb74b27419 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Arduino-compatible IDE with ESP8266 support =========================================== -[![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) - This project brings support for ESP8266 chip to the Arduino environment. ESP8266WiFi library bundled with this project has the same interface as the WiFi Shield library, making it easy to re-use existing code and libraries. ### Installing with Boards Manager ### @@ -15,13 +13,20 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package - Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation). #### Available versions -Release | URL | Documentation -----|----|---- -![](http://arduino.esp8266.com/badge.svg) | http://arduino.esp8266.com/package_esp8266com_index.json | [Reference](http://arduino.esp8266.com/doc) -![](http://arduino.esp8266.com/staging/badge.svg) | http://arduino.esp8266.com/staging/package_esp8266com_index.json | [Reference](http://arduino.esp8266.com/staging/doc) +##### Stable version ![](http://arduino.esp8266.com/badge.svg) +Boards manager link: `http://arduino.esp8266.com/package_esp8266com_index.json` + +Documentation: [Reference](http://arduino.esp8266.com/doc) + +##### Staging version ![](http://arduino.esp8266.com/staging/badge.svg) +Boards manager link: `http://arduino.esp8266.com/staging/package_esp8266com_index.json` + +Documentation: [Reference](http://arduino.esp8266.com/staging/doc) + + +### Building latest version from source [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) -### Building latest version from source ### ``` $ git clone https://github.com/esp8266/Arduino.git $ cd Arduino/build @@ -49,7 +54,7 @@ Submit issues on Github: https://github.com/esp8266/Arduino/issues For minor fixes of code and documentation, go ahead and submit a pull request. -Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed first [in the chat](https://gitter.im/esp8266/Arduino). +Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed [in the chat](https://gitter.im/esp8266/Arduino) first. Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request. From c28d9578b234e428e5ef614244b18140e5a075b5 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 16 Jul 2015 09:24:56 +0300 Subject: [PATCH 09/18] Update README, mention SweetPea ESP-210 support --- README.md | 8 ++++---- build/build_board_manager_package.sh | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb74b27419..b9011e5019 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,12 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package ##### Stable version ![](http://arduino.esp8266.com/badge.svg) Boards manager link: `http://arduino.esp8266.com/package_esp8266com_index.json` -Documentation: [Reference](http://arduino.esp8266.com/doc) +Documentation: [Reference](http://arduino.esp8266.com/doc/README.md) ##### Staging version ![](http://arduino.esp8266.com/staging/badge.svg) Boards manager link: `http://arduino.esp8266.com/staging/package_esp8266com_index.json` -Documentation: [Reference](http://arduino.esp8266.com/staging/doc) +Documentation: [Reference](http://arduino.esp8266.com/staging/doc/README.md) ### Building latest version from source [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) @@ -42,7 +42,7 @@ Latest development version: [Reference](hardware/esp8266com/esp8266/doc/README.m - NodeMCU 1.0 - Olimex MOD-WIFI-ESP8266 - Adafruit HUZZAH ESP8266 (ESP-12) -- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with esp8266. Just make sure to modify the pins in the examples as they are still AVR specific. +- SweetPea ESP-210 ### Issues and support ### @@ -60,7 +60,7 @@ Feature branches with lots of small commits (especially titled "oops", "fix typo ### License and credits ### -Arduino IDE is based on Wiring and Processing. It is developed and maintained by the Arduino team. The IDE is licensed under GPL. +Arduino IDE is developed and maintained by the Arduino team. The IDE is licensed under GPL. ESP8266 core includes an xtensa gcc toolchain, which is also under GPL. diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh index 3b4a6afdfd..ef88d35adb 100755 --- a/build/build_board_manager_package.sh +++ b/build/build_board_manager_package.sh @@ -88,6 +88,9 @@ cat << EOF > package_esp8266com_index.json }, { "name":"Adafruit HUZZAH ESP8266 (ESP-12)" + }, + { + "name":"SweetPea ESP-210" } ], "toolsDependencies":[ { From e63bbcc34b8ee86747c484f27350186f99e0ddcf Mon Sep 17 00:00:00 2001 From: h4rm0n1c Date: Thu, 16 Jul 2015 17:43:57 +0800 Subject: [PATCH 10/18] Reworded Serial to USB Power Supply Note --- hardware/esp8266com/esp8266/doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index c7b3db784f..829791e135 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -211,7 +211,7 @@ You need to put ESP8266 into bootloader mode before uploading code. For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. * Note - - using Power from USB to Serial is may unstable, they not deliver enough current. + - Using the Power available from the USB to Serial adapter is not reccomended, these adapters typically do not supply enough current to run the ESP8266 reliably in every situation, an external supply or regulator is preferred. #### Serial Adapter #### From 1a0b2151324b02d16fe31bbb6331ec0018a0c4e9 Mon Sep 17 00:00:00 2001 From: h4rm0n1c Date: Thu, 16 Jul 2015 17:54:05 +0800 Subject: [PATCH 11/18] Added PullUp to Reset --- hardware/esp8266com/esp8266/doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index 829791e135..2031071ac8 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -239,7 +239,7 @@ ESPxx Hardware | TX or GPIO2* | | RX | | RX | | TX | | GPIO0 | PullUp | DTR | -| Reset* | | RTS | +| Reset* | PullUp | RTS | | GPIO15* | PullDown | | | CH_PD | PullUp | | From d8bd297740769f9311283decd4d2da2fa5838fdc Mon Sep 17 00:00:00 2001 From: h4rm0n1c Date: Thu, 16 Jul 2015 17:58:06 +0800 Subject: [PATCH 12/18] Case correction, beautification of titles. --- hardware/esp8266com/esp8266/doc/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index 2031071ac8..2230529584 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -228,7 +228,7 @@ There are many different USB to Serial adapters / boards. - CP2102 - may others (drop a comment) -#### Minimal hardware Setup for Bootloading and usage #### +#### Minimal Hardware Setup for Bootloading and Usage #### ESPxx Hardware @@ -248,10 +248,10 @@ ESPxx Hardware - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) - GPIO2 is alternative TX for the boot loader mode -###### esp to Serial +###### ESP to Serial ![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) -#### Minimal hardware Setup for Bootloading only #### +#### Minimal Hardware Setup for Bootloading only #### ESPxx Hardware | PIN | Resistor | Serial Adapter | @@ -268,7 +268,7 @@ ESPxx Hardware * Note - if no RTS is used a manual power toggle is needed -#### Minimal hardware Setup for running only #### +#### Minimal Hardware Setup for Running only #### ESPxx Hardware @@ -283,5 +283,5 @@ ESPxx Hardware ###### Minimal ![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) -###### Improved stability +###### Improved Stability ![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) From 26c0272f22dd1968f939cb0b2605bf7189aaf74e Mon Sep 17 00:00:00 2001 From: h4rm0n1c Date: Thu, 16 Jul 2015 18:02:50 +0800 Subject: [PATCH 13/18] Added Note about Pullup and Pulldown resistors. --- hardware/esp8266com/esp8266/doc/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index 2230529584..025ffa8024 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -247,6 +247,7 @@ ESPxx Hardware - GPIO15 is also named MTDO - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) - GPIO2 is alternative TX for the boot loader mode + - **Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.** ###### ESP to Serial ![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) From 920cea674676e53fe73e02f8bf16ae72cb825ab7 Mon Sep 17 00:00:00 2001 From: h4rm0n1c Date: Thu, 16 Jul 2015 18:13:23 +0800 Subject: [PATCH 14/18] Added workaround for broken SVG rendering. As discussed here: https://github.com/isaacs/github/issues/316 --- hardware/esp8266com/esp8266/doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/README.md index 025ffa8024..2b912968ae 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/README.md @@ -11,7 +11,7 @@ Pin 16 can be `INPUT`, `OUTPUT` or `INPUT_PULLDOWN`. At startup, pins are config Pins may also serve other functions, like Serial, I2C, SPI. These functions are normally activated by the corresponding library. The diagram below shows pin mapping for the popular ESP-12 module. -![Pin Functions](esp12.svg) +![Pin Functions](https://cdn.rawgit.com/esp8266/Arduino/doc-update/hardware/esp8266com/esp8266/doc/esp12.svg) Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash. From a7c4d2916924d47e09ffad756652fcc3e1c0b437 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 22 Jul 2015 15:04:40 +0300 Subject: [PATCH 15/18] Documentation update add jekyll front matters, update links --- README.md | 24 ++-- hardware/esp8266com/esp8266/doc/boards.md | 28 ++++ hardware/esp8266com/esp8266/doc/changes.md | 13 +- hardware/esp8266com/esp8266/doc/generic.md | 85 +++++++++++ .../esp8266/doc/{README.md => reference.md} | 133 ++++-------------- 5 files changed, 156 insertions(+), 127 deletions(-) create mode 100644 hardware/esp8266com/esp8266/doc/boards.md create mode 100644 hardware/esp8266com/esp8266/doc/generic.md rename hardware/esp8266com/esp8266/doc/{README.md => reference.md} (75%) diff --git a/README.md b/README.md index b9011e5019..b34fda4d4b 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,20 @@ Starting with 1.6.4, Arduino allows installation of third-party platform package - Install Arduino 1.6.5 from the [Arduino website](http://www.arduino.cc/en/main/software). - Start Arduino and open Perferences window. -- Enter ```http://arduino.esp8266.com/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. +- Enter ```http://arduino.esp8266.com/stable/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation). #### Available versions -##### Stable version ![](http://arduino.esp8266.com/badge.svg) -Boards manager link: `http://arduino.esp8266.com/package_esp8266com_index.json` +##### Stable version ![](http://arduino.esp8266.com/stable/badge.svg) +Boards manager link: `http://arduino.esp8266.com/stable/package_esp8266com_index.json` -Documentation: [Reference](http://arduino.esp8266.com/doc/README.md) +Documentation: [Reference](http://arduino.esp8266.com/stable/doc/reference.html) ##### Staging version ![](http://arduino.esp8266.com/staging/badge.svg) Boards manager link: `http://arduino.esp8266.com/staging/package_esp8266com_index.json` -Documentation: [Reference](http://arduino.esp8266.com/staging/doc/README.md) +Documentation: [Reference](http://arduino.esp8266.com/staging/doc/reference.html) ### Building latest version from source [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) @@ -34,15 +34,11 @@ $ ant dist ``` ### Documentation ### -Latest development version: [Reference](hardware/esp8266com/esp8266/doc/README.md) - -### Supported boards ### -- Generic ESP8266 modules (without auto-reset support) -- NodeMCU 0.9 -- NodeMCU 1.0 -- Olimex MOD-WIFI-ESP8266 -- Adafruit HUZZAH ESP8266 (ESP-12) -- SweetPea ESP-210 +Latest development version: + +- [Reference](hardware/esp8266com/esp8266/doc/reference.md) +- [Supported boards](hardware/esp8266com/esp8266/doc/boards.md) +- [Change log](hardware/esp8266com/esp8266/doc/changes.md) ### Issues and support ### diff --git a/hardware/esp8266com/esp8266/doc/boards.md b/hardware/esp8266com/esp8266/doc/boards.md new file mode 100644 index 0000000000..e332441d8f --- /dev/null +++ b/hardware/esp8266com/esp8266/doc/boards.md @@ -0,0 +1,28 @@ +--- +title: Supported Hardware +layout: page +--- + +- [Adafruit HUZZAH ESP8266 (ESP-12)](#adafruit-huzzah-esp8266-esp-12) +- [NodeMCU 0.9](#nodemcu-0-9) +- [NodeMCU 1.0](#nodemcu-1-0) +- [Olimex MOD-WIFI-ESP8266](#olimex-mod-wifi-esp8266) +- [SweetPea ESP-210](#sweetpea-esp-210) +- [Generic ESP8266 modules](#generic-esp8266-modules) + +### Adafruit HUZZAH ESP8266 (ESP-12) + +### NodeMCU 0.9 + +### NodeMCU 1.0 + +### Olimex MOD-WIFI-ESP8266 + +### SweetPea ESP-210 + +### Generic ESP8266 modules + +These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info: +[ESP8266 Module Family](http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family). + +Usually these modules have no bootstapping resistors on board, insufficient decoupling capacitors, no voltage regulator, no reset circuit, and no USB-serial adapter. This makes using them somewhat tricky, compared to development boards which add these features. diff --git a/hardware/esp8266com/esp8266/doc/changes.md b/hardware/esp8266com/esp8266/doc/changes.md index 22da473e83..b89dfb7fb1 100644 --- a/hardware/esp8266com/esp8266/doc/changes.md +++ b/hardware/esp8266com/esp8266/doc/changes.md @@ -1,6 +1,8 @@ -# Change log +--- +title: Change log +--- + -## Current version ### Core @@ -8,7 +10,7 @@ ### Libraries -- ESP8266WebServer: add gzip streaming, fix sendContent behaviour, +- ESP8266WebServer: add gzip streaming, fix sendContent behaviour, add setContentSize method. - ESP8266WiFi: add BSSID, channel, isHidden methods, fix AP/STA mode selection (#28). @@ -31,8 +33,8 @@ May 22, 2015 - Better connection handling in ESP8266WebServer. The server now sends Content-Length and Connection: close headers, then waits for the client to disconnect. By not closing the connection - actively, server avoids TIME_WAIT TCP state, and TCP stack is able to - release the memory immediately, without waiting for 2xMSL period. + actively, server avoids TIME_WAIT TCP state, and TCP stack is able to + release the memory immediately, without waiting for 2xMSL period. If the client doesn't disconnect in 2000ms, the server closes the connection actively. - Add Hash library, which has a function to calculate SHA1 hash. @@ -45,4 +47,3 @@ May 22, 2015 May 19, 2015 - Initial release of Boards Manager package for ESP8266 platform. - diff --git a/hardware/esp8266com/esp8266/doc/generic.md b/hardware/esp8266com/esp8266/doc/generic.md new file mode 100644 index 0000000000..84435c98d4 --- /dev/null +++ b/hardware/esp8266com/esp8266/doc/generic.md @@ -0,0 +1,85 @@ + +## Upload via serial port +Pick the correct serial port. +You need to put ESP8266 into bootloader mode before uploading code. + +## Power Supply + +For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. + +* Note + - Using the Power available from the USB to Serial adapter is not reccomended, these adapters typically do not supply enough current to run the ESP8266 reliably in every situation, an external supply or regulator is preferred. + +## Serial Adapter + +There are many different USB to Serial adapters / boards. + +* Note + - for full upload management you need RTS and DTR + - the chip need to have 3.3V TTL (5V may damage the chip) + - not all board have all pins of the ICs as breakout (check before order) + - CTS and DSR are not useful for upload (they are Inputs) + +* Working ICs + - FT232RL + - CP2102 + - may others (drop a comment) + +## Minimal Hardware Setup for Bootloading and Usage + +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | -------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2* | | RX | +| RX | | TX | +| GPIO0 | PullUp | DTR | +| Reset* | PullUp | RTS | +| GPIO15* | PullDown | | +| CH_PD | PullUp | | + +* Note + - GPIO15 is also named MTDO + - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) + - GPIO2 is alternative TX for the boot loader mode + - **Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.** + +### ESP to Serial +![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) + +## Minimal Hardware Setup for Bootloading only ## +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2 | | RX | +| RX | | TX | +| GPIO0 | | GND | +| Reset | | RTS* | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +* Note + - if no RTS is used a manual power toggle is needed + +## Minimal Hardware Setup for Running only ## + +ESPxx Hardware + +| PIN | Resistor | Power supply | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| GPIO0 | PullUp | | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +### Minimal +![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) + +### Improved Stability +![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) diff --git a/hardware/esp8266com/esp8266/doc/README.md b/hardware/esp8266com/esp8266/doc/reference.md similarity index 75% rename from hardware/esp8266com/esp8266/doc/README.md rename to hardware/esp8266com/esp8266/doc/reference.md index 2b912968ae..f4659412c4 100644 --- a/hardware/esp8266com/esp8266/doc/README.md +++ b/hardware/esp8266com/esp8266/doc/reference.md @@ -1,8 +1,8 @@ -### ESP8266 Arduino Core Reference +--- +title: Reference +--- -#### [Change log](changes.md) - -#### Digital IO #### +## Digital IO Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers. `pinMode`, `digitalRead`, and `digitalWrite` functions work as usual, so to read GPIO2, call `digitalRead(2)`. @@ -17,19 +17,21 @@ Digital pins 6—11 are not shown on this diagram because they are used to conne Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one). -#### Analog input +## Analog input ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC). To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V, and the reference voltage is derived from VCC, which is assumed to be 3.3V. To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch: -```C++ + +```c++ ADC_MODE(ADC_VCC); ``` + This line has to appear outside of any functions, for instance right after the `#include ` lines of your sketch. -#### Analog output +## Analog output `analogWrite(pin, value)` enables software PWM on the given pin. PWM may be used on pins 0 to 15. Call `analogWrite(pin, 0)` to disable PWM on the pin. `value` may be in range from 0 to `PWMRANGE`, which is currently equal to 1023. @@ -39,7 +41,7 @@ Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino inte types are supported: `CHANGE`, `RISING`, `FALLING`. -#### Timing and delays #### +## Timing and delays `millis()` and `micros()` return the number of milliseconds and microseconds elapsed after reset, respectively. `delay(ms)` pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run. @@ -56,7 +58,7 @@ There is also a `yield()` function which is equivalent to `delay(0)`. The `delay function, on the other hand, does not yield to other tasks, so using it for delays more than 20 milliseconds is not recommended. -#### Serial #### +## Serial `Serial` object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty. @@ -70,12 +72,12 @@ You also need to use `Serial.setDebugOutput(true)` to enable output from `printf Both `Serial` and `Serial1` objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call `Serial.begin(baudrate, SERIAL_8N1)`, `Serial.begin(baudrate, SERIAL_6E2)`, etc. -#### Progmem #### +## Progmem The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application. The important difference is that on the ESP8266 the literal strings are not pooled. This means that the same literal string defined inside a `F("")` and/or `PSTR("")` will take up space for each instance in the code. So you will need to manage the duplicate strings yourself. -#### WiFi(ESP8266WiFi library) #### +## WiFi(ESP8266WiFi library) This is mostly similar to WiFi shield library. Differences include: @@ -99,14 +101,14 @@ Also note that multicast doesn't work on softAP interface. Four samples are provided for this library. You can see more commands here: [http://www.arduino.cc/en/Reference/WiFi](http://www.arduino.cc/en/Reference/WiFi) -#### Ticker #### +## Ticker Library for calling functions repeatedly with a certain period. Two examples included. It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function. -#### EEPROM #### +## EEPROM This is a bit different from standard EEPROM class. You need to call `EEPROM.begin(size)` before you start reading or writing, size being the number of bytes you want to use. @@ -120,19 +122,19 @@ EEPROM library uses one sector of flash located at 0x7b000 for storage. Three examples included. -#### I2C (Wire library) #### +## I2C (Wire library) Wire library currently supports master mode up to approximately 450KHz. Before using I2C, pins for SDA and SCL need to be set by calling `Wire.begin(int sda, int scl)`, i.e. `Wire.begin(0, 2)` on ESP-01, else they default to pins 4(SDA) and 5(SCL). -#### SPI #### +## SPI SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA). Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working). -#### ESP-specific APIs #### +## ESP-specific APIs APIs related to deep sleep and watchdog timer are available in the `ESP` object, only available in Alpha version. @@ -158,36 +160,38 @@ Several APIs may be used to get flash chip info: at startup in order for this feature to be available. Add the following line to the top of your sketch to use `getVcc`: - ADC_MODE(ADC_VCC); +```c++ +ADC_MODE(ADC_VCC); +``` TOUT pin has to be disconnected in this mode. Note that by default ADC is configured to read from TOUT pin using `analogRead(A0)`, and `ESP.getVCC()` is not available. -#### OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) #### +## OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) Library was adapted to work with ESP8266 by including register definitions into OneWire.h Note that if you already have OneWire library in your Arduino/libraries folder, it will be used instead of the one that comes with this package. -#### mDNS responder (ESP8266mDNS library) #### +## mDNS responder (ESP8266mDNS library) Allows the sketch to respond to multicast DNS queries for domain names like "foo.local". Currently the library only works on STA interface, AP interface is not supported. See attached example and library README file for details. -#### DNS server (DNSServer library) #### +## DNS server (DNSServer library) Implements a simple DNS server that can be used in both STA and AP modes. The DNS server currently supports only one domain (for all other domains it will reply with NXDOMAIN or custom status code). With it clients can open a web server running on ESP8266 using a domain name, not an IP address. See attached example for details. -#### Servo #### +## Servo This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected. While many RC servo motors will accept the 3.3V IO data pin from a ESP8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the ESP8266 and the servo motor power supply. -#### Other libraries (not included with the IDE) +## Other libraries (not included with the IDE) Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work: @@ -201,88 +205,3 @@ Libraries that don't rely on low-level access to AVR registers should work well. - [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. - [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266. - [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB. - -#### Upload via serial port #### -Pick the correct serial port. -You need to put ESP8266 into bootloader mode before uploading code. - -#### Power Supply #### - -For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. - -* Note - - Using the Power available from the USB to Serial adapter is not reccomended, these adapters typically do not supply enough current to run the ESP8266 reliably in every situation, an external supply or regulator is preferred. - -#### Serial Adapter #### - -There are many different USB to Serial adapters / boards. - -* Note - - for full upload management you need RTS and DTR - - the chip need to have 3.3V TTL (5V may damage the chip) - - not all board have all pins of the ICs as breakout (check before order) - - CTS and DSR are not useful for upload (they are Inputs) - -* Working ICs - - FT232RL - - CP2102 - - may others (drop a comment) - -#### Minimal Hardware Setup for Bootloading and Usage #### - -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | -------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2* | | RX | -| RX | | TX | -| GPIO0 | PullUp | DTR | -| Reset* | PullUp | RTS | -| GPIO15* | PullDown | | -| CH_PD | PullUp | | - -* Note - - GPIO15 is also named MTDO - - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) - - GPIO2 is alternative TX for the boot loader mode - - **Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.** - -###### ESP to Serial -![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) - -#### Minimal Hardware Setup for Bootloading only #### -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2 | | RX | -| RX | | TX | -| GPIO0 | | GND | -| Reset | | RTS* | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -* Note - - if no RTS is used a manual power toggle is needed - -#### Minimal Hardware Setup for Running only #### - -ESPxx Hardware - -| PIN | Resistor | Power supply | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| GPIO0 | PullUp | | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -###### Minimal -![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) - -###### Improved Stability -![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) From 27f6fe52003488bd7edcece33f95a35238e7ff09 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 22 Jul 2015 17:23:28 +0300 Subject: [PATCH 16/18] Add line missing after rebase --- hardware/esp8266com/esp8266/doc/reference.md | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/esp8266com/esp8266/doc/reference.md b/hardware/esp8266com/esp8266/doc/reference.md index f4659412c4..5e3b344493 100644 --- a/hardware/esp8266com/esp8266/doc/reference.md +++ b/hardware/esp8266com/esp8266/doc/reference.md @@ -205,3 +205,4 @@ Libraries that don't rely on low-level access to AVR registers should work well. - [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy. - [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266. - [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB. +- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific. From 8b32ec50a495acad122565affaf2ddd2b0a933c0 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 22 Jul 2015 17:35:35 +0300 Subject: [PATCH 17/18] Update supported boards description --- hardware/esp8266com/esp8266/doc/boards.md | 111 +++++++++++++++++++++ hardware/esp8266com/esp8266/doc/generic.md | 85 ---------------- 2 files changed, 111 insertions(+), 85 deletions(-) delete mode 100644 hardware/esp8266com/esp8266/doc/generic.md diff --git a/hardware/esp8266com/esp8266/doc/boards.md b/hardware/esp8266com/esp8266/doc/boards.md index e332441d8f..af9197029a 100644 --- a/hardware/esp8266com/esp8266/doc/boards.md +++ b/hardware/esp8266com/esp8266/doc/boards.md @@ -12,17 +12,128 @@ layout: page ### Adafruit HUZZAH ESP8266 (ESP-12) +*TODO: add notes* + ### NodeMCU 0.9 +#### Pin mapping + +Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. Constants are defined to make using this board easier: + +```C++ +static const uint8_t D0 = 16; +static const uint8_t D1 = 5; +static const uint8_t D2 = 4; +static const uint8_t D3 = 0; +static const uint8_t D4 = 2; +static const uint8_t D5 = 14; +static const uint8_t D6 = 12; +static const uint8_t D7 = 13; +static const uint8_t D8 = 15; +static const uint8_t D9 = 3; +static const uint8_t D10 = 1; +``` + +If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to 'real' GPIO pin 14. + ### NodeMCU 1.0 +*TODO: add notes* + ### Olimex MOD-WIFI-ESP8266 +*TODO: add notes* + ### SweetPea ESP-210 +*TODO: add notes* + ### Generic ESP8266 modules These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info: [ESP8266 Module Family](http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family). Usually these modules have no bootstapping resistors on board, insufficient decoupling capacitors, no voltage regulator, no reset circuit, and no USB-serial adapter. This makes using them somewhat tricky, compared to development boards which add these features. + +In order to use these modules, make sure to observe the following: + +- **Provide sufficient power to the module.** For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. Using the power available from USB to Serial adapter is not recommended, these adapters typically do not supply enough current to run ESP8266 reliably in every situation. An external supply or regulator along with filtering capacitors is preferred. + +- **Connect bootstapping resistors** to GPIO0, GPIO2, GPIO15 according to the schematics below. + +- **Put ESP8266 into bootloader mode** before uploading code. + +### Serial Adapter + +There are many different USB to Serial adapters / boards. + +* Note + - for full upload management you need RTS and DTR + - the chip need to have 3.3V TTL (5V may damage the chip) + - not all board have all pins of the ICs as breakout (check before order) + - CTS and DSR are not useful for upload (they are Inputs) + +* Working ICs + - FT232RL + - CP2102 + - CH340G + - maybe others (drop a comment) + +### Minimal Hardware Setup for Bootloading and Usage + +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | -------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2* | | RX | +| RX | | TX | +| GPIO0 | PullUp | DTR | +| Reset* | PullUp | RTS | +| GPIO15* | PullDown | | +| CH_PD | PullUp | | + +* Note + - GPIO15 is also named MTDO + - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) + - GPIO2 is alternative TX for the boot loader mode + - **Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.** + +### ESP to Serial +![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) + +#### Minimal Hardware Setup for Bootloading only ## +ESPxx Hardware + +| PIN | Resistor | Serial Adapter | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| TX or GPIO2 | | RX | +| RX | | TX | +| GPIO0 | | GND | +| Reset | | RTS* | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +* Note + - if no RTS is used a manual power toggle is needed + +#### Minimal Hardware Setup for Running only ## + +ESPxx Hardware + +| PIN | Resistor | Power supply | +| ------------- | -------- | --------------- | +| VCC | | VCC (3.3V) | +| GND | | GND | +| GPIO0 | PullUp | | +| GPIO15 | PullDown | | +| CH_PD | PullUp | | + +### Minimal +![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) + +### Improved Stability +![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) diff --git a/hardware/esp8266com/esp8266/doc/generic.md b/hardware/esp8266com/esp8266/doc/generic.md deleted file mode 100644 index 84435c98d4..0000000000 --- a/hardware/esp8266com/esp8266/doc/generic.md +++ /dev/null @@ -1,85 +0,0 @@ - -## Upload via serial port -Pick the correct serial port. -You need to put ESP8266 into bootloader mode before uploading code. - -## Power Supply - -For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. - -* Note - - Using the Power available from the USB to Serial adapter is not reccomended, these adapters typically do not supply enough current to run the ESP8266 reliably in every situation, an external supply or regulator is preferred. - -## Serial Adapter - -There are many different USB to Serial adapters / boards. - -* Note - - for full upload management you need RTS and DTR - - the chip need to have 3.3V TTL (5V may damage the chip) - - not all board have all pins of the ICs as breakout (check before order) - - CTS and DSR are not useful for upload (they are Inputs) - -* Working ICs - - FT232RL - - CP2102 - - may others (drop a comment) - -## Minimal Hardware Setup for Bootloading and Usage - -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | -------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2* | | RX | -| RX | | TX | -| GPIO0 | PullUp | DTR | -| Reset* | PullUp | RTS | -| GPIO15* | PullDown | | -| CH_PD | PullUp | | - -* Note - - GPIO15 is also named MTDO - - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module) - - GPIO2 is alternative TX for the boot loader mode - - **Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.** - -### ESP to Serial -![ESP to Serial](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_to_serial.png) - -## Minimal Hardware Setup for Bootloading only ## -ESPxx Hardware - -| PIN | Resistor | Serial Adapter | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| TX or GPIO2 | | RX | -| RX | | TX | -| GPIO0 | | GND | -| Reset | | RTS* | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -* Note - - if no RTS is used a manual power toggle is needed - -## Minimal Hardware Setup for Running only ## - -ESPxx Hardware - -| PIN | Resistor | Power supply | -| ------------- | -------- | --------------- | -| VCC | | VCC (3.3V) | -| GND | | GND | -| GPIO0 | PullUp | | -| GPIO15 | PullDown | | -| CH_PD | PullUp | | - -### Minimal -![ESP min](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_min.png) - -### Improved Stability -![ESP improved stability](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/ESP_improved_stability.png) From 40866de8da3c40b8d2f562e68236131f5989cac1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 22 Jul 2015 17:45:30 +0300 Subject: [PATCH 18/18] Fix errors in core reference, mention new libraries. --- hardware/esp8266com/esp8266/doc/reference.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hardware/esp8266com/esp8266/doc/reference.md b/hardware/esp8266com/esp8266/doc/reference.md index 5e3b344493..19f1cf1652 100644 --- a/hardware/esp8266com/esp8266/doc/reference.md +++ b/hardware/esp8266com/esp8266/doc/reference.md @@ -21,7 +21,7 @@ Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC). -To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V, and the reference voltage is derived from VCC, which is assumed to be 3.3V. +To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V. To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch: @@ -33,7 +33,7 @@ This line has to appear outside of any functions, for instance right after the ` ## Analog output -`analogWrite(pin, value)` enables software PWM on the given pin. PWM may be used on pins 0 to 15. +`analogWrite(pin, value)` enables software PWM on the given pin. PWM may be used on pins 0 to 16. Call `analogWrite(pin, 0)` to disable PWM on the pin. `value` may be in range from 0 to `PWMRANGE`, which is currently equal to 1023. Pin interrupts are supported through `attachInterrupt`, `detachInterrupt` functions. @@ -175,11 +175,15 @@ Library was adapted to work with ESP8266 by including register definitions into Note that if you already have OneWire library in your Arduino/libraries folder, it will be used instead of the one that comes with this package. -## mDNS responder (ESP8266mDNS library) +## mDNS and DNS-SD responder (ESP8266mDNS library) -Allows the sketch to respond to multicast DNS queries for domain names like "foo.local". +Allows the sketch to respond to multicast DNS queries for domain names like "foo.local", and DNS-SD (service dicovery) queries. Currently the library only works on STA interface, AP interface is not supported. -See attached example and library README file for details. +See attached example for details. + +## SSDP responder (ESP8266SSDP) + +SSDP is another service discovery protocol, supported on Windows out of the box. See attached example for reference. ## DNS server (DNSServer library)