Reader small image

You're reading from  Raspberry Pi and MQTT Essentials

Product typeBook
Published inSep 2022
PublisherPackt
ISBN-139781803244488
Edition1st Edition
Right arrow
Author (1)
Dhairya Parikh
Dhairya Parikh
author image
Dhairya Parikh

Dhairya Parikh is an Electronics Engineer who currently works as a Data Engineer at Accenture. He has a year’s experience in building and maintaining data pipelines for a huge amount of data. In his free time, he builds IoT and Machine Learning projects and even writes about them. He has written several project articles for Circuit Cellar, which is a monthly tech magazine. He makes projects which positively impacts the society, making people’s life easier.
Read more about Dhairya Parikh

Right arrow

Introduction to ESP Development Boards

In this book, we will be using two types of ESP-based development boards manufactured by Espressif Systems (688018.SH). Espressif Systems is a public multinational, fabless semiconductor company established in 2008. They mainly develop state-of-the-art Wi-Fi and Bluetooth-based IoT development boards and SoCs. Their popular products include the ESP8266 (the chipset powering the popularly known NodeMCU), ESP32, ESP32-S, and ESP32-C series of chips, modules, and development boards.

This chapter introduces you to two of the most popular development boards: the ESP8266 based NodeMCU and the ESP32 development board. The chapter is divided into 3 main sections:

  • ESP8266-based NodeMCU development board
  • ESP32-based development board
  • Mini-Project 1: NodeMCU as an MQTT client

This chapter will be divided into three main sections. The first two sections will provide details about these development boards, discussing each point listed...

ESP8266-based NodeMCU development board

NodeMCU is an open source development board that is designed to prototype IoT applications. The development board equips the ESP-12E module, which contains an ESP8266 chip. This chip has a Tensilica Xtensa® 32-bit LX106 RISC microprocessor that operates at an 80 to 160 MHz-adjustable clock frequency and supports RTOS.

The board can be programmed using two languages, as follows:

  • Embedded C (using the popular Arduino IDE)
  • Lua Programming Language

We will learn how to program NodeMCU through the Arduino IDE later in this chapter.

First, let’s look at the actual development board. The following is a diagram of the NodeMCU board with the important peripherals of the board labeled accordingly:

Figure 3.1 – A NodeMCU development board

Next, we will look at the technical specifications for this development board.

Technical specifications

The development kit that’s based...

ESP32-based development board

ESP32 is often considered a successor to the NodeMCU development board. It is yet another open source board designed by Espressif specifically for prototyping mobile devices, wearable electronics, and IoT applications.

The main upgrade over the last generation chip is a hybrid Wi-Fi and Bluetooth chip, which can help you provide an additional connection protocol to your application. Note that the ESP32 dev boards have a single antenna, so only one of the two protocols can be used at a given time.

The following figure shows what the development looks like. The form factor is similar to the NodeMCU development board but with some notable differences:

Figure 3.7 – ESP32 DEVKIT V1

We will be using this particular model of the ESP32 board in this book, but the information given here will be also applicable for its other versions as they are all powered by the same chip.

An overview of the ESP32 specifications is as follows...

Mini-project 1: NodeMCU as an MQTT client

This is the first project we will be doing related to MQTT and our Raspberry Pi broker.

First, we will start by setting up the NodeMCU board. No external connections need to be made as we are only controlling the on-chip LED. This will be divided into two parts:

  • Node MCU setup and code explanation
  • Raspberry Pi setup and project demonstration

We will first set up our NodeMCU development board for this project.

Part 1 – NodeMCU development board setup

In this section, we will program our NodeMCU board to act as an MQTT client and control its onboard LED using an external device (your home computer, in this case).

For this, we will write a sketch that gives us access to the features we need. We will be using the pubsub library for this purpose. The code we will be using will do the following:

  1. First, it will connect to an MQTT server.
  2. Once the connection has been established, it will publish "...

Summary

This chapter was solely dedicated to the ESP development boards that we will be using throughout this book, even in the full-scale projects that we will be creating in the upcoming chapters. First, we covered the NodeMCU development board, including its technical specifications, and its GPIO configuration, before learning how to set up the Arduino IDE for this board and flashing our very first program. Next, we covered the same topics for the ESP32 development board, which is often considered a successor of the latter with some additional features. Finally, we built our very first mini-project. We turned our NodeMCU board into an MQTT client and controlled its onboard LED wirelessly using the MQTT communication protocol.

In the next chapter, we will look at another important component that will be very useful later in this book when we cover two full projects: Node-RED.

We will use this to create dashboards for our projects and learn how we can store the received MQTT...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Raspberry Pi and MQTT Essentials
Published in: Sep 2022Publisher: PacktISBN-13: 9781803244488
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Dhairya Parikh

Dhairya Parikh is an Electronics Engineer who currently works as a Data Engineer at Accenture. He has a year’s experience in building and maintaining data pipelines for a huge amount of data. In his free time, he builds IoT and Machine Learning projects and even writes about them. He has written several project articles for Circuit Cellar, which is a monthly tech magazine. He makes projects which positively impacts the society, making people’s life easier.
Read more about Dhairya Parikh