It’s time to move beyond the Arduino and work with a more modern microcontroller. Today we will get started with the popular ESP32.

Introduction

When we think about using a microcontroller for a project we usually consider an Arduino. It’s inexpensive, easy to use and has a generous number of digital I/O ports, and a few analog inputs as well.

But the Arduino, for all of its wonderful benefits, is lacking in a number of areas. The first one is speed, the popular Arduino AVR series of boards run at 16 MHz. That’s certainly fast enough to build thousands of applications, but it’s a bottleneck for others.

The Arduino certainly has enough digital outputs and inputs to satisfy most requirements, and its analog inputs are also useful. But adding features like WiFi and Bluetooth requires external components.

Let’s face it, the Arduino has been around since 2005. That’s fifteen years, which in terms of technology is eons. 

The Arduino is well-loved here in the DroneBot Workshop and I’ll continue to use it for many projects and experiments. But I also feel that it’s time to explore other microcontrollers.

Introducing ESP32

The ESP32 is actually a series of microcontroller chips produced by Espressif Systems in Shanghai.  It is available in a number of low-cost modules.

ESP32 Introduction

The ESP32 is an updated version of the ESP8266, which was a chip that took experimenters in the western world by “surprise” in 2014. The original ESP8266 was introduced on a module called the ESP-01, which had very little English documentation so it’s capabilities were largely unknown at the time. Once the documentation was translated into English many experimenters soon became aware of the power of the ESP8266, and it quickly became very popular.

The ESP32 improved upon the ESP32 design in a number of ways.  It offers both Bluetooth and BLE (Bluetooth Low Energy), whereas the ESP8266 only has WiFi (which, of course, the ESP32 also has). It is faster and is available in a dual-core design. It is also capable of operating in an ultra-low-power mode, ideal for battery-powered applications.

Other features of the ESP32 include:

  • Up to 18 12-bit Analog to Digital converters.
  • Two 8-bit Digital to Analog converters.
  • 10 capacitive touch switch sensors.
  • Four SPI channels.
  • Two I2C interfaces.
  • Two I2S interfaces (for digital audio).
  • Three UARTs for communications.
  • Up to 8 channels of IR remote control.
  • Up to 16 channels of LED PWM (pulse width modulation).
  • An integrated Hall-effect sensor.
  • An ultra-low-power analog preamp.
  • An internal low-dropout regulator.

Note that many of the pins on the ESP32 share a number of the above functions, so not all of them are available concurrently.

ESP32 Modules

There are many ESP32 modules available for experimenters. Just about any of them can be used for the experiments here.

Many of these boards have an integrated micro-USB connector that will simplify programming. Some boards don’t have this feature and require an external FTDI adapter for programming.

Most of these boards are based upon the ESP32-WROOM chip.

The ESP32 DEV KIT and ESP32 NODEMCU boards are quite popular and available at Amazon and eBay.

Adafruit makes the HUZZAH32 board.

Sparkfun has the ESP32-Thing board.

And the popular ESP32-Cam board integrates a small video camera and a microSD card socket along with an ESP32 (this board will require an FTDI adapter for programming).

Please note that these boards share many features but they don’t have the same pinouts.  In our experiments, I’ll be referring to the pin function (i.e. GPIO 4) instead of an actual pin number. This will allow you to use a different board than the one I am using.

Programming the ESP32

The ESP32 can be programmed using many different development environments.  Code can be written in C++ (like the Arduino) or in MicroPython.

To make use of all of the ESP32 features Espressif provided the Espressif IoT Development Framework, or ESP-IDF.

For beginners, an easy way to get started is by using the familiar Arduino IDE. While this is not necessarily the best environment for working with the ESP32, it has the advantage of being a familiar application, so the learning curve is flattened.

We will be using the Arduino IDE for our experiments.

Getting started with the Arduino IDE

Before we can use the Arduino IDE with an ESP32 board we will need to add the ESP32 boards using the Arduino IDE Board Manager.

