Test of shield for Wemos D1 Mini (SSD1306 64 × 48 pixels) OLED: ESP Easy and Adafruit_SSD1306 [Exclusive Guide]

12:25 pm April 5, 201710551

today ‘ today, I propose to test the shield OLED to Wemos D1 Mini . This shield is equipped with a 64 x 48 pixels OLED display. It uses the microcontroller SSD1306 usual already presented several articles in . It is an ideal small screen to add a thumbnail view to the Wemos D1 Mini. It is very easily found on-line from China less than €5 .

I was surprised by the quality of the packaging. The display comes in a small transparent box. The shield comes with the usual spindle set of 3 dimensions. The OLED screen is directly soldered onto the PCB. The manufacturing quality is impeccable. Small small weak point to noted, however, the screen is held in place by a self-adhesive foam. The screen can be rotated slightly. It may be positioned at the time of the collage, or foam deforms during storage. It’s very embarrassing, just peel it off gently and reposition it correctly

shield wemos d1 mini oled display 64x48 pixels

the screen uses the I2C-bus to communicate with the Wemos. The screen can be used to address 0x3C (or 0x3D)

the Adafruit_SSD1306 library is quite simple and very powerful. It allows to draw simple shapes, write text, display a bitmap, write text and make small animations (scrolling…). This screen resolution is is not supported directly by this library. Mike cause made an adaptation of the bookstore. It is available on Github here . MC caused also made an adaptation of the Adraduit demo program here .

If you develop other projects using the official Adafruit_SSD1306 Bookstore, the best thing to do is to add the 2 files edited directly in your project. Download the zip from Github. After unpacking, place 2 files Adafruit_SSD1306.cpp and Adafruit_SSD1306.h in your project directory. Close and reload the project to take into account the 2 bookstores

to learn more about this library, read article

to change the declaration of the library at the beginning of program to call the local bookstore. This is especially the case if you already use the official bookstore Adafruit for other projects.

becomes

Attention, if the library is not placed in the same directory as the program Arduino It will also show the way. 

The amendment simply takes into account the resolution of the OLED of the shield. Programming remains exactly the same. Here is a small example of (minimum) code that displays a “Hello World” on the first line of the display.

To test the screen, this is a small quick mount that allows to measure then display temperature and humidity measured using the DHT22 shield. The Shield Wemos DHT22 for already been presented in this test. You can make this small autonomous temperature sensor by running on battery power through the LiPo Shield that will be next test.

Code of the program

this small program retrieves so measuring temperature (in Celsius) and humidity.

S.h.i.e.l.d. OLED display up to 6 lines of text. With the Adafruit_SSD1306 Bookstore, there are 10 characters with size 1.

shield wemos dht22 oled display 64x48pixels battery lipo arduino code
From bottom to top: Wemos D1 Mini, Shield LiPo, Shield DHT22 Shield OLED

the Wemos shield is only supported from version R147 ESP Easy RC8. Click link to download or go to the website of letscontrolit.com get a newer version. Install the ESP Easy firmware as usual.

Run a scan of the I2C bus for the address of the screen.

shield oled wemos d1 mini espeasy 64x48 scan bus i2c

Create a device for the DHT22. Compared with the version R120, the pins have a double tracking. The Arduino GPIOx tracking as well as the correspondence of ESP8266 (Dx). On the DHT, the DHT22 (or DHT11) shield is welded on the D4 PIN. Configure the parameters like this:

  • Delay : select a refresh rate. Here 1 second
  • IDX : a different number of 0
  • GPIO : the DHT22 is connected to the D4
  • Type: choose your model (DHT11, DHT21 or DHT22)
  • save with submit

shield oled wemos d1 mini espeasy dht22 shield

Add a new device for the OLED display and configure so

  • Delay : 1 second for example
  • I2C : choose the I2C address is on the screen
  • Rotation: If you have only 4 lines to display, you can change orientation. The 147 RC8 version for a bug that does not display the last 2 lines
  • Display Size : choose 64 × 48
  • Line : we call the value of a probe in square brackets. For example to display the temperature that is returned by the DHT22 device, we’ll do [DHT22#temperature]. The case is not taken into account.
  • Save with submit

other comments:

  • the code for a second bug. The last line is full on the first line (or more)
  • each line cannot contain more than 8 characters. It is less than with the Adafruit_SSD1306 library

shield oled wemos d1 mini esp easy

and here is the resulting display

shield wemos dht22 oled display 64x48pixels battery lipo esp easy r147

Wemos our offers so here a Shield of good quality which comes piled on top of other Shields. The resolution is a bit restrictive but usual bookstores have been adapted and can be programmed quite simply a display.