This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
start-with-esp-12-arduino [2018/04/01 10:21] jpascher [Setup and start test program blink] |
start-with-esp-12-arduino [2018/08/26 17:47] (current) rudy More explanation, format changes, and corrected some minor misspellings etc |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Start with the ESP-12 and the Arduino tools ====== | + | ====== Starting with the ESP-12 and the Arduino tools ====== |
===== Hardware ===== | ===== Hardware ===== | ||
- | * {{::usb-to-esp8266-serial-wireless-wifi-module-developent-board-8266-wifi-module.jpg_640x640.jpg?100}}{{:verbindungen-8266.png?300|}}{{:12-01.jpg?100|}}{{:esp-8266-belegung.png?200|}} | + | {{::usb-to-esp8266-serial-wireless-wifi-module-developent-board-8266-wifi-module.jpg_640x640.jpg?100}}{{:verbindungen-8266.png?300|}}{{:12-01.jpg?100|}}{{:esp-8266-belegung.png?200|}} |
- | * [[esp8266-module-family#esp-12|ESP-12E module]] depending on module type additional wiring with resistors may vary. A few resistors have to be added to module 12E. On modules on next generation 12S or newer resistors may be on board or if the withe breakout board (http://thethingofinternets.com/?p=4) is used two resistors are on the board. | + | |
- | * 12E needs: | + | * A few resistors have to be added to the [[esp8266-module-family#esp-12|ESP-12E module]] for proper operation. |
- | * one 10k resistor from GPIO to GND, | + | * These resistors control the mode of operation at reset. With these resistors installed, the module will operate in normal mode after reset. The resistors can be overpowered to disable the module or reboot in a programming mode to upload new programming. |
- | * one 10k from EN (or labeled CH_PD) to VCC, | + | * If you are using a next generation 12S or newer module, resistors may already be on the module. |
- | * one 10k from GPIO0 to VCC, | + | * If you are using a chinese white breakout board, the resistors are already included. |
- | * one 10k from GPIO2 to VCC. | + | * The ESP-12E required resistors are: |
- | * 3.3V power supply or supply from adapter | + | * Pullup resistors connect to VCC (3.3V) and pulldown resistors connect to GND |
- | * USB-serial adapter (CH340G USB to ESP8266 Serial Wifi Module Development Board Adapter) this one has no switch for programming on board. USB zu (ESP8266 seriell Adapter ESP01 Programmierer ESP UART Arduino) also can be used is nearly the same sure others also will work, just make sure the have a lever changer on board. | + | * 10k pulldown resistor on the GPIO pin |
- | * If programming swish is missing one has to add the two jumpers or the switch. | + | * 10k pullup resistor on the EN pin (may be labeled CH_PD) |
- | * Wire up Reset and Programming switch | + | * 10k pullup resistor on the GPIO0 pin |
- | * RXD from adapter to TX on ESP12E and | + | * 10k pullup resistor on the GPIO2 pin |
- | * TXD from adapter to RX on ESP12E, | + | * ESP modules need either an external 3.3V power supply or a 3.3V regulator on the breakout board |
- | * GND to GND and | + | * If you are using a chinese white breakout board the PC board wiring is incorrect, so don't solder a regulator onto the board without first reading http://thethingofinternets.com/?p=4 for an important note. The simplest solution is to use an external regulated 3.3V supply with these boards. |
- | * VCC 3.3V to VCC 3.3V of ESP12E if supply from the adapter is in use or an external 3.3V supply. | + | * Additional Capacitors between VCC and GROUND should also be added for more stability. 1nF plus 1000uF aluminium electrolytic capacitor proved to be best. |
- | * Additional Capacitors should also be added for more stability. 1nF plus 1000uF aluminium electrolytic capacitor proved to be best. | + | * To program the module, you will need a USB-to-serial adapter |
- | * To use programming switch and reset switch from the adapter one also has to connect this two wires from adapter to the ESP12E. | + | * There are many USB to serial adapters - most adapters are identified by the name of the adapter chip |
- | | + | * The most common USB to Serial chips are the CH340G or various chips from FTDI |
+ | * Make sure your serial adapter supports 3.3V, or use a level shifter to allow 3.3V operation | ||
+ | * When programming, the GPIO0 pin has to be held low during reset to enable programming mode | ||
+ | * Some breakout boards include pushbuttons or jumpers | ||
+ | * For programing mode: While holding the FLASH button down, momentarily press "RESET", then release the FLASH button | ||
+ | * For normal mode: press RESET without also pressing FLASH | ||
+ | * Some USB to Serial adapters allow using two of the serial handshake signals to allow the programming software to reset the module and pulldown GPIO0 during reset so you don't need to use jumpers or push any buttons during programming. | ||
+ | * You can also manually wire your own jumpers and/or switches for reset and GPIO0 | ||
+ | * Summary | ||
+ | * Wire up Reset and GPIO0 Programming switch | ||
+ | * If you are using a programming switch and reset switch from the adapter, connect these from the adapter to the ESP12E. | ||
+ | * RXD from adapter to TX on ESP12E | ||
+ | * TXD from adapter to RX on ESP12E | ||
+ | * GND from adapter to GND on ESP12E | ||
+ | * VCC 3.3V from adapter to VCC 3.3V of ESP-12E (or the external 3.3V supply powering the ESP-12E module) | ||
===== Software ===== | ===== Software ===== | ||
Line 25: | Line 39: | ||
* [[https://github.com/esp8266/Arduino|Arduino esp8266 platform]] | * [[https://github.com/esp8266/Arduino|Arduino esp8266 platform]] | ||
- | ===== Setup and start test program blink ===== | + | ===== Setup and test using the "blink" example ===== |
- | * Connect Hardware as shown in description Hardware on top here. | + | * Connect Hardware as shown above |
- | * Plugin Adapter (without ESP connected) to USB and check in Windows with Hardware manager that the added COM port ist working. And verify the COM"XX" in use. You may use Putty to test the COM port with RXD and TXD connected toggelter. This will give you an echo on the Terminal all you type comes back to the display. | + | * Check serial adapter |
- | * Install Arduino form "https://www.arduino.cc/en/Main/Donate" | + | * Plugin Adapter (without ESP connected) to USB and check in Windows (with device manager) that you can see the new COM port |
- | * Open in Arduino "File" -> "Preferences" window and add in an additional Board Manager URL:http://arduino.esp8266.com/versions/2.4.1/package_esp8266com_index.json | + | * If the device is not recognized, you will need to install a driver for your USB-to-serial adapter |
- | * Type in "esp8266" and select the correct chip in the popup window. And select the latest version. | + | * You can use Putty to test the COM port with RXD and TXD connected together. This will give you an echo on the terminal: everything you type is immediately visible in the terminal. |
- | * Open in Arduino "Tools" -> Board:"xxxxxxx" Board manager window and find Board name: "NodeMCU 1.0 (ESP-12E Module)" | + | * Install the [[https://www.arduino.cc/en/Main/Donate|Arduino development tools]] |
- | * Open in Arduino "Tools" -> PORT:"xxx" the port your Adapter is on. | + | * Open the Arduino "File" -> "Preferences" window and add in an additional Board Manager URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json |
- | * Open in Arduino "File" -> "Examples" and find -> "Examples for NodeMCU 1.0 (ESP-12E Module)" -> and then "ESP8266" -> then"BlinkWithoutDelay" Example. | + | * If you need multiple entries in this list (for example if you have an entry for another platform), you can add multiple URLs by separating them with commas |
- | * Add the following Line on top of the Example: **#define LED_BUILTIN 2** (This is needed because the Example is written for a ESP-01 module and not for ESP-12. The blue LED is on internal PIN 2 not on PIN 1. There seams to be some confusion on Port numbering. On the board is written TXD0 for this pin. Alternativ one can install the latest Master version from Git as explained here: https://github.com/esp8266/Arduino) | + | * After you enter the URL, press OK to close the dialog and save the change |
- | * Turn on the program swish on the board or on the adapter. -> Push reset. | + | * Open Arduino "Tools" -> "Board:xxxxxxx" -> "Board Manager" |
- | * In Arduino push the upload (Blue error ->) and wait until 100% is reached. While uploading the blue LED on the board is flashing. | + | * Change the "Type" in the upper left to "Contributed" |
- | * Turn the program swish off on the board or on the adapter. | + | * Type "esp8266" in the filter box |
- | * Push reset on the Board or on the Adapter. Maybe a additional power of and on is also needed. | + | * Select "NodeMCU 1.0 (ESP-12E Module)" and press the "Install" button |
- | * Now the on board Led should be flashing fast. Unfortunately the blue Led is also flashing slower if something did go wrong. | + | * NOTE: you could alternatively install the latest Master version from Git as explained here: https://github.com/esp8266/Arduino |
- | * You also can watsch the output on the Terminal within Arduino got to Tools - serial Monitor change to 74880 Baud do a reset again. | + | * In "Tools" -> PORT:"xxx" select the correct COM port for your serial adapter |
- | * Output should be just one time and not repeated like this: | + | * Open "File" -> "Examples" -> "Examples for NodeMCU 1.0 (ESP-12E Module)" -> "ESP8266" -> "BlinkWithoutDelay" |
- | {{:terminal-log.png?100|}} If repeated output happens the board is rebooting, something wrong with the program or wiering. | + | * Add the following Line on top of the example:\\ **#define LED_BUILTIN 2** |
- | * Adapter can be removed now and programmed module can be used with external 3.3V supply. | + | * This is needed because the example is written for a ESP-01 module and not for ESP-12. The blue LED is on internal PIN 2 not on PIN 1. |
+ | * There seems to be some confusion on Port numbering. On the board this pin is labeled TXD0. | ||
+ | * Turn on the program switch on the board or on the adapter and push reset. | ||
+ | * In Arduino push the upload button (Blue arrow ->) and wait until 100% is reached. While uploading the blue LED on the board is flashing. | ||
+ | * Turn the program switch off and push reset - you might need to cycle the power off and on | ||
+ | * If everything worked correctly, the blue LED should be flashing fast - Congratulations! Unfortunately the blue Led is also flashing slower if something went wrong. | ||
+ | * You also can watch the serial output on the Terminal within Arduino: | ||
+ | * go to "Tools" -> "Serial Monitor" change to 74880 Baud do a reset again. | ||
+ | * Output message from the ESP-12E should appear just one time and not repeated like this:\\ {{:terminal-log.png?100|}} | ||
+ | * If repeated output happens the board is rebooting, and something is wrong with the program or wiring. | ||
+ | * Adapter can be removed now and programmed module can be used with an external 3.3V supply. |