ESP Easy: How to add OLED SSD1306 display to an IoT ESP8266 project

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp

ESP Easy is able to manage the on-screen display black and white OLED ( SSD1306, 124 × 68 pixels ) or on screen LCD 2004 (4 lines). Add a view on an Arduino project or ESP8266 requires still a bit of work. If you need to display text and that the sensors and/or actuators are supported by firmware ESP Easy, here’s how. If you have a project more complex that this firmware is not suitable, you should find everything you need in this previous article, how to add a screen OLED SSD1306 to an ESP-01. For a Arduino project, start read this post.

If you’re starting with ESP Easy, you can start by reading this overview article.

To achieve this article, I used the version R120 ESP Easy firmware.

List of components

In this tutorial, we will achieve a small barometer that measures the pressure using a BMP180 sensor and the temperature and humidity using a DHT22.

 

Circuit

Here is a boardping between Arduino and ESP8266 pins.

ComponentPinArduino PINEquivalence ESP8266 (Wemos D1 mini)
DHT22VDC5V5V
GNDGNDG
DataGPIO-14G5
BMP180VDC5V5V
GND‘ GNDG
SDAGPIO-4D2
SCKGPIO-5D1
OLED SSD1306 0.96 “VDC5V5V
GNDGNDG
SDAGPIO-4D2
SCKGPIO-5[] D1
Led WiFi activityPole +GPIO-12D6
Pole-GNDG

espeasy + dht22 + ssd1306 + bmp180

 

Once the wiring is done

esp easy ssd1306 oled display bmp180

 

Configuring ESP8266 with ESP Easy

Find I2C addresses of the accessories

Before going further Let’s start by retrieving each accessories I2C addresses. For it go to the Tools page and then click on I2C Scan . You should get something like this:

 

espeasy ssd1306 oled bmp180 i2c scan

The screen is well identified as a screen OLED SSD1306 0x3c address. The BMP180 has been identified as a BMP085 (normal, it’s his successor). It is located at address 0 x 77. The Firmware ESP Easy is able to find him even the address of many Devices on the I2C bus. There is for the OLED display to help him.

Add the Device BMP180 (or BME280)

The BMP180 digital Barometer measures atmospheric pressure (from 300 to 1100 hPa) and temperature (-50 ° C to + 85 ° C). If you also want to recover the moisture level, opt for a BME280. The advantage of the BME280 is an easier integration in Domoticz. In the list select Temperature & Pressure – BMP085 and

  • Name : give a name to the device. Short, years space if you have to use in a Rule
  • Delay : the measure refresh time-out. Watch for projects on battery consumption.
  • IDX / Var : ID of the Domoticz device. 0 in all cases
  • Send Data : active sending data on a server or an online service
  • Value Name 1 : the name of the variable containing the temperature measurement. You can use it in a Rule
  • Value Name 2 : Ditto for the atmospheric pressure
  • you can also do a unit in the field conversion Formula (attention only with operators + – *, %value% contains the measure)
  • Finally choose the number of digits after the decimal point (Decimals)

 

espeasy configuration bmp180 bmp085

Add the DHT22 Device

with no BME280 to my available, so I added a DHT22 to collect the moisture. In the list, choose Temperature & Humidity – DHT then

  • Name : give a name to the device
  • Delay : the frequency of measurement
  • IDX / Var : ID different from 0 or one of the virtual instrument in Domoticz
  • 1 st GPIO : pin on which we get the measures sent by DHT
  • DHT Type : DHT11 (blue) or DHT22 (white)
  • Send Data : active sending data to the server or online
  • for the rest, it is the same as before.

 

espeasy dht22 configuration

Add and configure the Device display OLED SSD1306

Add a new Device. Select from the list Display – OLED SSD1306.

  • Name : give a name to the Device, e.g. AffichageOLED
  • Delay : display refresh rate in seconds
  • IDX / Var : ID different from 0
  • IC2 Address : the screen on the I2C bus address. Here 3 c
  • Rotation: allows to reverse the screen display.
  • display button : allows you to call the screen for a term Display Timeout by pressing a button connected to a the ESP8266 GPIO. Except error on my part, this function does not work well in the R120.

There is to indicate the content for each line. In the version R120, ESP Easy manages display 8 lines.

You can write any text in the limit of 16 characters per line.

You can retrieve and display system information:

  • %systime%: hour system. If you checked Use NTP, the ESP8266 is set to from the internet automatically at startup time.
  • %ip%: ip address of the module
  • %uptime%: uptime since boot

Finally we can retrieve the value of a variable of any Device like this [NameDuDevice#NameValueX] .Iin the present case, to display the humidity measured by the DHT22, will be [DHT22#HumDHT22].

Remarks

  • the call of the variables is not case sensitive, we can write [dht22#humdtht22]
  • it is not possible to display some special characters, for example: ° ‘ €, and accented characters.

 

espeasy oled ssd1306 wemos d1 mini

Here is the result.

 

esp easy ssd1306 oled display bmp180

Show information remotely on the screen

Another very interesting function is the possibility to order or view the text using a simple HTTP request. We could for example retrieve weather on an online service and display it on the screen from a home automation, a Mode-Red script server…

The HTTP request is of the following form:

http://<ESP IP address>/control?cmd=oled,<row>,<col>,<text>

where

  • row: display line
  • col : display column
  • text : text to display

Limitations:

  • it must first clear the screen ( clear ) before sending a new text
  • text will be displayed until the next refresh ( Delay )

Other commands available:

  • turn on the screen: http:// /control? cmd = oledcmd, we
  • turn off the screen: http:// /control? cmd = oledcmd, off
  • clear the screen: http:// /control? cmd = oledcmd, clear

 

Original article source: http://www.esp8266.nu/index.php/OLEDDisplay

Click to rate this post!
[Total: 0 Average: 0]

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
Ask your question

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email
Share on whatsapp

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

8 Comments on post "ESP Easy: How to add OLED SSD1306 display to an IoT ESP8266 project"
  1. Thank you for your tutorial.
    I checked NTP but it still shows uptime instead of NTP time!

  2. I want to display my weather data from Thingspeak on a other esp8266 with OLED.
    I found out, that
    https://thingspeak.com/channels/123456/field/1/last.html
    Display the value I need (Temp) in my Browser, but how I have to type it in e.g. Line 1 that I get the value displayed?

  3. How can I add and use APDS9960

  4. Hello and thank you for the tutorial. I use an OLE bi-color ER-OLEDM0.96-1YB. I chose in OLED list SSD 1306 Framed and in I2C it is recognized in 0x3c, I have yellow and blue dots in display! If I run a command Off / On it works but for a message ….. only dots …… An idea?

    Leave a Reply

    DIY Projects
    %d bloggers like this: