USD

How to Select and Use the Right ESP32 Wi-Fi/Bluetooth Module for an Industrial IoT Application

By Jacob Beningo

Contributed By Digi-Key's North American Editors

As the industrial automation accelerates, engineers on the factory floor are working to connect systems to an IoT that has in many ways left older factory floors behind. However, for both new and legacy systems, wireless connectivity to the IoT using Wi-Fi or Bluetooth has been made relatively simple using ESP32 modules and kits.

Created and developed by Espressif Systems, ESP32—a series of low-cost, low-power system-on-a-chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth —is a breakthrough for automation engineers who don’t want to get caught up in the nuances of radio frequency (RF) and wireless design. As a low-cost Wi-Fi/Bluetooth combo radio, it has gained popularity not just among hobbyists but also among IoT developers. Its low energy consumption, multiple open source development environments, and libraries makes it perfectly suited for developers of all sorts.

However, ESP32 comes in so many different modules and development boards that it can be difficult to select the right one.

This article introduces ESP32 solutions and shows how developers can identify the right module and development board to start connecting their application to the IoT.

The ESP32 module

The ESP32 module is an all-in-one, integrated and certified Wi-Fi/Bluetooth solution that provides not just the wireless radio but also an on-board processor with interfaces to connect with various peripherals. The processor actually has two processing cores whose operating frequencies can be independently controlled between 80 megahertz (MHz) and 240 MHz. The processor’s peripherals make it easy to connect to a range of external interfaces such as:

  • SPI
  • I2C
  • UART
  • I2S
  • Ethernet
  • SD Cards
  • Capacitive touch

There are several different ESP32 modules that a developer can select based on their application needs. The first and most popular ESP32 module is the ESP32-WROOM-32D, which runs at up to 240 MHz (Figure 1). The module includes a pc board trace antenna, which simplifies implementation. It also avoids having to add the additional hardware and layout complexity associated with an IPEX connected antenna. However, if the IPEX connector option is selected, there are plenty of good antenna options, such as Inventek Systems’ W24P-U.

Image of Espressif Systems ESP32-WROOM-32D moduleFigure 1: The ESP32-WROOM-32D module runs at speeds up to 240 MHz and contains 8 Mbytes of onboard SPI flash. (Image source: Espressif Systems)

The module contains 4 megabytes (Mbytes) of flash and has 38 pins that are arranged to minimize the module’s size, making it nearly square. In fact, the WROOM-32D is completely pin compatible with the ESP-WROOM-32U (Figure 2). The WROOM-32U replaces the onboard pc board trace antenna with an IPEX connector, based on the Hirose U.FL design. In doing so, the WROOM-32U saves board space and allows developers to connect an external antenna that they can arrange within their product for optimal RF characteristics.

Image of Espressif Systems ESP32-WROOM-32U moduleFigure 2: The ESP32-WROOM-32U is pin compatible with the WROOM-32D but replaces the latter’s on-board trace antenna with an IPEX connector for an external antenna, allowing for optimized RF characteristics. (Image source: Espressif Systems)

An interesting point about the WROOM-32D modules is that they also come in various flash memory sizes. The modules come in additional memory support variants like the ESP32-WROOM-32D with 8 Mbytes and the ESP-WROOM-32D with 16 Mbytes.

Selecting an ESP32 development board for industrial control

The ESP32 modules are a great choice when designing a board that will be used in production or where they will be put on a board that will be used in “high” volume. For development of low-volume fixtures on the manufacturing floor, developers can use an ESP32 development board. These boards range from very basic “getting started” boards to sophisticated boards that include secondary processors and LCDs. There are some that are also well suited for industrial automation applications, assuming simplicity of development is a key requirement.

For instance, there’s the ESP32-DEVKITC-32D-F (Figure 3). This is a simple breakout board for the WROOM-32D that has all the power conditioning and programming circuits a designer or developer needs to get started. The board is powered either through an on-board USB micro connector or through the V-IN breakout header. Jumpers or wires can then be used to connect various components to the WROOM-32D.

Image of Espressif Systems ESP32-DEVKITC-32D-F development boardFigure 3: The ESP32-DEVKITC-32D-F development board includes breakout headers for connecting to any of the WROOM-32D pins and can be powered through USB for development purposes. (Image source: Espressif Systems)

Another example is the Adafruit Industries Airlift ESP32 Shield. This not only includes the WROOM-32D, but also has additional prototyping space (Figure 4). This prototyping space can be used to add connections to other shields in addition to adding custom circuitry. A developer could use this area to build input and output circuits for low voltage industrial automation applications. There is also an onboard SD card connector that makes developing a data logging application that much easier.

Image of Adafruit Airlift ESP32 ShieldFigure 4: The Adafruit Airlift ESP32 Shield allows designers to prototype their design or build one-off circuits that can be used in industrial automation applications. The Airlift includes prototyping space that can be used for dedicated circuitry. (Image source: Adafruit Industries)