If you look online for instructions for setting up the IDE you may run into a long and complex procedure that actually isn’t necessary anymore. As long as you are using a recent version of the Arduino IDE you can use the following instructions, which are much simpler.

ESP32 for Arduino IDE

In order to be able to work with the ESP32 you will need to add an additional source to the Arduino IDE Board Manager and then install the ESP32 boards.

This is actually a lot simpler than it sounds thanks to the folks at Espressif. They have provided a link to a JSON file that takes care of almost everything for you.

If you are not familiar with JSON it is a format of text file that allows structured information to be shared between computers. In this respect, it is similar to XML.

Add Boards Manager Entry

Here is what you need to do to install the ESP32 boards into the Arduino IDE:

  1. Open the Arduino IDE. Make sure that you are at version 1.8 or higher, if not then update your IDE with the latest version.
  2. Click on the File menu on the top menu bar.
  3. Click on the Preferences menu item. This will open a Preferences dialog box.
  4. You should be on the Settings tab in the Preferences dialog box by default.
  5. Look for the textbox labeled “Additional Boards Manager URLs”.
  6. If there is already text in this box add a coma at the end of it, then follow the next step.
  7. Paste the following link into the text box – https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  8. Click the OK button to save the setting.

The textbox with the JSON link in it is illustrated here:

ESP32 Add Board Manager JSON

Next, you will need to use the new entry to actually add the ESPO32 boards to your Arduino IDE. You do that by following this procedure:

  1. In the Arduino IDE click on the Tools menu on the top menu bar.
  2. Scroll down to the Board: entry (i.e. Board: Arduino/Genuino Uno).
  3. A submenu will open when you highlight the Board: entry.
  4. At the top of the submenu is Boards Manager. Click on it to open the Boards Manager dialog box.
  5. In the search box in the Boards Manager enter “esp32”.
  6. You should see an entry for “esp32 by Espressif Systems”. Highlight this entry and click on the Install button.
  7. This will install the ESP32 boards into your Arduino IDE

ESP32 Arduino Board Manager

If you go back into the Boards: submenu you should now see a number of ESP32 boards. You’ll need to select the board that matches (or is equivalent to) the ESP32 board you have purchased.

For the record, I used an ESP-32S NodeMCU board and chose the “Node32s” board in the Boards Manager.

You have probably finished setting up your Arduino IDE! The reason I say “probably” is that it is possible that you may need to install some additional Python files. 

The easiest way to figure that out is to compile and upload a program to your ESP32 board and see if you get an error.  Don’t worry, I’ll show you how to fix that error if you do!

Experiment Hookup

Before we can upload a test program we will need to hookup our ESP32 board. 

The following diagram shows the connections we’ll need to perform all of the experiments and demos included in this article. Note that the ESP32 pins are specified by their GPIO names and not pin numbers, as different ESP32 boards will have different pin numbers. 

ESP32 Hookup

You can use pretty well any LED, for a dropping resistor any values between 150 and 470 ohms will work well. Any momentary-contact push button will suffice.

The small gold square in the diagram is a Touchpad. You can use any metallic object that you can connect a wire to, a small piece of PCB would work great. I just used a small piece of bare wire on my breadboard.

Now that we are all hooked up it’s time to try our first program.

Hello World – Blink for ESP32

When using a new development environment or programming for a new device it is traditional to create a “Hello World” program.  Far be it from me to dispense with tradition!

The “Hello World” for microcontrollers is the Blink sketch which, as I’m sure you already know, simply flashes an LED on and off.  While “Hello World” programs and sketches are usually of little practical use they serve a number of functions:

  • They familiarize you with the operation of your development library.  In this particular case they let you practice uploading programs to the ESP32 which, as you will soon see, is done a bit differently than an Arduino.
  • They get you familiar with the programming syntax. In this case we are using the same C++ that the Arduino uses, so you are likely already familiar with the programming syntax.
  • They let you verify that your hardware is working correctly.

Here is the classic Arduino Blink sketch, rewritten for the ESP32 module.

