ESP8266 programming tools

The ESP8266 is the answer to “I want something with Wifi.” It’s basically the answer to everything IoT to so many engineering problems that have plagued the hobbyist and commercial world alike. The chip is a processor  (80MHz Tensilica) with integrated RAM, some ROM, and a WiFi radio. It’s CHEAP, like $4/ea cheap! Or $5 if you want to get ESP8266 in a module type carrier board. The power consumption is reasonable (~200-250mA @ 3.3V).

By default when you buy these neat little boards, many of them come with the “AT” firmware, which is useful if you want to connect it to for example to Arduino board. You can simply connect any microcontroller to this module and start pushing data up to the Internet. This might be why it seems that ESP8266 has pretty soon become every hacker’s favorite WiFi chip.

Because ESP8266 has a programmable processor in it, it would be a good idea to look at the ways to program your IoT application to run in it. Programming of ESP8266 was first had because of lack of documentation and toolsets. Now there is a selection of tools available.

An SDK for the ESP8266 WiFi Chip turns the ESP8266 Internet of Things thing with just $5 in hardware. You can write the software using C programming language and GCC compiler. How to Directly Program an Inexpensive ESP8266 WiFi Module article tells how you can get started in programming ESP8266 using C language SDK. Programming the ESP8266 is a lot like programming an Arduino. How to Directly Program an Inexpensive ESP8266 WiFi Module article has several examples that show how easily you can communicate to Internet and control GPIO pins. There are a few options for building the toolchain on Linux and OSX, plus some options in Windows.

Another approach to programming ESP8266 is what is offered by NodeLua and NodeMcu: Lua scripting. NodeLua is the FIRST open source lua based firmware runs on ESP8266 that offers nodejs-like APIs. NodeMcu is an open-source firmware and development kit that helps you to prototype your IOT product within a few Lua script lines. There are examples how you can make NodeMcu to communicate using MQTT and connect to ThingSpeak.

Now there is third option that should interest those familiar with Arduino: After many months of coding, the Arduino IDE supports the ESP8266 module. Arduino IDE Support for the ESP8266 arduino introduces esp8266/Arduino project that brings support for ESP8266 chip to the Arduino environment.

Setup is promised to be fairly simple with downloads for Linux, OS X, and Windows. The basic IO functions of the Arduino IDE are available: pinMode, digitalRead, digitalWrite, and analogRead. Most of the WiFi functions work just like the WiFi shield library. This is a huge deal for ubiquitous IoT development. The one thing that was seriously missing from the Arduino toolbox was an ultra-cheap, easy way of building a simple Wi-Fi connected object…and here it is.

All those alternatives look interesting.

