ESP8266-EVB is small 57×50 mm board with Relay and Button which are connected to Internet via ESP8266 WIFI module.
ESP8266 has inside Xtensa106 processor and RF front end circuit, you do not need separate processor to drive the relay and read the button as ESP8266 can be programmed with custom code.
Here we will explain how to setup your tools and make your first project.
First you need to install your tools. It’s simple, just follow the instructions here: https://github.com/esp8266/esp8266-wiki/wiki/Toolchain
There are just few small mistakes as some commands will require SUDO before them and some paths are not exactly same, but you have to follow the steps and once you get error to read and correct the problem.
Here is what we do on Ubuntu 14.04 LTE 64-bit:
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 python-serial libexpat-dev sudo mkdir /opt/Espressif sudo chown $username /opt/Espressif/ sudo cd /opt/Espressif sudo git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git cd crosstool-NG ./bootstrap && ./configure --prefix=`pwd` && make && make install ./ct-ng xtensa-lx106-elf ./ct-ng build PATH=$PWD/builds/xtensa-lx106-elf/bin:$PATH
cd /opt/Espressif mkdir ESP8266_SDK wget -O esp_iot_sdk_v0.9.3_14_11_21.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21.zip wget -O esp_iot_sdk_v0.9.3_14_11_21_patch1.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21_patch1.zip unzip esp_iot_sdk_v0.9.3_14_11_21.zip unzip esp_iot_sdk_v0.9.3_14_11_21_patch1.zip mv esp_iot_sdk_v0.9.3 ESP8266_SDK mv License ESP8266_SDK/esp_iot_sdk_v0.9.3
cd /opt/Espressif/ESP8266_SDK/esp_iot_sdk_v0.9.3 sed -i -e 's/xt-ar/xtensa-lx106-elf-ar/' -e 's/xt-xcc/xtensa-lx106-elf-gcc/' -e 's/xt-objcopy/xtensa-lx106-elf-objcopy/' Makefile mv examples/IoT_Demo .
cd /opt/Espressif/ESP8266_SDK/esp_iot_sdk_v0.9.3 wget -O lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a wget -O include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz tar -xvzf include.tgz
cd /opt/Espressif wget -O esptool_0.0.2-1_i386.deb https://github.com/esp8266/esp8266-wiki/raw/master/deb/esptool_0.0.2-1_i386.deb dpkg -i esptool_0.0.2-1_i386.deb
cd /opt/Espressif git clone https://github.com/themadinventor/esptool esptool-py ln -s $PWD/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/
For less experienced users, we are preparing VirtualBox disk image which to run on Virtual machine on any OS like Linux, MAC OS, Windows, and everything inside is pre-configured and ready to use, hopefully we will upload this image on ESP8266-EVB web page tomorrow as we didn’t manage to complete it today.
Once you have setup the Tools you can download our examples from GitHub:
cd /opt/Espressif git clone https://github.com/OLIMEX/ESP8266.git cd ESP8266-EVB-blinkLED make
the project will be compiled and you will see something like this:
AR build/app_app.a LD build/app.out FW firmware/0x00000.bin FW firmware/0x40000.bin
congratulations you made your first code!
now we hae to load it to ESP8266-EVB
- blue wire to pin#2
- green wire to pin#3
- red wire to pin#4
plug the USB cable to your computer USB connector and check which serial port it connects by typing:
your computer should display something like:
Bus 004 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
if you type:
you will see:
.... /dev/ttyUSB0 ....
If the USB device is with different name you have to update it in the makefile.
After the code is compiled with no errors you can write it to ESP8266 by following these steps:
- first you have to press button and hold it and to apply power 5V, ESP8266 will enter bootloader mode
- type ‘sudo make flash’ and wait until code is loaded:
sudo make flash /opt/Espressif/esptool-py/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin Connecting... Erasing flash... Writing at 0x00007300... (100 %) Erasing flash... Writing at 0x00061200... (100 %)
now Green LED must start blinking!
So far so good, you just made blinking LED on ESP8266, now let’s make something more complicated – to run Embedded web server on ESP8266, go to esphttpd project directory:
cd /opt/Espressif/ESP8266/esphttpd make
then upload the code
sudo make flash
then upload web pages with:
sudo make htmlflash
Now ESP8266 firmware is uploaded and ESP8266 create Embedded server.
Scan for WIFI which name starts with ESP_XXXXXXX where XXXXXX is the ESP8266 MAC address and connect to this network then open browser at http://192.168.4.1 you will see this home page:
if you click on Relay button in the right side you will see new page:
On this page you can switch the on-board relay by clicking on ON and OFF button
If you click on the Button button in the right side you will see new page:
If you click on Start scan the web page will start to refresh each second and display the button status if you click on Stop scan the page will not refresh.
This is very basic demo code which can be used as template for your own projects!