Aside from using GPIO pin 2 (instead of Arduino digital output pin 13) and adding the serial monitor it’s no different from the Arduino Blink sketch.

Note that the serial monitor is run at a higher baud rate than most Arduino sketches. While it isn’t really necessary with this sketch it is often done with ESP32 sketches, as the microcontroller runs much faster than the Arduino AVR boards do.

Uploading the program

After you load the sketch into your Arduino IDE it will need to be compiled and then transferred to the ESP32 board.

With an Arduino you just have to hit the Upload button and both of these steps will proceed automatically.   With the ESP32, however, there is an additional step.

You begin by doing exactly the same thing you would with an Arduino – hit the Upload button (the one with the right-pointing arrow).  This will start the compiler. You’ll probably notice that it takes longer to compile ESP32 programs than it does for Arduino sketches.

ESP32 Buttons

Watch the status screen at the bottom of the Arduino IDE. When the compiling process is finished it will print “Connecting”, followed by a string of periods.

When you see this you’ll need to press the BOOT button (sometimes labeled IO0) and hold it down until you see the upload progressing, which you’ll know is happening when you see the upload progress displayed in percentage.

After the program is uploaded you will need to press the ENABLE or RESET button to start it  (some boards don’t require this step).

ESP32 Connecting

And if all goes well you’ll be rewarded with a flashing LED!

But it’s also possible that you’ll get an error message about a missing module named “serial”. If that happens don’t worry, there is a fix.

Problem with “No module named serial”

This issue occurs because one or more of the underlying Python programs is not installed on your computer. The compiler is looking for a program called pyserial and is not finding it.

On Mac and Linux machines this is usually already installed, but not always – in fact the computer I used in the video (Ubuntu Linux 16.04) didn’t have pyserial installed. So I downloaded and installed it using this (very long) command-line string:

 sudo usermod -a -G dialout $USER && sudo apt-get install git && wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py && sudo pip install pyserial && mkdir -p ~/Arduino/hardware/espressif && cd ~/Arduino/hardware/espressif && git clone https://github.com/espressif/arduino-esp32.git esp32 && cd esp32 && git submodule update –init –recursive && cd tools && python3 get.py

As you need to sudo you’ll need to enter your password to supply permissions.

Windows users may have additional difficulties installing pyserial. Adafruit published some detailed instructions that should be of assistance.

Using WiFi

Now that we have our programming environment working we can start experimenting with the ESP32. 

When you install the Board Manager update and then select an ESP32 board you’ll be provided with a large number of test programs that illustrate how to work with the many features of the ESP32.  

We will go through some of these programs, starting with the ones that utilize the WiFi features.

WiFi on ESP32

The ESP32, like its predecessor the ESP8266, supports WiFi on the 2.4 GHz band.  It supports WiFi protocols 802.11 b/g/n with a maximum data transfer rate of 150 Mbps.

The device has an adjustable transmit power of up to 20.5 dBm, using lower power will decrease the current requirements as the WiFi radio can consume a fair amount of current.

An advanced feature of the ESP32 WiFi is “antenna diversity”. This allows you to use some of the GPIO pins to control an external RF switch connected to multiple antennas, and then switch the WiFi radio to the most appropriate antenna (and change it when signal conditions vary).

WiFi Modes

The ESP32 can be used in two different WiFi modes.

Station (STA) Mode

In STA, or Station, mode the ESP32 acts as a WiFi station or client.  The arrangement is illustrated here:

ESP32 WiFi STA Mode

In this mode the ESP32 needs to know the SSID and Password to access the WiFi network (on an unsecured network there is no password requirement). 

The ESP32 is provided with an network IP address using the routers internal DHCP server. It can then be accessed using that address.  It is also possible to assign a fixed IP address to the ESP32, which is useful if you are using it as a web server where a changing IP address would cause difficulties for other clients.

Soft Access Point (AP) Mode

In Soft Access Point, or AP, mode, the ESP32 provides a WiFi connection for external devices. These devices can be computers, phones, tablets, IoT devices or even other ESP32’s configured in STA mode.

