top of page
IMG_20170503_173438.jpg

Post

IoT project for beginners: Introduction to ESP32 Arduino IDE programming.


ESP32 development board on a solderless breadboard.
ESP32 development board on a solderless breadboard.


Introduction


The ESP32 is a popular and powerful microcontroller and system-on-chip (SoC) that is widely used in embedded systems and IoT (Internet of Things) projects. It is developed by Espressif Systems and is a successor to the ESP8266.


With a 32-bit controller and built-in Bluetooth and Wi-Fi, ESP32 is popularly recommended as the next step from 8-bit Arduino boards.


With its rich feature set, the ESP32 is suitable for a wide range of applications, including home automation, smart devices, industrial automation, robotics, sensor networks, and more. It provides a flexible and cost-effective solution for building connected systems.



Hi there!!! Welcome to Makersgeneration: Your one-stop platform for anything tech and STEM education.



Let's take a quick look at what today's topic will cover below:


What we'll learn

  • ESP32 hardware overview.

  • ESP32 programming platforms.

  • ESP32 programming with Arduino IDE.

  • Program LED connected ESP32 board to blink.


Components we'll need.

  • ESP32 board.

  • Micro USB cable.

  • LED.

  • 220 ohms resistor.

  • jumper wires.


1. ESP32 - Generic hardware overview


The are many variants and series of ESP32 chips, but below is a generic overview of specifications on the ESP32 board:

  • CPU: Xtensa dual-core (or single-core) 32-bit LX6 microprocessor, operating at 160 or 240 MHz and performing at up to 600 DMIPS.

  • Ultra-low power (ULP) co-processor.

  • RAM: 320 KiB

  • ROM: 448 KiB

  • Wi-Fi: 802.11 b/g/n

  • Bluetooth: v4.2 BR/EDR and BLE (shares the radio with Wi-Fi)

  • 34 x programmable General Purpose Input Output (GPIO) pins.

  • 12-bit SAR ADC up to 18 channels.

  • 2 x 8-bit DACs

  • 10 x touch sensors (capacitive sensing GPIOs)

  • 4 x PSI.

  • 2 x I2S interfaces.

  • 2 x I2C interfaces.

  • 3 x UART

  • Ethernet MAC interface with dedicated DMA and IEEE 1588 Precision Time Protocol support.

  • CAN bus 2.0.

  • Infrared remote controller (TX/RX, up to 8 channels)

  • LED PWM (up to 16 channels)

  • Hall effect sensor.

  • Ultra-low power analog pre-amplifier.

  • IEEE 802.11 standard security features are all supported, including WPA, WPA2, WPA3 (depending on version), and WAPI.

  • Flash encryption.

  • 1024-bit OTP, up to 768-bit for customers.

  • Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic curve cryptography (ECC), random number generator (RNG).

  • 5 uA deep sleep current.



Some examples of ESP32 modules to look out for:


esp32-wrover
esp32-wrover


esp32-wroom-32-front-back
esp32-wroom-32-front-back

Today, there are various development boards that utilize any of the numerous ESP32 modules as the main controller. An example is the esp32-devkitc-v4 below:


esp32-devkitc-v4-front
esp32-devkitc-v4-front

2. ESP32 programming platforms


ESP32 can be programmed using different languages, platforms, frameworks, and environments. These include:

  • Visual Studio Code using the ESP-IDE Extension.

  • Arduino IDE with the ESP32 Arduino core.

  • MicroPython - A lean implementation of Python 3 for microcontrollers.

  • Espressif Mesh Development Framework.

  • Espruino - JavaScript SDK and firmware closely emulating Node.js.

  • Lua Network/IoT toolkit for ESP-Wrover.

  • Mongoose OS - An operating system for connected products on microcontrollers; programmable with JavaScript or C.

  • mruby for the ESP32.

  • NodeMCU - Lua-based firmware.

  • Zerynth - Python for IoT and microcontrollers, including the ESP32.

  • .Net nanoFramework - a free and open-source platform that enables the writing of managed code applications for constrained embedded devices.


