DIY Projects

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

Best deal at: banggood.com
CHF 4.99

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: 22 June 2021 3 h 09 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.

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:

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

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.

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

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

http://api.openweatherboard.org/data/2.5/weather?q=paris,fr&appid=API_KEY

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

{
 "coord": {
 "lon": 2.35,
 "lat": 48.85
 },
 "weather": [{
 "id": 701,
 "main": "Mist",
 "description": "mist",
 "icon": "50d"
 }, {
 "id": 741,
 "main": "Fog",
 "description": "fog",
 "icon": "50d"
 }],
 "base": "stations",
 "main": {
 "temp": 273.48,
 "pressure": 1029,
 "humidity": 98,
 "temp_min": 272.15,
 "temp_max": 274.15
 },
 "visibility": 4000,
 "wind": {
 "speed": 2.6,
 "deg": 240
 },
 "clouds": {
 "all": 90
 },
 "dt": 1483457400,
 "sys": {
 "type": 1,
 "id": 5615,
 "message": 0.005,
 "country": "FR",
 "sunrise": 1483429423,
 "sunset": 1483459649
 },
 "id": 2988507,
 "name": "Paris",
 "cod": 200
}

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.

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

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.

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

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>

Limitations:

Other available commands:

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:

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

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.

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 …).

Click to rate this post!
[Total: 1 Average: 5]
Exit mobile version