ESP32 WiFi AP Mode

The ESP32 can support a maximum of five external devices in AP mode. It has a default IP address of 192.168.4.1 and it will provide DHCP services to the externally connected devices.  The default IP address can be changed if it conflicts with existing devices.

This allows the ESP32 to create its own IP network, independent of any existing WiFi networks. You can secure the network with a password and choose the SSID (network name).

Incidentally, this is referred to as a “soft” access point as the ESP32 does not provide a hardwired connection to the Internet or other existing networks.

WiFi Scanner

The first example sketch we will look at is the WiFi Scanner. As its name would imply, this program scans for local WiFi networks. It then prints the results on the serial monitor. The results include the network SSID (name), the signal strength in dBm and an indicator if the network is secured.

Finding the Example Programs

This sketch, along with all of the other demonstration programs we’ll be examining, can be accessed as follows:

  • Open the Arduino IDE.
  • Select the File menu from the menu bar at the top of the IDE.
  • Scroll down to Examples. A submenu will open.
  • Scroll down through the examples until you find a section of examples for the ESP32. This will be labeled according to the ESP32 board you selected, the one I’m using says Examples for Node32s.
  • You will see a number of menu items below this. Each one has its own submenu with one or more examples.

Load WiFiScan

The example we are going to use now is under WiFi and is called WiFiScan.

The code makes use of the WiFi library and is fairly self-explanatory. The command WiFi.scanNetworks scans the available networks and enters them into an array. The array is then stepped through to produce the scan results.

Load the code to the ESP32, remember to hold down the BOOT button when required. Then open your serial monitor (be sure it is set to 115,200 baud).

ESP32 WiFi Scan

When you first open the monitor there is a good chance you will just see gibberish, this is because the serial signal has not synched up correctly. This can easily be resolved by simply pressing the RESET button on the ESP32.

You should now see a scan of the networks available in your location.

Brownout Detector Enabled

When using the built-in radio for WiFi or Bluetooth you may encounter a “Brownout Detector” message when the ESP32 is reset. This generally means that the ESP32 is not receiving enough current.

This generally is not cause for alarm and you can proceed as normal. If it becomes problematic try switching USB cables or using a powered USB hub, in order to provide extra current to the ESP32.

WiFi Access Point

The next example we will look at uses the ESP32 in AP, or Soft Access Point, mode. You’ll find this example with the previous one, in the WiFi submenu. It is called WiFiAccessPoint.

This program places the ESP32 in AP mode and then creates a very simple web server and web page. The web page has two links on it, and these links can be used to control the LED status on the ESP32.

By default the SSID of the access point is “yourAP” and the password is “yourPassword”. You can modify both of these constants if you wish.

By default the IP address of the web server will be 182.168.4.1. You’ll need to know that to test out the sketch.

Load the sketch to your ESP32 and reset it. You can monitor the reset using the serial monitor.

Now use a device like a notebook, tablet or phone and scan your available WiFi networks. You should see the “yourAP” network listed. Connect to the network with your device, using the password “yourPassword”.

ESP32 WiFi Connect

Once the connection is established, open a web browser on the connected device and navigate to 192.168.4.1. You should see a web page with two links on it, one to turn the LED on and one to turn it off.

Click the links and observe the LED that you wired to the ESP32 (or the built in LED on the module itself). You should be able to control it from the web page.

ESP32 WiFi Webpage

This simple example can be used as the basis for code of your own.

Simple WiFi Server

The Simple WiFi Server example performs a similar function to the previous sketch. The difference is that in this case the ESP32 is used in STA (station) mode, so it creates a web server on your own network. You can control the LED from any computer or device connected to your network.

You’ll also find this sketch in the WiFi submenu, it is called SimpleWiFiServer.

You’ll have to make a few edits to this sketch before you can put it to use:

  • You will need to enter your network SSID (line 30).
  • You will need to enter your network password (line 31).
  • You will need to edit the pinMode statement and change the “5” to a “2” (line 38).
  • You will need to edit the digitalWrite statement and change the “5” to a “2” (line 105).
  • You will need to edit the digitalWrite statement and change the “5” to a “2” (line 108).

The last three edits are because the sketch author, unfortunately, chose to hard-code the GPIO pin numbers instead of using a constant or variable. Another way around this would be to just move the LED to GPIO 5 and avoid those edits.

Once you have it edited load it to your ESP32. Open your serial monitor and reset the ESP32.

The serial monitor will display the IP address that the ESP32 was assigned from your routers DHCP server. Copy this address and then paste it into a web browser.

You should see a webpage very similar to the one displayed in the last experiment. Clicking on the links will control the LED.

Once again this is a good sample sketch from which to create your own web-controlled devices with the ESP32.

Using Bluetooth

One of the big advances that the ESP32 has over its predecessor the ESP8266 is its integrated Bluetooth capabilities.

With Bluetooth the ESP32 is capable of interfacing with numerous other Bluetooth devices, opening up a myriad of potential applications.

Bluetooth and BLE on ESP32

The ESP32 has both classic Bluetooth and BLE, or Bluetooth Low Energy. The device can act as either a Bluetooth client or server.

If you’re unfamiliar with the difference between classic Bluetooth and BLE here is a brief explanation.

Classic Bluetooth 4.2

As its name would indicate Classic Bluetooth has been around for quite a while and is likely the Bluetooth that you are most familiar with.

ESP32 Bluetooth Classic

Classic Bluetooth is used for continuous data transmission. It can be used for wireless audio applications, computer peripherals such as mice and keyboards, and for exchanging files between devices wirelessly.

We will look at an example of exchanging data with classic Bluetooth in a moment.

Bluetooth Low Energy

Bluetooth Low Energy, or BLE for short, exchanges data in short bursts. As its name would suggest it consumes very little current.

ESP32 Bluetooth BLE

This makes BLE ideal for remote sensors and IoT devices, as these applications only require short bursts of data and are often battery-powered.

Using BLE it is possible to design products that measure battery life in years instead of months or days!

Another great application for BLE is targeted promotions. An example of this is a restaurant that can broadcast its menu or daily specials to potential customers in the vicinity.  Apple’s iBeacon protocol makes use of this feature.

Serial to Serial BT

To test the Bluetooth on our ESP32 we will use a simple demonstration sketch that is included in the examples, one called SerialToSerialBT.  You’ll find this sketch in the BlueToothSerial submenu.

The sketch is actually pretty simple, as once again a library does all of the “heavy lifting“ for us.

The function of this program is to exchange data between the Arduino IDE Serial Monitor and an external Bluetooth Serial Terminal.  What is written to one device is read by the other, and it works in both directions.

I’m sure you can see how useful this will be when developing your own Bluetooth applications.

In order to test the sketch you’ll need to have a serial Bluetooth terminal of some sort. If you have an Android device you can use the Serial Bluetooth Terminal App, which is free on the Google Play store.  Apple IOS device users can try the Bluetooth Terminal App or BlueTerm, both available on the Apple App Store.

ESP32 Bluetooth Terminal Devices

Once you have a terminal you can load the sketch and pair your device with the ESP32. Look for a device named “ESP32test” (you can change this name if you like by modifying line 17 of the code).

Now use your Bluetooth terminal to type something. You should see the text you typed displayed on the Arduino IDE Serial Monitor.  You can also type text into the serial monitor textbox, it should appear on your Bluetooth terminal.

ESP32 Bluetooth Terminal

More ESP32 Features

As we saw at the beginning of this article the ESP32 has a wealth of features aside from WiFi and Bluetooth.

The best way to learn about using these features is by running the examples provided by Espressif, justy as we did when learning about the WiFi and Bluetooth features.

You can find all of these examples under the ESP32 menu in the examples. Highlighting this menu will bring up a submenu, which in turn contains more submenus!

The following is a small sample of these example sketches. 

