After we managed to connect the ESP8266 WiFI module to Raspberry Pi, we can now try to change the module firmware to a custom one.
The firmware we will install on it is a simple webserver, that will handle HTTP requests. It will allow us to access a web interface for ESP8266. The interface will allow us to search for available WiFi networks, choose one and login. We will also have a page that will control the GPIO02 output (we can connect a led or something else to this pin). On the GPIO00 we can connect a button that will switch the GPIO02 state. Keeping the button pressed more than 3 seconds will restart the chip.
The firmware also contains a 3 simple API calls which will allow you to switch or get the GPIO02 state from many devices, not only from its own web interface.
First we need a tool that will upload the firmware to ESP8266. It is available here or in the firmware zip archive.
# Lets assume that we are in the /home/pi/ESP8266 folder
# Get the zip archive containing the firmware and esptool.py from ExtraGSM
# Unzip the archive
Connect the GPIO00 to GND, power up the module and run the following command:
# Upload firmware
# If you don't have python installed run: sudo apt-get install python
python esptool.py –port AMA0 write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin 0x12000 webpages.espfs
Now we need to connect to the ESP module using its own access point. Search for a wireless network named like ESPxxxx and connect.
For more detail : Use ESP8266 module as a wireless switcher using Raspberry pi