Welcome to weblogs.com.pk Sign in | Join | Help

Arduino core for ESP8266 WiFi chip

Blink Series

ESP8266 Series

esp8266-examplesStarting with 1.6.4, Arduino (IDE) allows using libraries and installation of third-party platform packages using Boards Manager. https://github.com/esp8266/Arduino is a package that we can install and it enables support for ESP8266 chip in Arduino environment; we can write sketches using the familiar Arduino functions and libraries and run them directly on ESP8266. The Package comes with libraries to communicate over Wifi using TCP and UDP, setup HTTP, mDNS, SSDP and DNS servers, do Over The Air (OTA) updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals. The GitHub page has the installation instructions and it comes with Examples and we can have the Blink firmware running on NodeMCU in no time.

  • https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls has list of boards that Arduino IDE supports using such third party Board Extensions
  • NodeMCU and Arduino development environments for ESP8266 are popular among makers and developers; there exists few other options as well; Espressif; the vendor who designed this chip offers two SDKs; one of which is FreeRTOS based, there’s MicroPython, ESP8266 Basic and Zbasic for ESP8266 as well.
    Multicast DNS (mDNS) and Simple Service Discovery Protocol (SSDP) are protocols to discover ESP8266 on the network; in this post we will be using mDNS
  • Serial Peripheral Interface (SPI) bus and Inter-Integrated Circuit (I2C) are low level communication protocols used when two circuits / MCUs / ICs are connected
  • Visit https://github.com/esp8266/Arduino/tree/master/doc/ota_updates for how we can do OTA updates; its an advanced level topic; but is very useful when building an IoT solution for devices that will get deployed in far away places

Here’s the pin layout of NodeMCU; source: http://www.slideshare.net/roadster43/esp8266-nodemcu


Now if we connect the LED to GPIO0; and we want a firmware that ESP connects to a specified Wifi and have a web interface through which we can turn the led on or off; the Arduino sketch for such a firmware using libraries from Arduino core for ESP8266 WiFi chip; would be something like this

  • esp8266-blinkI am using the Serial for “debug” logs; once the firmware is uploaded; we can open up the Serial Monitor to view what’s being written on the serial port by the device from within the Arduino IDE
  • I have setup mDNS; on Windows using Bonjour Service; we can resolve .local names and can access our nodemcu device using a friendlier DNS name that the device is publishing itself with
  • I also used the LED during the setup how it flashes while connecting to Wifi; its always useful to give user a visual clues what’s happening
  • The web interface is minimal for turning the led on or off; but we get the idea that we can achieve the same using ESP8266 Arduino Core what we could do using Lua in NodeMCU firmware; and on top of this; we can use many Arduino libraries that are out there in our ESP8266 firmware


Published Saturday, January 28, 2017 2:08 PM by khurram
Filed under: , ,


No Comments

New Comments to this post are disabled