Thursday, 10 December 2015

Espressif ESP-8266: minimal configuration for running the ESP-12e module

I am working on a project where I haven't quite decided on some of the details, so I wanted a module that breaks out a lot of the ESP8266's pins, just to have as many options available as possible.

Here is also a 5 minute video about it.

The ESP-12e module seems like a good choice, with the added benefit of having 4MBytes of flash memory.
ESP-12e module from Banggod
So I ordered a pack of three from Bangood for just under 8 Euros. After quite a long wait they arrived and I had to take them to the workbench for a quick test drive, right away.

Odd stuff

A few things are a bit odd about these modules:
  • The silkscreen is a very poor print quality
  • The ADC pin is labelled ADG
  • The GPIO labels are a mess. Eg: There is no GPIO0 (this is labelled GPIO6 instead)

Where's GPOI0?
Todo: try flashing LEDs on all GPIOs to compare against NodeMCUs IO table


Basic configuration

So after a little experimentation, this turned out the most basic configuration:
Basic config for ESP-12e
I plan to run this without a circuit board, so I'll simply shorten GPOI15 to ground and connect the "Chip Power Down" Pin (CH_PD) to 3.3V. 

The Module came preinstalled with some AT-firmware, I didn't much care about.

Flashing new firmware

To program new firmware, GPOI0 (which for some reason is GPIO6 here) needs to be connected to ground. I am a huge fan of NodeMCU, so I flashed that to the module.
Ground GPIO6 (=GPIO0) to flash firmware via UART

This goes without saying

Connecting the serial-usb converter is unspectacular. Just the usual RXD-TXD / TXD-RXD thing. And don't forget to connect the ground wires.
Connecting the USB2Serial converter