There may be some industrial automation applications where a development board with an additional processor is being used and the ESP32 will just be providing connectivity rather than handling the whole application load. In these applications, the development board or product may have expansion PMOD connectors onboard.

Rather than custom designing a PMOD board for the ESP32, developers can leverage the Digilent ESP32 PMOD breakout board (Figure 5).

The ESP32 PMOD provides a PMOD standard connector along with the following:

  • A power LED indicator
  • An on-board user button
  • Four pin I/O expansion
  • Jumpers for boot configuration

Image of Digilent ESP32 PMOD boardFigure 5: The Digilent ESP32 PMOD board provides the ESP32 module in an easy to connect expansion format for use with other processors and development boards.  (Image source: Digilent)

The Espressif Systems ESP-WROVER-KIT provides a full ESP32 development solution with everything designers need to develop an ESP32-based application (Figure 6). For example, the WROVER includes an FT2232HL USB to serial converter from FTDI which makes it easy to program the ESP32 module without the need for custom programming tools. The board also includes an onboard 3.2 inch LCD, a microSD connector, an RGB LED and a camera interface. The development board also as all the I/O lined up and made easily accessible through pin headers.

Diagram of Espressif ESP-WROVER-KIT boardFigure 6: The Espressif ESP-WROVER-KIT board provides industrial automation developers with an ESP32 module that has access to an RGB LED, microSD slot, camera, an LCD, and easily accessible I/O expansion. (Image source: Espressif Systems)

Once a designer has decided which module and development board best fit their application, they need to spend some time looking at the development environment for the ESP32 that best fits their needs.

Selecting an ESP32 development environment

The ESP32 has become so popular that there are several different development environments to choose from to develop and program the device. The most popular development tools include:

  • The Espressif IoT Development Framework (IDF)
  • Arduino IDE
  • MicroPython

The first environment, the Espressif IDF, is a development toolchain for experienced embedded software developers. The toolchain includes several useful pieces such as an IDE to develop the application, a compiler, libraries, and examples. The IDF uses FreeRTOS as the base real-time operating system (RTOS) along with the lwIP TCP/IP stack and TLS 1.2 for Wi-Fi.

For developers who have minimal programming experience, the popular Arduino IDE can also be used to develop an application and deploy it to the ESP32. While the Arduino IDE is a bit slower and clunkier than a professional development environment, it offers a lot of examples and support for the ESP32, which can make development for a newbie much easier.

Finally, for developers who are interested in developing their application in Python, the ESP32 is supported by the open source MicroPython kernel. Developers can load MicroPython onto the ESP32 and then develop Python scripts for their application. This can make it very easy to update the application on-the-fly in an industrial setting and remove layers of required expertise that normally come with embedded development.

Tips and tricks for working with ESP32

Getting started with ESP32 is not difficult, and a search of the web will provide detailed descriptions of how to set up the various software environments. That said, there are many nuances and decisions required of developers working with ESP32 for the first time. Here are a few “tips and tricks” for getting started:

  • Carefully identify and configure a module’s boot pins—MTDI, GPIO0, GPIO2, MTDO and GPIO5—to load an application from the correct memory source (internal flash, QSPI, Download, Enable/Disable debug messages).
  • Set the serial output baud rate to the same baud rate as the ESP32 boot firmware baud rate. This will allow monitoring of the ESP32 boot messages and the application debug messages, without reconfiguring the baud rate.
  • Users that don’t have embedded programming experience should “flash” MicroPython onto the ESP32 so that the application code can be written in the easy to learn Python scripting language.
  • For the application, search the internet for ESP32 examples and libraries to accelerate application development and integration (there are a lot of great examples already available).
  • In the design, make sure that the boot strapping pins are able to be used to boot into the update mode. This will make it very easy to update firmware in the field.

Developers that follow these “tips and tricks” will find that they can save quite a bit of time and grief when working with ESP32 for the first time.

Conclusion

As shown, ESP32 has several different modules and development boards that developers can leverage to begin designing their industrial IoT application. The advantage of using ESP32 for this purpose is that it simplifies development by removing the need to understand RF circuitry and to certify the wireless receiver. ESP32 is also widely supported, not just by the module manufacturer but also within professional and hobbyist circles. Developers who are not familiar with embedded software can easily use the Arduino IDE or program their wireless application using MicroPython.

All told, ESP32 is an excellent choice for connecting industrial automation equipment quickly and efficiently.

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Jacob Beningo

Jacob Beningo is an embedded software consultant. He has published more than 200 articles on embedded software development techniques, is a sought-after speaker and technical trainer, and holds three degrees, including a Masters of Engineering from the University of Michigan.

About this publisher

Digi-Key's North American Editors