Saturday, March 21, 2015

Using ESP8266

Around 6 months back I stumbled on ESP8266 while searching for low cost WiFi module. Most of the other WiFi modules costs INR 2000-3000 and adding a WiFi to embedded projects seem to be very costly proposition. So when ESP8266 came in the price range of US$ 3-5, it looked like best of the best thing to happen. But when I looked that time, the documentation was very minimal and even the available ones were in Chinese so temporarily I put my interest on hold thinking let it mature.

As I watched, whole lot of people worked on it, multiple modules came out, so may sites came out hacking it. Even the Chinese supplier started publishing source code and I felt it is right time to play around with it. So I ordered couple of modules (ESP-01, ESP-03, ESP-12) from China. The cost is starting at RMB 13 (INR 130 approx, sellers in India selling it starting from INR 500).

Got the modules in a week time and it is time to play around these modules and I am sharing my experience below. In the below picture the the modules shown are ESP-01, ESP-12 and ESP-03.

It is easy to use ESP-01 as it has headers already soldered. So I used this first to test it out.
  1. As various sites pointed out, I am going to use a USB to Serial converter to connect it to a PC.
  2. I used CP210X based USB to serial converter, fortunately the one I have is giving 3.3V logic level at RX/TX so no issue in connecting it directly to ESP-01, yes some people tried connecting 5V level (say from Arduino) but I would like to stay within spec.
  3. Looks like ESP8266 current consumption is high in the range of 70 to 100mA so need have separate 3.3V source rather than using supply provided by CP210X module (per CP210x datasheet it's built in regulator can give a max of 100mA so do not want stress it). I had a small module which will take 5V input and give 3.3V output and I used the same
  4. Next is to measure the current consumed by whole setup. For this I used small device sold in Chinese sites which can measure Voltage, Current, Power & Charge
  5. The wiring diagram
  6. Below image shows how it all looks when connected together. As seen in the picture the modules current draw varies from 40 to 90mA.

  7. ESP-01 response in a serial terminal, I used Hercules utility, Baud can be anything, I first tried 115200 and it did not work so tried 9600 and it worked. So try different values. As we type in terminal it is sent to ESP-01 and command end is sensed by CR/LF so enable CR/LF and disable Local Echo.