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 https://www.youtube.com/watch?v=iRMdj3dS2hc gave me the idea to make this project.
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
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.
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);} ^
....................
and
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 reset_display(); ^ ESP_Messenger_v1.0:97: error: 'clear_display' was not declared in this scope clear_display(); ^ and ..
ESP_Messenger_v1.0.ino: In function 'void reset_display()': ESP_Messenger_v1.0:128: error: 'displayOff' was not declared in this scope displayOff(); ^ ESP_Messenger_v1.0:129: error: 'clear_display' was not declared in this scope clear_display(); ^ ESP_Messenger_v1.0:130: error: 'displayOn' was not declared in this scope displayOn(); ^
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
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 https://github.com/mike-rankin/ESP8266_Weather_System_MicroUSB 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.
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);}
^
....................
and
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
reset_display();
^
ESP_Messenger_v1.0:97: error: 'clear_display' was not declared in this scope
clear_display();
^
and ..
ESP_Messenger_v1.0.ino: In function 'void reset_display()':
ESP_Messenger_v1.0:128: error: 'displayOff' was not declared in this scope
displayOff();
^
ESP_Messenger_v1.0:129: error: 'clear_display' was not declared in this scope
clear_display();
^
ESP_Messenger_v1.0:130: error: 'displayOn' was not declared in this scope
displayOn();
^
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