23 Comments

  1. Ralph Doncaster (Nerd Ralph) says:

    I agree the Arduino/Wiring core port to the ESP8266 should be a boost for it’s use. There’s another build of Ivan’s core that can be added to an existing Arduino 1.6 install; arduinesp.com. The v.20 setup seems to be corrupt, though .12 works. I expect it should be fixed soon.

    As for cost, I picked up my esp-01 off Aliexpress for 246c. Add a 75c PL2303HX USB-TTL module and you’re off to the races.

    Reply
  2. Ralph Doncaster (Nerd Ralph) says:

    p.s. for the more serious embedded developer, the CHERTS sdk package looks interesting.
    https://github.com/CHERTS/esp8266-devkit

    Reply
  3. Tomi Engdahl says:

    Arduino IDE for ESP8266 Quickstart Guide
    http://hackaday.io/project/5150-arduino-ide-for-esp8266-quickstart-guide

    Thanks to the hardwork by Richard Sloan and Ivan Grokhotkov, we can now use Arduino IDE to write sketches that would run ON the ESP8266.

    Reply
  4. Tomi Engdahl says:

    ESP8266 Arduino IDE HowTo
    https://www.youtube.com/watch?v=-aZU8YqHlHw

    This explains how to upload your first sketch to the ESP8266 using the Arduino IDE. Thanks to CalumK at calumk.com who’s video helped me figure out the right settings in the IDE. Thanks to taylorcoffelt.com who’s image helped me see how to make the right connections. Thanks to the 107 contributors on github that made this ide so the everyday tinkerer could play with the ESP8266 too!

    Reply
  5. Tomi Engdahl says:

    It’s Time to Develop Applications for Cheap ESP8266 μC using Arduino IDE
    http://www.dzone.com/articles/its-time-develop-applications

    It is comprised of

    32bit 80MHz processor (Tensilica Xtensa LX3)
    512KB SPI Flash (W25Q40BVNIG)
    RAM (64KB sram; 96KB dram)
    GPIO Pins
    WiFi tranceiver

    At the moment we have 3 ways to program this module.

    Expressif GCC Based Toolchain (Documentation)
    NodeMCU Firmware (Supports Lua Scripting)
    Customized Arduino IDE for ESP8266

    Reply
  6. Tomi Engdahl says:

    ESP8266: This $5 Microcontroller with Wi-Fi is now Arduino-Compatible
    http://makezine.com/2015/04/01/esp8266-5-microcontroller-wi-fi-now-arduino-compatible/

    The ESP8266 is a UART to WiFi SoC built around a Tensilica Xtensa LX3 processor — shipping on a somewhat bewildering variety of breakout boards — the most commonly available being the ESP-01 which has a tiny form factor and can cost less than $5, although it’s more typically priced around $7 for low volumes.

    The boards, and the underlying ESP8266 SoC, was initially marketed as a Serial-to-WiFi adaptor, and comes with a firmware supporting a simple AT command set to configure and control the wireless module.

    What most people initially missed was that the SoC was fully programmable, this was a general use micro-controller, with Wi-Fi and — albeit somewhat limited — GPIO, all for $5 or less.

    things quickly progressed from a functioning GCC through to an SDK, and on to other languages like Micro Python, and a Lua-based firmware that gave access to both GPIO and scripting support.

    Richard Sloan and Ivan Grokhotkov released a version of the Arduino IDE that supported the ESP8266 — and just in time for Arduino Day.

    What’s Supported by the Build?

    The short answer is quite a lot — basic functions like pinMode, digitalRead and digitalWrite work as you’d expect. As do interrupts, and the millis and micros functions, and sensible things done to delay to take account of the background activity of WiFi and TCP tasks, and there is a Ticker library for calling functions with a certain cadence.

    The Serial object also works as you’d expect it to, and the environment ships with a custom libraries to handle WiFi that looks and acts mostly the same way as the official WiFi shield library.

    While the ESP8266 can’t do everything you could do with an Arduino — for instance it only has one PWM pin that isn’t even exposed by the ESP-01 breakout board

    The ESP8266 was already well on its way to becoming — almost by stealth — one of the leading platforms for the Internet of Things. It’s super cheap, and super easy to work with, and it’s actually fairly easy — as such things go — to get your hands on, which makes a refreshing change.

    However the arrival of Arduino compatibility is step change, suddenly the growing but still small community has opened their platform up to a much larger community. Suddenly there is a huge pool of people that know how to work with the board, and I think we’re going to see an explosion of projects and products that otherwise wouldn’t get made

    Reply
  7. Tomi Engdahl says:

    ESP8266 Arduino IDE HowTo
    https://www.youtube.com/watch?v=-aZU8YqHlHw

    This explains how to upload your first sketch to the ESP8266 using the Arduino IDE. Thanks

    Thanks to the 107 contributors on github that made this ide so the everyday tinkerer could play with the ESP8266 too!

    Reply
  8. Tomi Engdahl says:

    ESPlorer – Integrated Development Environment (IDE) for ESP8266 developers.
    http://esp8266.ru/esplorer/

    The essential multiplatforms tools for any ESP8266 developer from luatool author’s, including a LUA for NodeMCU and MicroPython. Also, all AT commands are supported.

    Getting Started With The ESPlorer IDE Written by Rui Santos (download for free)
    http://esp8266.ru/download/esp8266-doc/Getting%20Started%20with%20the%20ESPlorer%20IDE%20-%20Rui%20Santos.pdf

    Reply
  9. Tomi Engdahl says:

    Tool for loading Lua-based scripts from file to ESP8266 with nodemcu firmware
    https://github.com/4refr0nt/luatool

    nodemcu/nodemcu-flasher
    https://github.com/nodemcu/nodemcu-flasher

    Reply
  10. Tomi Engdahl says:

    ESP8266 Lua Loader

    LuaLoader is a Windows program for uploading files to the ESP8266 and working with the Lua serial interface. It is compatible with all versions of Windows from Windows 95 to Windows 10.

    http://benlo.com/esp8266/

    Reply
  11. Tomi Engdahl says:

    Basically, It’s an ESP8266
    http://hackaday.com/2015/08/29/basically-its-an-esp8266/

    Before the Arduino, there was the Parallax Basic Stamp. It was an easy-to-use PIC chip on a PCB that you programmed in BASIC

    The ESP8266 is more than a just a WiFi peripheral for a microcontroller. It is its own little computer in its own right. While it is common to run the “AT” firmware, Lua, or program the device yourself, you can now load the beast with a version of BASIC.

    Of course, just running BASIC wouldn’t be very interesting by itself. The real kicker is the extra keywords that allow control of the device’s WiFi hardware, I/O pins, and a dynamic Web page interface. You could very easily and very quickly set up prototypes using the simplified BASIC language and its extensions.

    ESP8266 BASIC
    http://www.esp8266basic.com/

    Reply
  12. Tomi Engdahl says:

    ESP8266 can be programmed using Basic:

    ESP8266 BASIC WiFi Thermostat is Child’s Play
    http://hackaday.com/2015/11/28/basic-on-the-esp8266/

    When the ESP8266 first came out, there very little documentation, much less code support. Since then Espressif’s SDK has improved, the NodeMCU project brought Lua support, and there’s even Arduino support. Most recently, BASIC has been added to the ESP stable, and that really lowers the barriers to creating a simple WiFi widget, like the thermostat example here that uses a Dallas DS18B20 temperature sensor and an LED as a stand-in for the heater element.

    The hardware for this project, a re-build of this demo code from the ESP8266 BASIC docs, is nothing more than a few off-the-shelf parts soldered together. No schematic required.

    BASIC is NOT dead!!
    http://www.picbasic.co.uk/forum/showthread.php?t=20908&p=135556#post135556

    ​DS18B20 Wifi Thermostat
    http://www.esp8266basic.com/ds18b20-wifi-thermostat.html

    Basically, It’s an ESP8266
    http://hackaday.com/2015/08/29/basically-its-an-esp8266/

    Reply
  13. Tomi Engdahl says:

    Squash Your ESP-8266 Bugs with ESP-gdbstub
    http://hackaday.com/2015/12/12/squash-your-esp-8266-bugs-with-esp-gdbstub/

    We hope we’re not insulting you by suggesting this, but it’s possible that even the best among us may be faced with bugs in our embedded code from time to time. And while we’re great fans of printf debugging over the serial port, and its high-speed equivalent — flipping a GPIO pin — there’s a time when your bug is so deep that having a real debugger is the best way to dig it out.

    [slaff] has been doing some great work documenting C/C++ programming on the ESP-8266, mostly using Eclipse and some of the Arduino libraries.

    In the fourth part of his series of posts, he walks through using a couple debugger options for the ESP. What makes this all work is the ESP-gdbstub code from Espressif themselves.

    Now, this still may not help with timing-related bugs. ESP-gdbstub uses the serial port, after all. But having the ability to set breakpoints and interactively inspect what’s going on in the chip’s memory is priceless, and doing so with no extra hardware connections is brilliant.

    Live debugging with open-source tools (Programming for ESP8266: Part 4)
    https://blog.attachix.com/live-debugging-with-open-source-tools-programming-for-esp8266-part-4/

    espressif/esp-gdbstub
    https://github.com/espressif/esp-gdbstub

    too funny just on http://www.esp8266.com/viewtopic.php?t=1960 and reading about this…. lots of info on there also with people using it, going to give it a try

    Heads up! http://www.esp8266.com/viewtopic.php?t=1871 this also show you the pinouts for the JTAG connections

    The hardware debug from OpenOCD is good news. It uses up a lot of I/O, but it is the last resort when the software approach won’t help you.

    Reply
  14. Tomi Engdahl says:

    Basic Interpreter from scratch by MMISCOOL
    https://github.com/esp8266/Basic/

    Reply
  15. Tomi Engdahl says:

    Micropython Binaries for the ESP8266 to be Released
    http://hackaday.com/2016/07/11/micropython-binaries-for-the-esp8266-to-be-released/

    MicroPython is a Kickstarted project that brings Python to small, embeddable devices. As part of the terms of the Kickstarter, supporters were to get exclusive access to binary builds, with a few exceptions. Now it looks like the ESP8266-version is going to be added to the binary list. This is awesome news for anyone who enjoys playing around with the popular WiFi chip.

    https://www.kickstarter.com/projects/214379695/micropython-on-the-esp8266-beautifully-easy-iot/posts/1626478

    Reply
  16. Tomi Engdahl says:

    ESP8266 MicroPython Contest Gives You the Excuse You Need
    http://hackaday.com/2016/07/29/esp8266-micropython-contest-gives-you-the-excuse-you-need/

    As if the prospect of having everyone’s favorite scripting language ported over weren’t enough to get you to install MicroPython on a spare ESP8266, there is now a contest for that. Over on Hackaday.io the MicroPython on ESP8266 contest is under way and you’ve only got until the end of August to submit your creation.

    The rules are simple: use an ESP8266 or ESP8285 with MicroPython and post the project up on Hackaday.io. Bonus points are given for creating new libraries or hardware drivers. Basically, this just gives you an extra reason to get in there and play around. How cool is that?

    ESP8266 MicroPython Contest
    Build something using MicroPython and win fabulous prizes!
    https://hackaday.io/contest/12641-esp8266-micropython-contest

    Reply
  17. Tomi Engdahl says:

    MicroPython on the ESP8266: Kicking the Tires
    http://hackaday.com/2016/07/21/micropython-on-the-esp8266-kicking-the-tires/

    Scripting languages are for large computers, right? “Real” embedded device work is a hellish, never-ending cycle of code, compile, and re-flash. Well, I used to think so too, but with the proliferation of scripting and other interactive languages to microcontrollers over the last few years, the hurdle to interactive development on the small chips has gotten a lot lower.

    On the ESP8266 platform, I’ve tried out NodeMCU’s Lua and ESP8266 BASIC. (For the last half-year, I’ve been using the awesome Mecrisp-Stellaris almost exclusively on the STM32F1xx and F4xx chips, but haven’t dipped into ESP8266 Forth yet.)

    NodeMCU is great because it’s got everything you could want built in, and through cloud services it’s easy to get a tailored build made that maximizes free flash memory for your projects.

    So when the MicroPython folks announced that they were releasing the binary builds for the ESP, I thought it was time to give it a spin.

    Reply
  18. Tomi Engdahl says:

    ESP8266s without the big SDK “nosdk8266″
    https://www.youtube.com/watch?v=AWT2w7v9szs

    If you’re thinking “no wifi? no problem!” then this hack is for you! nosdk8266 allows you to use your ESP8266 with very, very little overhead. This enables rapid development cycles, crazy high speeds and more I/D RAM than you’ve ever imagined. You’ll still need the esp open sdk, but not a ton more!

    The ESP: A New 1kB Contender Appears
    http://hackaday.com/2016/11/30/the-esp-a-new-1kb-contender-appears/

    Github: http://github.com/cnlohr/nosdk8266

    Reply
  19. Tomi Engdahl says:

    Interactive ESP8266 Development with PunyForth
    http://hackaday.com/2016/12/23/interactive-esp8266-development-with-punyforth/

    Forth is one of those interesting languages that has a cult-like following. If you’ve never looked into it, its strength is that it is dead simple to put on most CPUs, yet it is very powerful and productive. There are two main principles that make this possible. First, parsing is easy because any sequence of non-space characters makes up a legitimate Forth word. So while words like “double” and “solve” are legal Forth words, so is “#$#” if that’s what you want to define.

    The other thing that makes Forth both simple and powerful is that it is stack-based.

    [Zeroflag] created PunyForth–a Forth-like language for the ESP8266. You can also run PunyForth for cross development purposes on Linux (including the Raspberry Pi). The system isn’t quite proper Forth, but it is close enough that if you know Forth, you’ll have no trouble.

    Forth inspired programming language for the ESP8266
    https://github.com/zeroflag/punyforth

    Reply
  20. Tomi Engdahl says:

    Howto: Program ESP8266 with ease
    Simple step-by-step instruction of programming ESP8266 ESP-12E using Linux and Platformio
    https://hackaday.io/project/19684-howto-program-esp8266-with-ease

    Simple step-by-step instruction of programming ESP8266 from AI-Thinker ESP-12E using Linux and Platformio.

    Why

    I was googling for a while how to do programming of this variant, and this setup seems to work. I used Platformio for the first time and it was really good experience. Zero hassle, and it just worked. On top of that, i got to use my preferred editor rather than the Arduino IDE.

    Reply
  21. Tomi Engdahl says:

    PlatformIO and Visual Studio Take over the World
    http://hackaday.com/2017/04/07/platformio-and-visual-studio-take-over-the-world/

    In a recent post, I talked about using the “Blue Pill” STM32 module with the Arduino IDE. I’m not a big fan of the Arduino IDE, but I will admit it is simple to use which makes it good for simple things.

    It turns out, the Arduino IDE does a lot more than providing a bare-bones editor and launching a few command line tools. It also manages a very convoluted build process. The build process joins a lot of your files together, adds headers based on what it thinks you are doing, and generally compiles one big file, unless you’ve expressly included .cpp or .c files in your build.

    That means just copying your normal Arduino code (I hate to say sketch) doesn’t give you anything you can build with a normal compiler. While there are plenty of makefile-based solutions, there’s also a tool called PlatformIO that purports to be a general-purpose solution for building on lots of embedded platforms, including Arduino.

    Although PlatformIO claims to be an IDE, it really is a plugin for the open source Atom editor. However, it also has plugins for a lot of other IDEs. Interestingly enough, it even supports emacs. I know not everyone appreciates emacs, so I decided to investigate some of the other options. I’m not talking about VIM, either.

    I wound up experimenting with two IDEs: Atom and Microsoft Visual Studio Code.

    PlatformIO supports a staggering number of boards ranging from Arduino to ESP82666 to mBed boards to Raspberry Pi. It also supports different frameworks and IDEs. If you are like me and just like to be at the command line, you can use PlatformIO Core which is command line-driven.

    PlatformIO does too much. In theory, that’s the strength of it. I can write my code and not care how the mBed libraries are written or the Arduino tools munge my source code. I don’t even have to set up a tool chain because PlatformIO downloads everything I need the first time I use it.

    When that works it is really great. The problem is when it doesn’t.

    http://platformio.org/

    Reply
  22. Tomi Engdahl says:

    CircuitPython – a Python implementation for teaching coding with microcontrollers
    https://github.com/adafruit/circuitpython

    Adafruit CircuitPython is an open source derivative of MicroPython for use on educational development boards designed and sold by Adafruit.

    CircuitPython, a MicroPython derivative, implements Python 3.x on microcontrollers such as the SAMD21 and ESP8266.

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*