Programming LOLIN D32 Pro ESP32 board using Arduino

We are going to see a board which definitely is not a newcomer of the year, but it has certainly become a hot cake of the ESP32 boards. Yes, we are speaking about the LOLIN D32 Pro V2.0.0 WiFi.

For the last couple of years the IoT trend has been going up and high and one important player to keep the buzz going, is the company behind ESP8266 and ESP32. Clearly there is no other chip at the moment which offers the rich features as much as products of Espressif. Credits to the open source community who build open source SDK, flashing tool, Arduino support and the hardware designers who drop in a new model of board every month if not every week. 

Technical Specifications:

Microcontroller ESP-32
Board Power Supply(USB) 5V
Supported Batteries Lipo battery 3.7V
Operating Voltage 3.3V
Digital I/O pins 22
Analog Input Pins 6(VP,VN,32,33,34,35)
Analog Output Pins 2(25,26)
LED_BUILTIN 5
Clock Speed (Max) 240MHz
Flash 4M bytes
Length 65mm
Width 25.4mm
Weight 7.5g
Battery Connection PH-2 2.0mm

Features: 

  • Espressif official ESP32-WROVER module
  • Latest ESP32 Version: REV1
  • 4MB FLASH
  • 4MB PSRAM
  • Lithium battery interface, 500mA Max charging current
  • LOLIN I2C port
  • LOLIN TFT port
  • TF (Micro SD) Card slot, support SPI mode.
  • Compatible with Arduino, MicroPython
  • Default firmware: latest MicroPython

LOLIN D32 Pro V2:

LOLIN D32 back view
LOLIN D32 front view

We are going to see in this  post where to get this board, how to get started with LOLIN d32 pro with Arduino, How to use the interface such as SDCard, Display, Analog, digital, SPI lot more.

Where to buy:

Affiliate links

Amazon US: https://amzn.to/2LThcaX

Amazon Germany (without TFT) : https://amzn.to/32Z46ON

Banggood (without TFT): Click here

Description:

The Wemos LOLIN D32 development board boasts of 4MB memory with Wifi and Bluetooth. Unlike its predecessors, this Wemos.cc developed card is narrower, which enables space for a row of connectors on each side of the board. 

Programming and charging of the battery both are  done by a micro USB connector. Additionally, this board offers rich interfaces such as TFT display port, I/O’s via breadboard compatible headers, a micro SD card slot and an I2C header.  

The LOLIN D32 comes with a standard MicroPython firmware and is also compatible with Arduino and supports other alternative firmware. The CH340 USB to serial converter enables easy programming and debugging

Schematics:

The schematic of the LOLIN D32 board is available here for reference.

https://wiki.wemos.cc/_media/products:d32:sch_d32_pro_v2.0.0.pdf

Arduino Setup:

Setting up ESP32 support for Arduino is provided below for all the supported operating system.

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/windows.md

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/debian_ubuntu.md

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/fedora.md

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/mac.md

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/opensuse.md

Hello World Blink on board LED:

Code:

The board has an inbuilt LED which is connected to the GPIO pin 5, the definition LED_BUILTIN has the default value of the built in led of any Arduino supported board.

Output:

How to use SD Card:

The d32 pro features a SD card slot on the side of the board, You can connect only microSD card to that slot. The SD card is connected to the SPI interface of the microcontroller. Just for the info, that SD card has two types of interface SDIO and SPI interface. All the high speed specifications mentioned in the card such as 100 mb/s or 200 mb/s can only be achieved using the SDIO. The SPI interface is relatively slow.  The SPI uses 1 wire for data transfer while the SDIO uses 4 wire and it gets a 4 bit higher performance. 

The ESP32 does have hardware support for SDIO as well, but in this board the SD card pins are connected to SPI interface. 

Schematics:

From the above schematics, we can derive that the SPI pins MISO, MOSI, CLK and CS are pin number 19, 23, 18 and 4 respectively. So we need to configure these pins as our SPI interface when we use the SD card library of the Arduino.

Code:

The below code will configure the SPI with the pins as per schematics and print the size of the sdcard in  the serial terminal.

Output:

SD Card Size; 7982MB

 

Some applications using sd card :

There are plenty of usage in the IOT  area for this interface such as data logging of temperature, humidity and other sensor data. It would be also interesting to run a small web server using the SD card to store web pages,images, JavaScript that will be returned to the client requests.

We can also use sd card with micro python to store scripts and run it in the micro-controller.  One of the interesting project was running the game DOOM  in ESP 32 where the WAD files were stored in SD card and loaded on run time.

Other usage includes updating the ESP 32 firmware stored in the SD card. This can be an alternative to USB cable or Wifi.

That is all for this post and in the further post we will see how to use the I2C interface, how to create Bluetooth MIDI connection with  smartphone, using  Wifi and connecting to Mqtt, setup Micro python and getting started with it, how to use the TFT Display etc.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *