The sketch can be found on github : https://github.com/costonisp/ESP8266-I2C-OLED
ESP8266-01 server, programmed in Arduino-C, + I2C oled to display text-messages of upto 128 characters that are typed in a browser.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
The sketch can be found on github : https://github.com/costonisp/ESP8266-I2C-OLED
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
Install the ESP8266 add-on into your Arduino IDE.
How to upload a sketch to the ESP:
Connect:
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: https://github.com/costonisp/ESP8266-I2C-OLED
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.
Create an account to leave a comment. Already have an account? Log In.
I was able to repeat this project with an ESP-12E dev board and just 4 hookup wires. Thanks for sharing, co sto!
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?
After reordering the code, everything compiled.
I moved each function before the point it is used, that made it work.
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.
This worked perfect for me on the first try. Thanks a bunch!
Become a member to follow this project and never miss any updates
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