ESP8266-01 server, programmed in Arduino-C, + I2C oled to display text-messages of upto 128 characters that are typed in a browser.

Similar projects worth following
Based on the ideas and work of others, I created this small software project.
It was a challenge to use the Arduino IDE with a ESP8266-01 and a I2C Oled display.

While working with a ESP8266 WiFi module it was a drag using the AT commands. The alternative, using LUA was a step forward but it was the lack of time to get enough knowledge of LUA that I could use it in the same way as I use the C language.
So I was very happy to find the ESP8266-Arduino IDE . Now the ESP-module can easily be used without Arduino board.

But a lot of libraries do not compile in the ESP-IDE. Using the fmalpartida lib for I2C-LCD was a no-go. Also all the libraries for oled's I tested gave errors. (ADAFruit-SSD1306 and U8glib). But the Oled-functions found in Mike Rankin,s project do compile. (Apparently he extracted the functions from the AdafruitSSD1306 library). This sketch gave me the idea to make this project.

The sketch can be found on github :

  • SDD1306 and SH1106 Oled controllers

    co sto06/12/2015 at 15:00 0 comments

    Initially my sketch only worked for oled's with a SDD1306 controller, which are found in most of the tiny 0.96 inch blue or white I2C Oleds.

    I have changed it so that Oled's with a SH1106 controller can also be used. The SH1106 is much like the SSD1306 , the main difference is the memory map which is 128*64 for the SSD1306 and is 132*64 for the SH1106 controller resulting often in a small white or noisy sideband of pixels. The 1.3 inch SPI/I2C Oled I have has 2 solderable jumpers by which the display can be set for 3SPI, 4SPI or I2C. To work with the ESP I changed the jumpers for I2C (S1=0 S2=1)

    The difference in the sketch is that the clear function has to clear 8x132 bytes vs. 8*128 bytes. Also the setXY() function needs an lower colom adress offset of 0x02. The right offset value has to enabled in the declaration_part of the ESP_Messenger_v1.0 file

View project log

  • 1
    Step 1

    Install the ESP8266 add-on into your Arduino IDE.

  • 2
    Step 2

    How to upload a sketch to the ESP:


    pin1 - to ground

    pin 2 UartTXD - to RX of USB/Serialadapter

    pin 3 GPIO2 - SCL of I2C

    pin 4 Chip-Enable - to Vcc = 3.3Volt

    pin 5 GPIO0 - SDA of I2C (connect to groung for programming)

    pin 6 Ext. Reset - with resistor of 10kohm to 3.3V. (ground pin-6 for a short moment to reset ESP)

    pin 7 - UartRXD - to TX of USB/Serial adapter.

    pin 8 - to Vcc = 3.3Volt

    Connect TX & RX of ESP to RX & TX of the USB-Serial adapter. (cross-connected)

    Connect pin 5 (GPIO0) to ground and power-up or reset the ESP so it comes in upload-mode.

    In IDE tools select 'Generic ESP8266 Module' as board.

    set uploadspeed to 115200.

    choose the active USB port.

    leave the other settings as they are.

    Now it is possible to upload the sketch with the Arduino-IDE into the ESP8266.

    The sketch is on github:

  • 3
    Step 3

    Ofcourse you have to specify your own WiFi SSID and Password in the sketch before you upload it.

    On startup you will see the SSID and the local-IP of the ESP which can be used to send messages. Open a browser and type this local-IP, a simple webpage opens where you can submit a message of up to 128 characters.

    Connect the Oled SCL to GPIO2, Oled SDA to GPIO0.

    Be sure you have a original I2C Oled with a SSD1306 controller. Other controllers may not work.

    Up from version 1.0 it works also for OLED's with SH1106 controllers.

View all 3 instructions

Enjoy this project?



felice.ferrazza wrote 11/15/2016 at 10:55 point

HI co sto,

When I try to compile I get all kinds of errors like:
ESP_Messenger_v1.0.ino: In function 'void handle_msg()':

ESP_Messenger_v1.0:31: error: 'clear_display' was not declared in this scope

   clear_display();                        // clears oled

ESP_Messenger_v1.0:67: error: 'sendCharXY' was not declared in this scope
            if (i<16)  {sendCharXY(c,0,i);}
ESP_Messenger_v1.0:68: error: 'sendCharXY' was not declared in this scope
       else if (i<32)  {sendCharXY(c,1,i-16);}



ESP_Messenger_v1.0.ino: In function 'void setup()':
ESP_Messenger_v1.0:84: error: 'init_OLED' was not declared in this scope
   init_OLED();                                    //
ESP_Messenger_v1.0:85: error: 'reset_display' was not declared in this scope
ESP_Messenger_v1.0:97: error: 'clear_display' was not declared in this scope
and ..

ESP_Messenger_v1.0.ino: In function 'void reset_display()':
ESP_Messenger_v1.0:128: error: 'displayOff' was not declared in this scope
ESP_Messenger_v1.0:129: error: 'clear_display' was not declared in this scope
ESP_Messenger_v1.0:130: error: 'displayOn' was not declared in this scope

What is wrong?
Do you may be kind enough to help me and tell me how you did it?
I must included other libraries?
Also, you may share your running sketch?
Thanks if you could help me.
Mr Felice, from Italy

  Are you sure? yes | no

Pete Hoffswell wrote 07/06/2016 at 13:31 point

I was able to repeat this project with an ESP-12E dev board and just 4 hookup wires.  Thanks for sharing, co sto!

  Are you sure? yes | no

niekvanruler wrote 01/13/2016 at 20:32 point

When I try to compile I get all kinds of errors like:

C:\Users\niek\Documents\Arduino\sketch_jan13c\sketch_jan13c.ino: In function 'void handle_msg()':

sketch_jan13c:31: error: 'clear_display' was not declared in this scope

   clear_display();                        // clears oled

What is wrong?

  Are you sure? yes | no

niekvanruler wrote 01/13/2016 at 21:14 point

After reordering the code, everything compiled.

I moved each function before the point it is used, that made it work.

  Are you sure? yes | no

Jon Raymond wrote 08/27/2015 at 03:47 point

This project is great because you can use either the SSD1306 or the SH1106 displays.  I've tried to implement SH1106 display support to Mike Rankins "ESP8266 Weather System" code but so far have not been able to get it to compile without errors. Programming has never been my strong point.  Any help would be greatly appreciated.

  Are you sure? yes | no

Holy Pit wrote 07/22/2015 at 06:20 point

This worked perfect for me on the first try. Thanks a bunch!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates