0,66" Display Shield am ESP32 D1 Mini und D1 Mini ESP8266


You may already have experience with the D1 Mini NodeMCU ESP8266 or the ESP32 DevKits. In this post I would like to show you another development board that looks like they have given birth to a child. This is the ESP32 D1 Mini development Board. I would like to compare them a little and test whether the 0.66 OLED Shield is compatible with both Minis. At the end, I will show you a program with which you can view an existing Bluetooth or Wi - Fi connection that updates when one connection changes. Let's go.

What we need

Number Component Note
1 ESP32 D1 Mini NodeMCU
1 D1 Mini NodeMCU 8266
1 0.66 " OLED Display Shield
PC with Arduino IDE and internet connection
Soldering iron (for the Pinheaders)

Twice D1 Mini

The following picture shows the direct comparison of the two Boards (view from below). I've highlighted the ESP32 pin designation for you a bit to show how to understand the labeling:


I also wrote the Pin functions for it. The white Pin-rows of the ESP32 fit to the Pins of the ESP8266. The interfaces, SPI and I2C are two Boards on the same Pins, even if they are named differently. The power supply and Reset Pin are also in the same position. Thus, Shields should fit the ESP32 as well as the ESP8266 Mini Board. Provided that you set the GPIO numbers for the corresponding libraries yourself if necessary.

The 0.66 " I2C OLED Shield

The 0.66 " OLED Display Shield with I2C interface has a resolution of 64 x 48 pixels. It works with the SSD1306 Chip and can be piggybacked on the D1 Mini. Since it is now clear that the Pins of the I2C interface are in the same position on both Boards, it should work the same way there. We can test this by installing the U8g2 library via library management.

ESP32 and ESP8266

We now have to solder the pin headers to the Boards. If you want to connect other components such as sensors, buttons or LEDs in addition to the Display, you should use female headers with long legs (so-called Stacking headers). So you can put the Display on the Board, and then both on a Breadboard. All Pins on the ESP8266 are occupied. Here we can see the first advantage of the ESP32 D1 Mini, because in addition to these pins on each side, there are two more pin rows.

Important!: To use the ESP32 Mini on a Breadboard, the headers may only be soldered down either on the inner or outer rows. Male or female headers can then be soldered to the other rows.

I attached the female headers with long legs to the ESP8266 to attach the Display and use it on a Breadboard. On the ESP32 I have attached only female headers at the top. I can then use the Pins of the inner rows (also I2C and SPI) only for the Display. One sees here, however, the advantage that other GPIOs are available next to it. You could here, just like with the ESP8266, female headers with long legs for the inner Use PIN rows. This all depends on how you want to use the components.

Note: when attaching the display, make sure that the pin labels are on the right side. I have oriented myself to Pins TX and RST.

These additional sources for the board administrator should be entered in the preferences:




Both with a comma separated in a row. If not already done, you need to install the appropriate libraries via Tools -> Board -> board administrator. You are looking for ESP8266 and ESP32 and install them. After installation, select either the D1 Mini under the ESP8266 Boards, or the ESP32 Dev Module under ESP Arduino.

It is possible that you first need to install the USB drivers for the Boards in order for them to be recognized in your operating system. The Windows installation for the CP2104 and is used on the ESP32 D1 Mini, you will find here. For the D1 Mini ESP8266 you need the Windows driver for the Ch340 Chip. You will find this here. If everything works, you should see a COM Port under Tools -> Port. You may need to select it again separately.

Display test

If you have installed the U8g2 Library, see the examples below full_buffer the Sketch "HelloWorld". When you open it, you still have to enter the appropriate line for the display:

U8G2_SSD1306_64X48_ER_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

If the display is on the Board, it is selected in the Arduino IDE and the correct port is selected, then you can upload the sample program to the ESP. When everything works well you will probably see a cut off "Hello World!".

Since this Display is slightly smaller, either a smaller font must be chosen, or we write the second word in the second line:

void loop(void) {
u8g2.clearBuffer (); / / clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr (0,10, "Hello"); / / write something to the internal memory
u8g2.drawStr (0,30, " world!"); / / write something to the internal memory
u8g2.sendBuffer (); / / transfer internal memory to the display
delay (1000);

I then put the Display on the other ESP, selected the appropriate Board and uploaded the same program again. That worked perfectly:

The Display Shield is therefore compatible with both D1 Mini. Without Breadboard I can now connect more components to the ESP32,because there are still free pins on both sides.

Similarities and differences

On the outside, we have already seen the differences. The ESP32 D1 Mini has more pins, which are also named differently. It is therefore a little wider. On the ESP32 Board, the pins are arranged so that the interfaces and the power supply are located at the same positions, as the ESP8266. So should then fit all Shields for both variants.

Let's have a look at the inner values. The Tensilica l106-32Bit CPU of the ESP8266MOD-F12 SoC clocks with a maximum of 160MHz on a processor core. There is a WiFi Chip included that supports specifications B, g and N. 4MB flash memory is also included. The ESP32-WROOM-32, on the other hand, clocks with two CPU cores up to a maximum of 240MHz.

However, the second core is responsible for Wifi and should therefore only be used conditionally for multiprocessor applications. At least, if you use the network connection. In addition to the slightly faster Wifi b/g/n Chip, there is also a Bluetooth 4.2 module that supports BLE and normal mode. I did not measure the power consumption.

The ESP32 actually has its advantages. Especially its compact design, which is even smaller than that of the other DevKits, but has the same characteristics:

(v. l. n. r: ESP32 Devit C V4, ESP32 NodeMCU, ESP32 D1 Mini NodeMCU)

Many details about the D1 Mini ESP8266 can also be found in the Manual or in the free E-Book. Information on the ESP32 D1 Mini NodeMCU can be found on the AZ-Delivery Shopsite.

Finally, a practical example

Depending on which of the Mini-Boards we use, we have the possibility to use Bluetooth In addition to the Wifi connection. So let's say we have a project in planning for which we need one of the small development boards. We have both available and want to use the Display Shield, no matter which Board we choose. The Display should show whether there is a Wifi or Bluetooth connection. This should be represented by two icons.

If one of the connections breaks or is re-established, the corresponding image should either be displayed or not displayed. When setting up the Wifi connection, the Logo should be animated. Since the ESP8266 does not have a Bluetooth onboard, we have to make sure that this is displayed on the OLED.

I have written a small program for this. It distinguishes between ESP32 and ESP8266. It can also be used for the larger Boards. It is not limited to the Minis. However, AVR Boards (Arduino Uno, Nano, Mega, etc.) are excluded because the memory is not sufficient and there is no Wifi or Bluetooth.

The program sequence provides for the WiFi, Bluetooth (if ESP32) and the Display to be initialized. I created several images as icons and changed them to XBM format. If you want to create your own images, you can do so with the export function of the free graphics program GIMP. I have this website used and exported my created PNGs to XBM. For the Wifi Logo, I created three images that I declared in the Arduino Sketch as an Array of Bitmap Arrays.

This allows me to run over it with a loop. This allows an animation of the WiFi logo with shorter source code. For the Bluetooth logo, I created two separate Bitmap Arrays. Once the BT logo and once with the note "no BT", if there is no Bluetooth onboard.

If the ESP32 Dev Module is selected under the Tools menu of the Arduino IDE, you will find Bluetooth serial in the examples menu . The example SerialToSerialBT serves as a source code template to exchange data between PC and ESP32. On the smartphone, you can install the "Serial Bluetooth Terminal" app. We can then send chat messages between smartphone and PC.

We still need to add a way to detect if the Bluetooth partner is connected or not. I found a solution to this on this website, which I integrated into the BluetoothSerial example. To do this, a callback function is implemented:

void callback (esp_spp_cb_event_t event, esp_spp_cb_param_t * param) {
  if(event == ESP_SPP_SRV_OPEN_EVT) {
Serial.println ("Client Connected");
  if(event == ESP_SPP_CLOSE_EVT) {
Serial.println ("Client disconnected");

in the setup () is initialised:

SerialBT.register_callback (callback);

This then works like an Interrupt Service Routine (ISR). Since there should only be very little program code there, I will only change a variable there. All related commands are carried out outside.

For the display on the display, I used the examples of the U8G2 library as sources. For the Wifi connection, there are also examples.

You can download the finished sketch here: Download of the finished program

I changed the initialization of the Wifi connection from void setup () to void loop (). It is necessary to distinguish whether the program was started for  the first time and Wifi was initialized. Or whether the Wifi connection already existed and a reconnect is executed. The initialization and animation of the logo on the display are not-blocking code.

We display two logos. If one of the connections is established or broken, only that part on the display should be changed. There is an example of how to updateDisplayArea()function. But it didn't work in my case. Possibly because I use bitmaps instead of text and geometric figures. So I had to expand the source code. It may seem a little confusing. Each time you display one of the logos, you have to ask if the other one has to be displayed.

Don't forget to enter your Wi-Fi data in the upper part of the source code before compiling and uploading the sketch.

Download the program to the ESP32 D1 Mini and then open the Serial Monitor. If you have not entered any correct Wi-Fi data, the program will permanently attempt to establish the connection. However, the Bluetooth connection is not blocked. So we can connect the BT to the device "ESP32test" on the smartphone. Then we open the Serial Bluetooth terminal and connect to the ESP32.

On the PC in the Serial Monitor, we should get a hint for the successful connection and the OLED should display the Bluetooth logo.

If we disconnect, the logo should disappear again. We can now exchange text messages. Either write something on the PC in the input of the Serial Monitor, or in the text input of the Serial Bluetooth terminal. The ESP32 will continue to attempt to establish the Wifi connection. If you have entered correct Wi-Fi data, the Wifi logo will be displayed permanently.

If you upload the same program onto the ESP8266, the note "no BT" should be permanently displayed on the right side of the display. The replacement via Bluetooth is then not possible due to the missing Bluetooth module.

Of course, you can retrofit missing Wifi and Bluetooth modules externally. However, I am only referring to the onboard variants. I only connected to the Wi-Fi network, but i did not exchange any more data. Take a look at the Wifi examples.

You can now view and update the state of the Wifi and Bluetooth connection on the display. It is possible to exchange sensor data with other devices over the two connections. Where the OLED shows you whether or not you have the right connection.

If you have other shields for the D1 Mini ESP8266, you should also be able to use them on the ESP32 D1 Mini. Make sure that the pin assignment is correct for other pins than the fixed pins for the SPI or I2C interface.

Have fun crafting.

Andreas Wolter

for AZ-Delivery Blog


DisplaysEsp-32Esp-8266Projects for beginners


Peter von Deparade

Peter von Deparade

Befasse mich erst seit kurzem mit dem Arduino aus Interesse und finde diesen Beitrag sehr hilfreich für die nächsten Experimente. Super

Nils Sappok

Nils Sappok

Da ich noch sehr neu an der Sache bin, die Bauteile von letztem Jahr jedoch schon staub sammeln, vielen Dank für diesen Blog!
An das OLED hatte ich mich noch nicht getraut.
Ich habe es erst mal mit dem LCD versucht, da ein CO2-Sensor für meine Frau und meine Tochter als Lehrer sinnvoll ist:

Ich weiß, dass ich noch so gut wie keine Ahnung habe, aber es hat sehr viel Spass gemacht und auch definitiv Lust auf mehr!
Das CO2-Messgerät mit einem OLED wäre natürlich noch viel cooler und dann noch mit Web-Server-Historie….
Es gibt soooo viele coole Sachen und Möglichkeiten….
….und Ihr macht’s möglich!

Viele Grüße aus Heidelberg,
weiter so und bleibt gesund,

Claus Kühnel

Claus Kühnel

Toller Beitrag mit grundlegenden Funktionen, die angepasst wieder in eigene Programme übernommen werden können.

Peter Stauffert

Peter Stauffert

Das Battery Shield für D1 Mini funktioniert auch problemlos mit dem ESP32 D1 Mini, damit kann man einen ESP32 D1 Mini auch mit einem LiPo betreiben. Da bei dem Battery Shield auch alle Pins durchgeschleift werden, kann man es auch zwischen den ESP32 D1 Mini und das OLED Display stecken

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN