Random Nerd Tutorials
Shares

ESP32 Web Server – Arduino IDE

Shares

In this project you’ll create a standalone web server with an ESP32 that can toggle two LEDs using the Arduino IDE programming environment. If you want to learn more about the ESP32 dev board, read my Getting Started Guide with ESP32

First, watch the video demonstration below


Preparing the ESP32 board in Arduino IDE

There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. Follow this tutorial to prepare your Arduino IDE:

Uploading the code

In this example, you’re going to connect two LEDs to the ESP32 that can be controlled remotely through a browser.

Copy the following code to your Arduino IDE to upload it to your ESP32 Dev Module.

Don’t forget to add your network credentials in the preceding code (SSID and Password).

Plug your ESP32 Dev Module to your computer and follow these next instructions:

1) Select your board in Tools > Board menu (in my case it’s the ESP32 Dev Module)

2) Select the COM port

3) To make your ESP32 go into downloading/uploading mode: hold the BOOT button and press the EN button to reboot your ESP32

4) Press the Upload button in the Arduino IDE and wait a few seconds while the code compiles and uploads to your board. If everything is correct this what you should see:

5) Restart your ESP32 to run the newly uploaded code

Parts required and schematics

Here’s the needed parts for this example:

  • 1x ESP32 Dev Module
  • 2x LEDs
  • 1x Breadboard
  • 2x 270 Ohm Resistors
  • Jumper wires

Assemble all the parts as in the schematics below.

Accessing your web server

When your ESP32 restarts, it prints in your Arduino IDE serial monitor the IP address of your ESP32 (set the baud rate to 115200).

You can access your web server, if you type your ESP32 IP address in your browser. In my case it’s http://192.168.1.116.

Demonstration

You can easily toggle the two LEDs connected to your ESP32 on and off. For a video demonstration of this project make sure you watch the video above in the introduction of this post.

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Leave a Comment:

Add Your Reply