Getting Started with ESP8266: Awesome Arduino Alternative
In this guide I'll show you how to get started with ESP8266 using Arduino IDE. An Arduino alternative for projects that require internet access.
What's ESP8266 ?
ESP8266 is 32-bit MCU with built-in 2.4 GHz Wi-Fi manufactured by Chinese company called Espressif Systems.
- Processor: L106 32-bit RISC microprocessor core based on the Tensilica Xtensa Diamond Standard 106Micro running at 80 MHz
- 32 KiB instruction RAM
- 32 KiB instruction cache RAM
- 80 KiB user-data RAM
- 16 KiB ETS system-data RAM
- External QSPI flash: up to 16 MiB is supported (512 KiB to 4 MiB typically included)
- IEEE 802.11 b/g/n Wi-Fi
- 16 GPIO pins
- I²C (software implementation)
- I²S interfaces with DMA (shariUART on dedicated pins, plus a transmit-only
- UART can be enabled on GPIO2ng pins with GPIO)
- 10-bit ADC (successive approximation ADC)
Since ESP8266 by itself is only a SoC, various breakout boards were developed by third-party manufacturers to facilitate experimentation and prototyping. Probably the most popular and widely used - NodeMCU
NodeMCU is an open source IoT platform. It includes firmware and hardware which is based on the ESP-12 module. The firmware by default uses Lua scripting language, but as I mentioned in the beginning, we're going to use Arduino IDE and C++ to program it.
Now since it is an open source platform, you can find a few versions of NodeMCU. Usually, the only difference is the USB interface. The original uses CP2102 USB to serial bridge and cheaper clones usually have CH340, but both boards work exactly the same.
For this tutorial I'll be using ESP8266 NodeMCU with CH340 USB to serial bridge and Windows machine as a host. You can get it here:
- NodeMcu V3 ESP8266 ~ 2.5$
Preparing the host machine
Now that we have our drivers installed, we can connect our ESP8266 with Micro USB cable to the PC. Make sure you're using USB data cable and not the simple USB power cable.
The USB connection with the PC is necessary to program the ESP8266 and not just to power it up.
Now you should see your ESP8266 on Device Manager:
If your ESP8266 is not detected, try different USB cable. Chances are that you're actually using the USB power cable. COM port might be different in your case. As you see mine is on COM9
Next, open your Arduino IDE and go to File > Preferences
Look for Additional Boards Manager URLs field and paste this in
Next go to Tools > Board: "Random board" > Board Manager...
Search for ESP8266.
And click Install.
Time to test the ESP8266
Now click on Tools again and select NodeMCU 1.0 (ESP-12E Module) as your board. Make sure the port is correct.
Go to File > Examples > ESP8266 and choose Blink example. Upload the code and your ESP8266's built-in LED should start blinking.
What's next ?
Make something great out of it!
On a more serious note, read the docs on https://arduino-esp8266.readthedocs.io/en/latest/ and start tinkering.
For now, thanks for reading !