The Incredible ESP32 Wrover From Espressif
by Fernando Koyanagi in Circuits > Microcontrollers
47575 Views, 5 Favorites, 0 Comments
The Incredible ESP32 Wrover From Espressif
Today, I'm going to introduce you to the ESP32 Wrover Kit, which is model that is different than the ESP32 I usually use (the Wroom). Wrover is a development board that has many features and is quite peripheral. I will show you an example of a program with the ESP32 Wrover Kit that involves writing on the display and SD Card, as well as images.
Introduction
The ESP32-Wrover-Kit has many features beyond the ESP32 module. In this kit, we have a built-in 3.2"LCD display, a high-speed Micro-SD card interface, and a VGA camera interface. The I / O pins were removed from the ESP32 module for easy extension.
The board also has an advanced multiprotocol USB bridge (FTDI FT2232HL), which allows developers to use JTAG directly to debug the ESP32 via the USB interface.
Key Features
• 240 MHz Dual Core CPU
• 4MB SPI PSRAM (static pseudo ram)
• Built-in USB-JTAG debugger
• LCD display SPI 3.2”
• Micro-SD card interface
• VGA camera interface
• Expansion of I / Os
https://www.espressif.com/en/products/hardware/esp-wrover-kit/overview
Here, em second image, I outline the features of this module.
Demonstration
ESP32 Wrover
Library
Download the WROVER_KIT_LCD
library to access the LCD display.
The download can be done through the link:
https://github.com/espressif/WROVER_KIT_LCD/archive/master.zip
Unzip inside the folder ../Documents/Arduino/libraries/
Upload
To upload a program to the board, we must choose the Adafruit ESP32 Feather board.
Program
You can use the examples from the WROVER_KIT_LCD library to test the board. For teaching purposes, we will compile the three examples. This will involve writing / drawing on the screen and SD card.
Libraries and Variables
We’ll then include the libraries. Two: esp_wp1.h and esp_wp2.h, which are vectors, and I left the download links right here and at the end of this article. We instantiate the object responsible for the control of the display and perform a screen control function.
#include "SPI.h"
#include "Adafruit_GFX.h" #include "WROVER_KIT_LCD.h" //lib de controle do display #include <SD_MMC.h> //lib de controle do micro-SD #include "esp_wp1.h" //imagem em HEX #include "esp_wp2.h" //imagem em HEX WROVER_KIT_LCD tft; //objeto responsável pelo controle do display int screen = 0; //controle de tela
Setup
Initialize the display and paint the entire screen with the desired color.
void setup() {
Serial.begin(115200); tft.begin(); //inicializa o display } //pinta toda a tela com a cor desejada void clearScreen(int color) { tft.fillScreen(color); //pinta toda a tela }
Loop
We rotate the canvas to landscape, which will change according to the control variable. So if I opt for switch case 0, the text will be written on the screen. In the example of switch case 1, we print files from SD images and HEX images from files (#include).
void loop(void) {
tft.setRotation(1); //rotaciona para landscape //muda a tela de acordo com a variável de controle (screen) switch(screen) { case 0: writeText(); //escreve textos de diferentes na tela break; case 1: writeImages(); //printa arquivos de imagens do SD e imagens HEX dos arquivos (#include) break; default: screen = -1; break; //volta pra tela inicial } screen++; }
writeText ()
Detailing this part of the code, we deal with the painting of the screen and cursor positioning in the origin and size of the source.
//escreve textos de diferentes na tela
void writeText() { clearScreen(WROVER_BLACK); //pinta toda a tela tft.setCursor(0, 0); //posiciona o cursor na origem tft.setTextColor(WROVER_WHITE); tft.setTextSize(1); //tamanho da fonte - 1 tft.println("Testando ESP32-WROVER-KIT"); tft.println(); tft.setTextColor(WROVER_YELLOW); tft.setTextSize(2); //tamanho da fonte - 2 tft.println("Youtube | Instagram |"); tft.println("Telegram | Facebook |"); tft.println("Forum"); tft.println(); tft.setTextColor(WROVER_RED); tft.setTextSize(3); //tamanho da fonte - 3 tft.println("Acesse:"); tft.println(); tft.setTextColor(WROVER_GREENYELLOW); tft.setTextSize(4); //tamanho da fonte - 4 tft.println("FERNANDOK.COM"); delay(2000); }
writeImages ()
In this function, we initialize the SD card and write the two jpg files and two images in HEX.
//printa arquivos de imagens do SD e imagens HEX dos arquivos (#include)
void writeImages() { clearScreen(WROVER_WHITE); //inicializa o cartão SD card Serial.print("Initializing SD card..."); if (!SD_MMC.begin()) { Serial.println("failed!"); return; } Serial.println("OK!"); tft.drawJpgFile(SD_MMC, "/fk_logo.jpg", 50, 50); //escreve um arquivo jpg do SD delay(2000); clearScreen(WROVER_WHITE); tft.drawJpgFile(SD_MMC, "/arduino_ide_logo.jpg", 60, 20); //escreve um arquivo jpg do SD delay(2000); tft.setRotation(0); tft.drawJpg(esp_wp1_jpg, esp_wp1_jpg_len); //escreve uma imagem escrita em HEX delay(2000); tft.drawJpg(esp_wp2_jpg, esp_wp2_jpg_len); //escreve uma imagem escrita em HEX delay(2000); }