23 comments:

  1. I'm a recent convert to LUA on nodemcu, it's just so quick and easy to iterate code. I do hope the Dev. team keep going though as things seem to have slowed. In particular I'm being forced over to the Arduino IDE to make use of mDNS-SD facilities that are missing in nodemcu.

    After all, having an embeded webserver isn't much use if you have to go hunting for it with more than just a web browser!

    ReplyDelete
    Replies
    1. NodeMCU's IP is based on LWIP. There are a few mDNS responder implementations based on that, so it should not be too hard.

      Delete
    2. Hi Andreas, thanks for your reply but 'too hard' is exactly what it looked like when wading through RFC 6762/3. Do you have any pointers to an easier to understand outline of what might be involved? Just understanding how nodemcu/lua is put together is a challenge for me.

      Delete
    3. With NodeMCU things are a bit different from the Arduino IDE. mDNS can IMHO not be implemented in LUA at the user interface. It would have to be added to NodeMCU's source code. And you need a build environment for that. This tool is a great help: https://github.com/pfalcon/esp-open-sdk
      I used that to build my custom NodeMCU firmware, but never took it as far as adding totally new functions at that level.
      As said, the TCP/IP is done by LWIP and someone has already made a mDNS responder for LWIP here:
      https://developer.mbed.org/users/dirkx/code/Bonjour/file/d9f5c4abc5f8/services/mDNS/mDNSResponder.h
      But getting that to work together is beyond my feeble powers.
      I'm sure you could make a lot of people happy if you succeed.

      Delete
    4. Hi Adrian,
      that looks just what you've been looking for:
      http://desperate-programmers.com/2016/01/24/name-resolving-demo-mdns-reponder/

      Delete
    5. Great find Andreas! Thanks for the tip. I got the demo running - although the DNS look-up fails for me when using a browser on an Android device, which is disappointing. The article on building custom NodeMCU firmware looks super-useful too.

      Delete
    6. Things have anything but slowed down actually. mDNS is in the works, see https://github.com/nodemcu/nodemcu-firmware/pull/988.

      Delete
  2. Hi,
    This looks very interesting but being new to wifi I have several questions.
    A. Does the chip on the board have enough spare capacity to handle extra functions?
    Col

    ReplyDelete
    Replies
    1. It depends on your requirements, of course. But if you compare it to an arduino, it is *WAY* more powerful. The ESP-12E module also has a 4MByte flash module. For a microcontroller dev-board, that is plenty.

      Delete
  3. Hello Sir,

    I hope you are able to help me. I have an ESP8266-12E just like yours. With your setup I am able to get a response: "waiting for host". I have found the baud rate is set at 74880.

    I am using the Arduino IDE and I have been successful at programing the 01 modules. I am trying to program this -12E module however, I can not choose the 74880 rate. I can communicate at 57600 or 115200, do you have any advice for me as to how I might change my baud rate?

    Any help would be appreciated.

    Thank you; Joseph

    ReplyDelete
    Replies
    1. Sure you have GPIO15 conected to ground? Sounds like you're in the wrong boot mode. To be on the safe side, leave the other GPIOs unconnected. Specifically GPIO2 and GPIO0 (labelled GPIO6 on my boards) should either be left floating or pulled up.
      To flash from Arduino IDE, GPIO0 needs to be pulled down, of course.

      Delete
  4. Thank you for your assistance.

    I checked my gpio15 to ensure it is grounded, and it is. I jumped gpio0 to ground and it lost the waiting for host message. But when I jumped it to power I was able to communicate at 115200.

    Now I am excited, because I no longer have a fake chip but one I can actually use. I can now use the AT command set and it works. Yippy. I would have never thought to jump gpio15 to ground. Thank you so much for your help.

    With much appreciation; Joseph

    ReplyDelete
  5. Where did you get the background screen with the tabs, it looks very use full.

    ReplyDelete
    Replies
    1. That is esplorer. A great tool for Lua script development, but also great for playing with the AT commands.
      Available at http://esp8266.ru/esplorer/

      Delete
  6. Hi Andreas.

    In the video you use a "tool" on the PC to send data to the unit. What tool is that and where can it be downloaded from.

    Regards
    Chris

    ReplyDelete
    Replies
    1. Yes, that's https://github.com/nodemcu/nodemcu-flasher

      Delete
  7. Hello,
    I am using ESP12E chip. I am powering it using Teensy ++ 2.0 which is powered using a USB cable via computer. I am using OESPP FTDI serial adapter to flash the module. I have connected the Tx, Rx and GND to Rx, Tx and GND respectively. When i open the COM port and click reset i was able to see the output from the Wi-Fi module on the screen.

    My module came preflashed with NodeMCU. It said Node MCu version 5.1.4 and then init.lua not found. There is a > and i am not able to type anything on the screen. When i click reset, i get the same message. I am still unable to type anything on screen.

    My serial adapter is in 3.3V configuration. I tried 5V configuration too. It's still the same. I am using arduino to upload the program. I get this error everytime.


    esptool v0.4.4 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
    setting board to ck
    setting baudrate from 115200 to 115200
    setting port from COM1 to COM2
    setting address from 0x00000000 to 0x00000000
    espcomm_upload_file
    stat C:\Users\pablo_000\Desktop\Arduino/Wifi_temp_post.cpp_00000.bin success
    setting serial port timeouts to 1000 ms
    opening bootloader
    resetting board
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    resetting board
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    resetting board
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    trying to connect
    flush start
    setting serial port timeouts to 1 ms
    setting serial port timeouts to 1000 ms
    flush complete
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    read 0, requested 1
    warning: espcomm_sync failed
    error: espcomm_open failed

    ReplyDelete
    Replies
    1. Have you tried ESPLORER as a terminal/IDE software?
      http://esp8266.ru/esplorer/

      Delete
  8. Thanks man, you made my experience with this module really smooth

    ReplyDelete
  9. Hello, sir.

    Nice post!

    I'm new to ESP's modules, so I want - first - to use one ESP-12-E as WiFi module to Arduino. I've searched a lot of information, but I did not find the proper wiring to maintain serial communication between arduino and ESP. Some wiring examples shows different GPIO's configurations. I've tried all of them, but I'm still unable to send or receive information between Arduino and ESP. With this configuration you showed, the ESP LED blinks strong once, when powered UP. With another configuration the LED blinks very faded once.

    So, what might be going wrong? I'm using a logic level converter between Arduino and ESP TX/RX. All wires are placed correctly. I'm using sketches that other people tested...

    Is There a debug of the led behaviour on boot, or may I condemn my ESP module?

    Thank you!

    Best regards,
    Tiago.

    ReplyDelete
    Replies
    1. The first question is: Which firmware does your ESP8266 run?
      To communicate with an Arduino, you want the module to behave similar to a traditional modem. That is what the "AT-Firmware" does. (As opposed to NodeMCU, where the ESP8266 is in charge of both the WiFi and running programs/scripts)
      I have an AT-Firmware/Arduino example here:
      http://www.areresearch.net/2015/09/arduino-and-esp8266-part-2-web.html

      Delete
  10. Hi Andreas,
    Which serial-usb converter are you using?

    Thank you.

    ReplyDelete
    Replies
    1. I always use this one:
      http://www.banggood.com/Wholesale-USB-To-TTL-COM-Converter-Module-buildin-In-CP2102-New-p-27989.html?p=NT1005763073201409DA
      It works without any problems both with Windows10 and Linux (Ubuntu). The cool thing is that is outputs 3V levels but is 5V tolerant. So you can use it with both ESP8266 / ESP32 and Arduinos.

      Delete