We will be focusing on Arduino IDE in today's post.



3. ESP32 programming with Arduino IDE


To make the ESP32 work with Arduino software, we need to install the ESP32 Arduino core. This involves adding an additional source to the Arduino IDE Board Manager and then installing the ESP32 boards.


Install ESP32 Add-on in Arduino IDE


1. Go to the menu bar on your Arduino IDE then click File. You should see a drop-down menu with different options.

Choose "Preferences"
Choose "Preferences"

2. Click on Preferences. A new window should pop up showing the Settings tab by default.


3. Copy this URL below and paste it on the textbox labeled "Additional Board Manager URLs"

https://dl.espressif.com/dl/package_esp32_index.json
Add the URL link inthe Arduino IDE for the ESP32
Add the URL link inthe Arduino IDE for the ESP32

4. Click on the OK button to save the setting.



Next, we will install the ESP boards with the following steps:


1. Go to the Arduino IDE menu bar then click on Tools. You should see a drop-down menu.


2. From the drop-down, go to where you have Boards "Arduino/Gernuino Uno" Another window should pop up showing a list of installed boards.


List of boards
List of boards

3. From the pop-up, click on "Board Manager..." at the top. 4. Another window should pop up. In the search bar on the Board Manager window, enter "esp32". 5. You should see an entry for "esp32 by Espressif Systems". Highlight this entry and click on the Install button. Your ESP32 boards should start installing (this should take a few minutes). Click Ok when done.

Click on "Install"
Click on "Install"

Testing the installation


If you head back into the Boards submenu (Tools -> Boards), you should now see a number of ESP32 boards. You'll need to select the board that matches the ESP32 board you have purchased. since we are using ESP-WROOM-32 board, we will select ESP32 Dev Module.


Select the ESP32 module board in the Arduino IDE
Select the ESP32 module board in the Arduino IDE

4. Program LED connected ESP32 board to blink.


Below is the diagram for our "LED blinking" circuit with ESP32.


Note - The ESP32 board does not perfectly fit the standard breadboard. So, you will have to fix the ESP32 on the breadboard as shown in the image below:

Circuit diagram.
Circuit diagram.

Actual circuit.
Actual circuit.


Blink LED Code

Below is a simple code for turning ON and OFF LED in Arduino IDE.



const int LED_Pin = 2;    //initialize pin to connect LED

void setup(){
    pinMode(LED_Pin, OUTPUT);    //set ledPin signal as output
}
void loop(){
    digitalWrite(LED_Pin, HIGH);   //turn ON LED
    delay(1000);                   //wait for one second
    digitalWrite(LED_Pin, LOW);    //turn OFF LED
    delay(1000);                   //wait for one second
}
    


Demo video




Alright!! this is where we take a break for today. I hope you learned something new as we got introduced to the world of the Internet of Things using ESP32.



Keep visiting this platform for more posts on ESP32 IoT and Arduino IoT projects.


Where to buy the ESP32 board


If you want to buy the board an start you coding journey with IOT, you can buy in online depending of where you live. If you live in the US, you can check the following link: ESP32 boars IOT



Other cute things to make and hand-crafts for kids


If you are looking for more cool Arduino and kids' STEM project ideas to do with your kids, take a look at these other activities:



Newsletter, follow, subscribe, and like the social media


If you like online STEM activities, consider subscribing to the newsletter and social media for updates, and don't miss any STEM events. Don't forget to subscribe to the newsletter at the bottom of our website ''www.makersgeneration.net'' for more events, tutorials, and freebies.



Subscribe to the Facebook group if you have yet registered. Content and tutorials are shared daily: Create and build STEM projects for kids



We can be reached at: contact@makersgeneration.net if any questions.



See you on soon.



Categories

Recent Posts

Archive

Search By Tags

Follow Us

Comments

Share Your ThoughtsBe the first to write a comment.
bottom of page