I am making this instructable after my long 2-day struggle with ESP866. Since the day it arrived , to this day , I have surfed through nearly 50+ websites , blogs, instructables , data-sheets . In middle of all this I decided to make my own INSTRUCTABLE for other people who would like to be a part of this wonderful family .
(Yes I used the word family, IOT is a family )
CRUX of this instructable:
1. About ESP8266 .
2. How to start ESP8266 ?
3. Flashing and Programming ESP8266 .
4. Basic Blink Example controlled via Mobile .
Note to the readers : I added this instructable in various Contest , so if you like what you read please VOTE .
Winning a contest will help for further development and experimenting .
If you have read this far :READ MY COMPLETE INSTRUCTABLE AND I ASSURE YOU , IT WILL MAKE YOUR LIFE EASIER .
Questions and Queries are welcome , feel free to drop a message ( with some love , hehe )
Let us start -
The BEST PART is it is very cheap starting from $3 .
It can act like AP(Access Point) or connect to AP or Both .
It can be used in Home Automation devices .
It can very well receive commands via the internet or local host.
It can act like an ARDUINO .
The ESP8266 is also faster and stores more than the Arduino , the only con is with the ESP-01 since it has only 2 GPIO pins ( General Purpose Input Output ) , for which you can use ESP-12.
Working of ESP8266 :
*************************************************************************************
WARNING : WORKS ONLY WITH 3.3V AND NOT 5V . ESP8266 WILL PROBABLY FRY AT 5V .
ENSURE TX ,RX , Vcc ARE AT 3.3V BEFORE CONNECTION .
*************************************************************************************
The basic question is what all is needed to use this great tool . I will also lay out all the alternatives I have read so far which are used to program ESP-01 (ESP8266) .
or 5 volt to 3.3 volt DC-to-DC converter
for standalone ESP projects or AMS1117 or LM1117 converters(LD33 ) .
NOTE : Basic thing to understand is that the ESP can be powered with Arduino or the CP2102 adapter while programming , but for standalone projects we need a solid power supply at 3.3 Volt and 500mA .
*************************************************************************************
WARNING : WORKS ONLY WITH 3.3V AND NOT 5V . ESP8266 WILL PROBABLY FRY AT 5V .
I don't take responsibility for it.
*************************************************************************************
Basically it needs only 3.3V and Maximum of 800mA at peak and Minimum 250mA to operate .
I have attached a PDF from the ESP8266 Community Wiki that is a datasheet of ESP8266 .
I will be using this Freeduino ( Similar to Arduino ) to program the ESP-01 , since I don't want to remove the IC from my new UNO .
Setting up the Environment .
Software Arduino Environment v 1.6.4 or greater
Installing with Boards Manager Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager.
It have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
Install Arduino 1.6.4 (or greater) from the Arduino website ( I have 1.6.11) . Start Arduino and open Preferences window.
Enter http://arduino.esp8266.com/package_esp8266com_ind... 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).
Procedure:
Start Arduino 1.6.4 or Higher
Select ‘Tools’- ‘Port’ whatever # your USB-serial is on
Select ‘Tools’ -‘Board’ ‘Generic ESP8266 Module’
Select ‘Tools’- ‘CPU Frequency’ ‘80MHz’ or Overclock afterwards at '160Mhz'
Select ‘Tools’ -‘Flash Size’ ‘512K (64K SPIFFS)
Select ‘Tools’ -‘Upload Speed’ ‘115200’ for ESP 12E , also Some ESPs may be 9600
CONNECTIONS
The Connections are ( For ARDUINO ) :-
Firstly Remove the Atmega Chip from the Arduino
Important part here is the ESP uses more current than the Arduino , thus at risk .
Therefore I use and external DC 12 V , 1 A beside the PC connection .
For other connections refer the Images .
Before flashing lets check the connections
The ESP modules usually come with a built in AT Firmware by the Ai-Thinker .
So refer to this Image for commands .
Open up the Arduino , Go to the Serial Monitor ( Do select your COM port ) and Write :
AT
// This should return OK , else it's not working
Possible Errors :
If none of these work Pray to God .
Some Commands :
AT+GMR = to check firmware version
AT+RST = Soft reset
AT+CWLAP = Find Nearby Wi-Fi
AT+CWJAP = Connect to a specified AP
NOTE : If you are trying to connect to any wifi using AT+CWJAP and it returns ERROR or just sits there
Follow these commands :
AT+RST
AT+CWJAP=" "," " // ( This should return Error or OK, it's fine )
AT+CWJAP? // No AP or Error , Still Fine
AT+CWJAP = "Your SSID","Your Password" // THESE ARE CASE SENSITIVE
ALTERNATE TO AT command from ARDUINO :
There is this Java Software : ESPlorer , a wonder to use .
I have uploaded this also in the ZIP file .
Now the main step ,
The ESP can be programmed by various methods .
There are many Firmwares for it like the NodeMCU , ESPBasic , Arduino , etc
The NodeMcu runs on the LUA script ( Out of my expertise as of now )
But Arduino still runs on C++ ( In my expertise )
So we will Flash a firmware which will make the ESP to take the Arduino Script (Cpp script ) and run it .
Softwares available :
In my Quest ( To flash ESP 12E ) , I learnt and tried mostly all of them .
I made a zip file for all the different tools I have used .
Now to the main part ( Using the ESP8266 Flasher )
It will start to Erase and Write firmware ( 0 to 99% )
And will end at saying Unable to leave Flash mode , Don't worry it's perfectly fine.
THE BIN FILE is in THE ZIP ( v0.9.2.2 AT Firmware.bin ) Use this .
Possible Errors :
If nothing works , restart your ESP and Take the RST ( Reset ) to Gnd and remove
Let the blue Led flash once and try again from the start
These instructions are available everywhere but the most important part here is to put the ESP module in Bootloader mode before uploading .
Firstly select The correct Board - Generic ESP8266 module
Then the COM port
Open any program in Arduino , let us say Blink .
Change pin 13 to 2 , and use a LED and Upload
Now before hitting Upload , take Gpio0 to ground
And RST to ground afterwards , Remove RST after half a second ( The blue led flashes for some millisecond )
Take GPIO0 back ( To high or Float )
Hit Upload , the blue flashes once and then blinks till it gets uploaded .
Now you are all done . Remember before uploading put ESP in Boot Mode .
Thanks for reading and If you have any queries just comment below , Very Happy to Help .
P.S : If you are looking for serious home automation , Try using NodeMCU or ESP-12E or 12F .
Since they have More GPIO pins .
If I helped you in any way , do hit on that little heart , means a lot to me .