Book Image

Internet of Things Projects with ESP32

By : Agus Kurniawan
Book Image

Internet of Things Projects with ESP32

By: Agus Kurniawan

Overview of this book

ESP32 is a low-cost MCU with integrated Wi-Fi and BLE. Various modules and development boards-based on ESP32 are available for building IoT applications easily. Wi-Fi and BLE are a common network stack in the Internet of Things application. These network modules can leverage your business and projects needs for cost-effective benefits. This book will serve as a fundamental guide for developing an ESP32 program. We will start with GPIO programming involving some sensor devices. Then we will study ESP32 development by building a number of IoT projects, such as weather stations, sensor loggers, smart homes, Wi-Fi cams and Wi-Fi wardriving. Lastly, we will enable ESP32 boards to execute interactions with mobile applications and cloud servers such as AWS. By the end of this book, you will be up and running with various IoT project-based ESP32 chip.
Table of Contents (12 chapters)

Accessing data from a web server

In the previous section, we learned how to connect an existing Wi-Fi hotspot with an ESP32 board. Now, we will try to access a web server from our ESP32 board. Technically, ESP32 APIs adopt the socket programming model to communicate with other systems over a network.

For demo purposes, we will access a web server. We will use Google as a web server target here. We can start by creating the ESP32 project called http_request, with the http_request.c file as the main program. This project can also be found on the official website of the Espressif IDF project, at

  1. First, we will load the libraries in our project, including the network libraries such as socket.h and dns.h:
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h...