Jeedom, create an OLED SSD1306 remote display with ESP Easy and HTTP request

In the previous tutorial we saw how to integrate small Wi-Fi connected objects in Jeedom (retrieve data and send commands) using the ESP Easy framework for ESP8266 modules. In this tutorial, we will see how to create a small display based on an OLED SSD1306 remote display and an ESP8266 Wemos D1 Mini (or any other NodeMCU module).

Equipment used

For this tutorial, we will only use an OLED screen, but you can combine with other elements, such as a DHT22 temperature sensor, a BME280 barometer or a particle sensor in the atmosphere, Miniature air quality analyzer for example.

Last update was on: 24 June 2018 2 h 03 min

Circuit

The OLED screen connects to the I2C bus. By default, pins 4 (SDA on D2) and 5 (SCL on D1) are used. The editing is the same as the previous tutorial.

espeasy + dht22 + ssd1306 + bmp180

Configuring the OLED screen on ESP Easy

Once connected to ESP Easy, we will use the HTTP Generic protocol to communicate with Jeedom. Go to the Config page and fill in the fields according to your configuration:

  • Protocol: Choose Generic HTTP
  • Locate Controller: Choose Use IP address
  • IP Controller: Specify the IP address of the Jeedom box
  • Controller Port: Specify 8121
  • Register with submit

jeedom esp easy protocol generic

If you need to send data to Jeedom, go to the Tools page and then click Advanced. In the Publish Template field, paste

jeedom esp easy publish template

Save with submit.

Install script and weather plugins on Jeedom

For the purposes of the tutorial, I used the weather module (free) to have interesting information to display on the OLED screen.

jeedom plugin meteo

Once installed, enable it. You will need a free API key for personal (and limited) use on openweathermap.org. Once this key is recovered, go to the configuration page of the plugin and save it in the corresponding field. Save the configuration.

jeedom cle api openweathermap

Go back to the weather plugin page and add (+) a new place. OpenWeatherMap will return to Jeedom the forecasts for the city specified in the City field. You can test by completing and entering this URL in a web browser

This will give you, for example (in JSON format)

 jeedom lieu meteo

We will be able to retrieve the value of many information sent by OpenWeatherMap, but we can send the value of any other variable on the screen. Click on the gear (in expert mode) to display the list of variables available for the weather plugin.

jeedom variables disponibles affichage oled espeasy

We will use the Script plugin available for free on the Market to directly drive the OLED display.

jeedom plugin script espeasy http requete

Activate the plugin at the end of the installation and return to the plugin page.

Script to display on an OLED screen information from Jeedom

Now we’re going to be able to start things seriously. Click the + button to create a new script. Give it a name, a parent object and activate it. In the case of a display, it is desired that the content be updated regularly. It’s very simple to configure. Press it? To the right of the Auto-refresh (cron) field.

jeedom auto-actualisation

A dialog box opens. In the “To run” selection list, choose Repeat. Then choose the desired frequency from the list every (minute, hour, day, week, month, year). Validate

jeedom frequence actualisation affichage oled

Now go to the Command tab and add a new command.

How to display text on the OLED screen with ESP Easy

Before going any further, let’s see how the SSD1306 plugin from ESP Easy manages the display. ESP Easy retrieves HTTP requests (sent from a browser or a home automation server for example). The query is located after the slash (/) and starts with? Cmd =. The OLED command triggers a display on the screen. One passes in parameter the index of the column (one per character), the row and finally the text to be displayed. On the other hand we can not indicate the size of the display (if you are tempted by writing new plugins, here’s how).

To summarize, the HTTP request is of the following form:

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

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

Limitations:

  • You must first clear the screen before sending a new text (otherwise the old characters will remain)
  • The text will be displayed until the next refresh (Delay)

Other available commands:

  • Turn on the screen: http://<ESP IP address> control?cmd=oledcmd,on
  • Turn off the screen: http://<ESP IP address>/control?cmd=oledcmd,off
  • Empty the screen: http://<ESP IP address>/control?cmd=oledcmd,clear

Configuring the Jeddom script

Add a new command. We will start by creating a command that sends the clear command to clear the display. Here’s how to configure the command:

  • Name: name of the order
  • Script type: HTTP
  • Leave Info
  • Information Type: Other
  • Command: type http://192.168.1.21/control?cmd=oledcmd,clear
  • Check (optional) Back empty and No errors

jeedom script clear oled display esp easy

Then add one command per line of display. For example, we’ll start by displaying a title

jeedom script titre oled display esp easy

Then the temperature, the humidity and the forecast of the day. To retrieve the contents of a variable, it must be set to #. You can enclose the value by a string. Be careful not to exceed 15 characters in total.

jeedom script temperature oled display esp easy

Save the script. This is executed after each recording. The display of the OLED screen is updated immediately and then according to the frequency previously configured.

Here, you can now easily create small displays connected to Jeedom on which you can display what you want (weather, thermostat setpoint, power consumption …).

jeedom oled display ssd1306 esp easy wemos d1 mini

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

DIY Projects