Enginursday: First Impressions of the ESP32

An overview of Espressif's sequel to the ESP8266 - a new WiFi/Bluetooth-enabled system-on-chip, with a massive GPIO count.

Favorited Favorite 3

Last year, the ESP8266 took the embedded IoT world by storm. For less than $10, you could get a programmable, WiFi-enabled microcontroller with just enough GPIO to wiggle some LEDs and monitor some sensors. I spent a good chunk of the year working with the chip -- laying out a handful of boards, and mostly wrestling with the lightly-documented SDK (to put it nicely). Fortunately, a huge community sprang up around the chip, and some amazing tools and firmwares were created to support it, like ESP8266 Arduino and NodeMCU.

This year Espressif -- the semiconductor company behind the ESP8266 -- is releasing a new Internet-capable microcontroller: the ESP32.

The ESP32 doesn't replace the ESP8266, but it does improve on it in every aspect. Not only does it have WiFi support, but it also features a Bluetooth 4.2 radio, making it even more versatile. The CPU is similar to the ESP8266 -- it's a 32-bit Xtensa(R) LX6, but the ESP32 has two cores! There's also 128KB of ROM and 416KB SRAM, but Flash memory (for program and data storage) is still left up to an external chip (up to 64MB).

Block diagram from the ESP32 spec sheet

Block diagram from the ESP32 spec sheet.

There are 36 GPIO pins, which can be assigned to all sorts of peripheral duties, including:

  • Analog-to-Digital Converter (ADC) -- Up to 16 channels of 12-bit SAR ADC's. The ADC range can be set, in firmware, to either 0-1V, 0-1.4V, 0-2V, or 0-4V -- no more weird 0-1V ADC!
  • Digital-to-Analog Converter (DAC) -- Two 8-bit DAC's to produce true analog voltages
  • Pulse-Width Modulation (PWM) -- Up to 16 channels of PWM-capable pins for dimming LEDs or controlling motors
  • Touch Sensor -- 10 GPIOs feature capacitive sensing; make a 10-key buttonpad!
  • UART - Two UART interfaces, one is used to load code serially. They feature flow control, and support IrDA too!
  • I2C, SPI, I2S -- There are two I2C and four SPI interfaces to hook up all sorts of sensors and peripherals, plus two I2S interfaces if you want to add sound to your project.

ESP31B Development Board

Espressif sent us a preliminary development board -- so preliminary, in fact, that it's not even the right chip. This is the ESP31B on a little module they call the ESP-WROOM-03:

ESP31B-WROOM-03 top and bottom views

Top and bottom views of the ESP31b-WROOM-03 module.

It turns out the ESP31B isn't all that different from the ESP32. Some of the GPIO and power pins are in different spots, but they're close enough for evaluating purposes.

The ESP-WROOM-03 module equips the ESP31B with a 4MB SPI flash, all of the necessary passives, and a trace antenna. Here's a breakdown of the GPIO and other breakouts on the ESP31B module. It gives you an idea of the chip's GPIO breadth.

ESP-WROOM-03 graphical datasheet

v01 of an ESP31B-WROOM-03 graphical datasheet. (Thanks for the Python script, Michelle!)

All of the GPIO and power pins are broken out to castellated vias on a 1mm pitch. Fortunately, Espressif also supplied us with a testbed...

ESP-WROOM-03 soldered to the testboard

ESP31B ESP-WROOM-03 module soldered on to the breadboard-compatible testbed.

...so I could solder it down and do a little breadboard prototyping.

My breadboard hookup

Breadboarding with the ESP-WROOM-03 module soldered into a testbed.

Tips For Using the ESP31B Dev Board

If you're lucky enough to have gotten a preliminary ESP32 dev board, but haven't gotten around to powering it up yet, here are a few tips I would've loved to have handy when I started. There are plenty of links too, if you're just interested in learning more about the chip.

Espressif is hosting the ESP32 Software Development Kit (SDK) on GitHub. Cloning that repository will set you up with libraries, source files and example code for the ESP32. It includes FreeRTOS, which isn't required for your application, but sure does help a lot for more complicated projects.

This SDK is still in its extreme infancy -- system functions, WiFi, and some of the peripheral interfaces are in there, but Bluetooth support is unfortunately missing for now.

Toolchain and Development Environment

After grabbing the SDK, you'll need to set your machine up with an xtensa-esp108 toolchain -- all of the executables required for compiling ESP32 firmware. Depending on your desired effort-level, you can either build the tools on your own, or try to find them pre-compiled.

If you want to compile the executables on your own, reading through the ESP32 SDK Readme is a good place to start. Personally -- stuck on a Windows machine, and with limited cross-compiling experience -- I sought out a pre-built toolchain. I've had good luck with this development kit. You may find other pre-built toolchains posted on the ESP32 forum.

After installing a GCC compiler for the ESP32, you may want to set up a development environment around the toolchain. Again, Espressif's ESP32 SDK readme has some good information to help get you started. The Windows development kit I linked to above can be plugged into Eclipse, if you're into that. For now, I've been working with Notepad++ and the command-line -- I haven't done anything complicated enough yet to warrant a full IDE.

My notepad++/CMD devlopment environment

And for those looking for a simpler development experience, there is plenty of hope for an Arduino-based ESP32 development environment! A lot of the system, GPIO, and WiFi function calls in the ESP32 SDK are exact matches for the ESP8266 API, so most of the library put into ESP8266 Arduino should translate over to the ESP32. In fact, check out GitHub/me-no-dev/ESP31B for a working, beta Arduino plugin (this forum post has more information on using it).

Example Hookup

The ESP32's recommended supply voltage is 3.0-3.6V and, in my experience, it needs a pretty hefty supply. Powering off both USB and a Power Cell (with 100mA and 200mA limits), I ran into sporadic start-up behavior. If you see garbage data in the terminal, and the application just halts after startup, you may be running into the same issue. It wasn't until I switched to a battery-supplied LM1117 (with up to 1A throughput) that my ESP32 ran reliably.

Like the ESP8266, new code can be flashed to the ESP32 over a simple, serial interface. That means the only extra hardware you need is a USB-to-serial converter, like the 3.3V FTDI Basic. But you'll also need some GPIO management, and a well-timed reset to program the chip. The ESP32 samples a few GPIO on startup to determine whether it'll boot into run mode or download-new-code mode.

GPIO Determining the Boot Mode
PinDefaultRun ModeDownload Mode
IO0Pull-up10
TXD0Pull-up1x
IO2Pull-downx0
IO5Pull-up1x

If you leave TXD0 (UART0's TX pin), IO2, and IO5 floating, then IO0 determines the chip's mode. I wired up an SPDT switch to toggle the state as I needed.

Here's a quick diagram of my simple ESP32 hookup, including a reset button, run/program switch, and a status LED:

ESP32 basic hookup - fritzing diagram

Example Phant Application

When I approach a new Internet-capable hardware platform, my go-to "Hello, world" application is to chuck something from the microcontroller up to data.sparkfun.com. So my first ESP32 program reads all eight values from ADC1, and sends them to a Phant stream -- testing WiFi, lwIP, and all eight ADC channels of the chip's ADC1.

I've thrown the source code into a ESP32 Miscellany GitHub repository, if you'd like to check it out. Be warned, though, it was my first time using lwIP to send and receive TCP packets -- it may not be all that pretty, but it does the job.

There are still plenty of GPIO, hardware peripherals, and other features I need to play with (and a lot of those features are still missing from the SDK), but I'm enjoying the challenge and potential of the ESP32 so far.

Update

The ESP32 has been available for some time now so we thought it best to introduce a few products we have built around it.

SparkFun ESP32 Thing

SparkFun ESP32 Thing

DEV-13907
$23.50
69

SparkFun ESP32 Thing Environment Sensor Shield

DEV-14153
1 Retired

SparkFun ESP32 Thing Power Control Shield

DEV-14155
Retired

SparkFun ESP32 Thing Motion Shield

DEV-14430
1 Retired

Summary

The ESP32 doesn't replace the ESP8266, but it will be an interesting addition to the IoT-capable microcontroller catalog. The added Bluetooth support is significant, as are the extra GPIO, ADC's and other hardware peripherals. I can't wait to see projects that can take full advantage of the ESP32's feature list.

If you'd like to learn more about the ESP32, here are a few links I've found handy:

Everything is very preliminary right now. We're still not sure what it'll cost, nor when it will become widely available. Word on the street, at least, is that it will maintain the ESP8266's most important feature: affordability (though it probably won't be as inexpensive as the 8266). If you have any questions about the module, feel free to comment away!


Comments 22 comments

  • TMM2114L3 / about 8 years ago / 2

    The Dev board silkscreen shows GND at the top and IO0 on the bottom along the right side (left side with the bottom up). but the diagram does not.

    the entire right side pin labels seem to be up-side-down.

  • Member #306839 / about 8 years ago / 2

    Can It be used to communicate with BLE devices?

    • Sembazuru / about 8 years ago / 1

      Good question. Can it work as a BLE host, or only as a BLE device?

  • Great Article!! Can It be used to communicate with BLE host?

  • Great Article!! Can It be used to communicate with BLE host?

  • sprior / about 7 years ago / 1

    You go out of your way to mention that the ESP32 does not replace the ESP8266 and I'm curious as to why. I get that it's not a pin for pin replacement and the dev kit isn't mature yet, but ignoring those things will there be cases where the ESP8266 is more appropriate than the ESP32 for a given project? Can you give any examples where the ESP8266 would still be preferable over the ESP32?

  • JimNorton / about 8 years ago / 1

    When do you think you guys will be selling a breakout/dev board for the ESP32?

    Cheers!

    • M-Short / about 8 years ago / 1

      Hopefully in a few months, but I don't believe the chips are shipping yet (although they are orderable).

      • Member #586375 / about 8 years ago / 1

        SeeedStudio is shipping them; https://www.seeedstudio.com/ESP3212-Wifi-Bluetooth-Combo-Module-p-2706.html

        • M-Short / about 8 years ago / 1

          Yep, they are shipping, but there were a few changes to the chip from the prototype version we were using, so more prototyping is in order... We're getting there!

  • Member #586375 / about 8 years ago / 1

    I haven't seen anything about the typical power draw. The 8266 is said to draw 175 mA when transmitting and far less when receiving or when WiFi is off, but this article implies that 200mA is not sufficient to even get the ESP32 to boot up reliably.

  • PighiXXX / about 8 years ago / 1

    The new ESP32 specs http://www.pighixxx.com/test/portfolio-items/new-esp32-espressif-specs/?portfolioID=337

    Pinout & Datasheet availbale :)

    • M-Short / about 8 years ago / 1

      Thanks, having done these I know how much work they are. Hopefully when we get the new boards built I'll have a graphical datasheet up for them.

  • Member #33885 / about 8 years ago / 1

    Latest on the ESP32 forums Is that it should be available in August.

  • Member #810876 / about 8 years ago / 1

    The ESP32 isn't for sale anywhere! Seems like the next revision of pre-release silicon won't be available until end-of-Q2 / beginning-of-Q3.

  • Member #771400 / about 8 years ago / 1

    It mentions on the documentation sheet for the Xtensa LX6 that it's able to run Linux http://ip.cadence.com/uploads/533/Cadence_Tensillica_Xtensa_LX6_ds-pdf - any experience working with it in that manner?

  • xorbit / about 8 years ago / 1

    Because of to the high peak current these modules require, an excellent power supply for stable operation is the LiFePO4wered/USB module (http://lifepo4wered.com). It's been tested with the ESP8266, it should work great with the ESP32 as well. Check it out.

  • Member #260321 / about 8 years ago / 1

    Do we have any information on its WiFi capabilities? Is it just IPV4 or do they also support IPV6? How about the antennae - range and coverage, and will it support an external Yagi or monopole?

    • jimblom / about 8 years ago / 1

      I don't see anything backing it up in the limited documentation, but I have seen notes of support for IPv6. For what it's worth, the SDK does include an IPv6 layer in the lwIP library.

      The module they sent us doesn't allow for attaching any external antenna, and I haven't done any range testing on the trace antenna yet. The chip itself seems pretty wide open to whatever you stick on the other end of the amplifier.

Related Posts

Recent Posts

Tags


All Tags