Simple Time

One of the features of the ESP32 is its internal Real Time Clock. The SimpleTime sketch, which is found in the Time submenu, illustrates how you can set the clock using a NTP (Network Time Protocol) server on the internet.

Since this program needs to attach to the internet you’ll need to edit the code with your WiFi SSID and Password.

Calculating the GMT and Daylight Savings Offset

In order to get the clock set to your local timezone you will need to provide it with two values, which will be dependent upon your location.

  • GMT Offset – The number of seconds your timezone differs from GMT. This can be a positive or negative value.
  • Daylight Offset – If your area observes Daylight Savings Time then this is the number of seconds you advance the clock for DST.

To calculate the GMT Offset you’ll need to know how many hours your timezone is offset from Greenwich Mean Time. You probably already know that value, but if you don’t you can calculate using one of several calculators on the internet.  Your value may be positive (if you are east of the Greenwich Observatory) or negative (if you live on the west side, i.e. North and South America).

Next you will need to convert that figure into seconds, which means you’ll need to multiply it by 3600, as there are 3600 seconds in an hour (60 x 60).   The result is the GMT Offset, which you will enter on line 8 of the code.

I’ll use my area as an example. I live in Montreal, which is in Eastern Time – same time zone as New York, Miami and Toronto. Our GMT offset is -5 hours, and we observe daylight savings time.

So my GMT offset will be -18000, which is 3600 x -5.  Note that you don’t use a comma within the number.

The Daylight Offset is 3600, which means that during daylight savings time our clocks are set one hour (3600 seconds) ahead. For most areas that observe daylight savings time this is the correct figure.

After editing the code with your WiFi parameters and the correct offset all you need to do is load the sketch to the ESP32, open the serial monitor and press reset.  

ESP32 Simple Time

You should see the ESP32 connect to your WiFi and then display the time every second. Since most computers are also synchronized to an internet time server the time value should match the value on your computer.

The uses for a sketch like this one are pretty obvious!

Hall Sensor

A Hall Sensor is a device that uses the Hall Effect to sense a magnetic field. I have covered these devices before in the article and video Stepper Motor with Hall Effect Limit & Homing Switches.

The ESP32 has an integrated Hall Effect sensor, so you can use it to detect the presence (or absense) of a magnetic field.

The HallSensor example sketch shows how to read the value of the integrated Hall sensor.

This sketch is about as simple as the Blink sketch, in fact in some ways it’s even simpler!

The hallRead() function does all of the work, producing an integer value that indicates the hall sensor output.  

Just load this sketch to the ESP32, open the serial monitor (note that this sketch runs at 9600 baud,unlike the others) and press reset. You’ll get a string of numbers.

Now bring a magnet near the ESP32 module and observe the numbers. You should notice a definite change when the magnet is brought near the sensor.

ESP32 Hall Sensor

For a more visual experience open the Serial Plotter instead of the Serial Monitor. You should notice a graph that responds to the presence or absence of your magnet.

LED Software Fade

Changing the brightness of an LED is a pretty popular task for a microcontroller. With the Arduino we use the analogWrite function, which provides a PWM (pulse width modulation) output to PWM-enabled output pins. Varying the duty-cycle of the PWM signal will control the LED brightness.

However analogWrite will not work with the ESP32. Instead we will need to use a different method to control LED brightness.

The ESP32 has 16 internal channels to control LED brightness. You can control the precision of the PWM timer and its frequency, allowing you precision control of the LED brightness.

Although you’ll find the LEDCSoftwareFade sketch in the AnalogOut submenu the output is actually digital PWM.

The sketch works by cycling the duty-cycle of the PWM output, which causes the LED to fade and brighten and then repeat.

In order to work with our ESP32 hookup you will need to change the LED_PIN constant (on line 23) to a “2” instead of “5”, as our LED is attached to GPIO 2. 

Note that the sketch defines a function called ledcAnalogWrite that operates in a similar fashion to the Arduino analogWrite function.  You might want to use that in programs that you create to control LEDs.

Repeat Timer

The Repeat Timer example is essentially a basic stopwatch. When the Reset (ENABLE) button on the ESP32 module is pressed it starts counting seconds, which are displayed on the serial monitor. The count continues until the push button we attached to our module is pressed.  It can be reset to start again.

The RepeatTimer example is in the Timer submenu, and it illustrates how to create an interrupt handler for the ESP32.  The interrupt handler is a function called onTimer and it is attached to the timer and triggered every second.

ESP32 Repeat Timer

The button is read in the Loop of the sketch and calls the built-in timerEnd function to stop the timer.

This is a great example to build upon.

Touch Read

The final example that we will look at uses the built-in touch switch of the ESP32. 

A touch switch is simply a conductive plate that you can touch to activate. This is a capacitive touch switch, so touching it causes the capacitance to change. This change is measured and that change is used to activate the switch.

On my breadboard, I just used a small loop of wire as my “touch switch”. Feel free to get creative and use something else!

There are ten touch switch inputs on the ESP32, they share their function with ten of the GPIO pins. We are using touch switch 0, which is equivalent to GPIO 4.

 

The TouchRead sketch can be found in the Touch submenu. As you can see it’s another very simple sketch, making use of the touchRead function.

The sketch reads the value outputted from the touchRead function and displays it on the serial monitor. It’s as simple as that!  

ESP32 Touch Switch

Load the sketch to your ESP32, open the serial monitor and reset the device. You should observe a change in value when you touch the “touch switch”.

You can use this example to add touch switches to your next ESP32 project.

Conclusion

As you can see from the number of example sketches provided with the ESP32 this is a very powerful microcontroller with a lot of capabilities.  

With its amazing versatility and low price, the ESP32 is going to be making many more appearances here in the DroneBot Workshop.  And it should be making an appearance in your own workshop very soon.

 

Resources

Article Code – The examples used in this article in a downloadable ZIP file.

Arduino IDE Board Manager – The Board Manager extension for the ESP32 on GitHub.

Serial Bluetooth Terminal – The Android Serial Bluetooth Terminal app on the Google Play Store.

Bluetooth Terminal – The IOS Bluetooth Terminal all on the Apple App Store.

ESP32 Overview – Espressif Systems ESP32 page.

 

Getting started with ESP32
Summary
Getting started with ESP32
Article Name
Getting started with ESP32
Description
Learn to use the ESP32 microcontroller with the Arduino IDE. Today we will examine the many features of this amazing device, including its WiFi and Bluetooth capabilities.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:

If you have a question...

Comments about this article are encouraged and appreciated. However, due to the large volume of comments that I receive, it may not be possible for me to answer you directly here on the website.

You are much more likely to get answers to technical questions by making a post on the DroneBot Workshop Forum. Your post will be seen not only by myself, but by a large group of tech enthusiasts who can quickly answer your question. You may also add code samples, images and videos to your forum posts.

Having said that, please feel free to leave constructive comments here. Your input is always welcome. Please note that all comments may be held for moderation.

22 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
A.J. Lenze
5 months ago

At about 15 minutes into your video, you show the process for downloading a sketch into your ESP32 module. As part of the process, you show how to press the IO0 button when you see “Connecting…” on the Arduino IDE screen. There’s a work-around for this, where you connect a 2.2uF capacitor between your EN pin and ground, which prevents you from having to press the button when downloading the sketch. You can read all about this at https://github.com/espressif/esptool/issues/136. Apparently, this is a bug in early ESP32 silicon, which has was later fixed, although there seems to be a lot… Read more »

David
5 months ago

TYPO
In ‘Introducing ESP32’, you say:
The ESP32 improved upon the ESP32
I think you mean
The ESP32 improved upon the ESP8266

David
5 months ago

Thanks for an amazing amount of work you must have put into the video and the write-up.
Having put my early ESP32s on one side after hitting so many problems with them, II have now brought them out and started loading the programs you kindly supplied in a zip (they didn’t come up in my Examples folders). And following your instructions, so far they all work! Brilliant!
Thanks. Now to get down to some serious work with them.

Teddy Chen
5 months ago

Thank you for your excellent Video. That is great!
For the uploading issue, you can use any capacitor between 2.2 to 10 uF.
BTW I noticed that you use the Menu to open the Serial Monitor. There is a shortcut below the “Close” button.

Suman Bhat
5 months ago

I do have an ESP32 module. I am thinking to make a clock using addressable LED with animation. My question is, will it be possible to use one core of ESP32 to run the clock mechanism, and another core to control LED animation (so the clock is not waiting in the meantime).

Martin Egan
5 months ago

excellent video and article looking forward to your next one keep up the good work
regards

Martin

Peter
5 months ago

Went out and bought one of these straight away ( the Adafruit Feather version ) Once It arrived I could not get it to work , it powered on but no communication with the Arduino IDE . It took me a while to realise the USB cable was power only 🙁 Once I got a new cable it was up and running ) looking forward to using it and creating some animations ( servos working etc ) on a model railway. PS – I have used Arduino’s and Raspberry Pi for years but the WiFi and Bluetooth will be an… Read more »

Nektarios Kourakis
4 months ago

thanks for tutorial..i suggest to move on with esp32 ..give us more option with this mcu..THANKS

JonG
4 months ago

Thanks for the very informative video. I am tinkering with an ESP32-DEVKITC-32D-F ($10 from DigiKey) and I ran into an issue using Arduino on my Mac. The drivers for the CP2102 USB to UART bridge on the ESP32 module were not installed on my Mac so I couldn’t open a serial port. Apparently this is a common problem and I found this article that provides the steps for downloading the required drivers – https://techexplorations.com/guides/esp32/begin/cp21xxx/. It is a pretty simple download and once installed I was off and running. I just thought it might be helpful for anyone else who runs… Read more »

Phillip Neal
3 months ago

Great Article on the ESP32. Thank you. A BLE example client-server with another computer (not a phone) would be great !

Pedro A. Vazquez
3 months ago

 

Pedro A. Vazquez
3 months ago

I like that you go improving your site with the many processors that are common for today. You are a great teacher. I continue to think that you can publish a nice book. No not one, many!

John Anderson
2 months ago

Excellent web page.   I don’t know much about computers but I have bought an ESP32 board (NodeMCU-32S) to play with for ‘lockdown’ entertainment and your web site is my reference – when I find something I don’t understand on another site I come back to yours and it usually explains it in understandable English.   I found compiling on Windows 10 interminably slow, so now have installed Linux on an old laptop and it is a lot better – having finally got Arduino IDE to work on Linux. However, whilst working on your set of example programs I get… Read more »

Ronnie
2 months ago

This is the best video for getting started on esp32 that I have seen. Outstanding in every way. After two years if multiple disappointments I have a esp32 up and blinking. Came here to download the other experimental code sketches to hook up Wifi tonight. And then Bluetooth and beyond. Thanks for such a concise tutorial.

juan garcia
2 months ago

 

Erwin Van Der Haar
2 months ago

Is there a way to readout the content of a programmed ESP32?

R.H. Campagne
1 month ago

TVM for your excellent workshop video’s! Working with the ESP VROOM 32D DEVkit C V4 board, I came across an issue that I could not find in the Espressif documentation: The board must be powered by one of the three Power Supply Options Micro USB port(default), or 5V / GND header pins, or 3V3 / GND header pins I connected the micro USB to power the board, then I – surprisingly, because they should be power input only – measured 5V and 3.3V on the two power input Pins, so the board seems to supply power to the Pins once… Read more »

George pederson
1 month ago

would it be possible to build a drone out of a esp32

Zeki
1 month ago

Getting started with ESP32″ is perfect. Thank you very much.

LuigiChi
9 days ago

Very interesting! Thanks!

Dr. Hritu Raj Rohariya
2 days ago

You are the Best

22
0
Would love your thoughts, please comment.x
()
x