The “ESP8266 OLED SSD1306″ is an open source library which allows you to control those pretty OLED modules from our beloved ESP8266 module. Fabrice Weinberg cleaned up all the ugly pieces of code which I initially wrote caused by my near C/C++ illiteracy. He also added support for Pasko’s BRZO I2C library which is partially written in assembler and allows a much higher throughput over the I2C channel. Fabrice’s video below compares the the two I2C implementations:
- The font format was refactored for better memory efficiency and the web based font generator (http://oleddisplay.squix.ch/) now lets you generate font files for the older library versions or the new ones
- The hardware protocol level implementations (SPI, I2C) have been separated from the low level graphical functions. This affects how you instantiate the display classes
- To be open for future support of similar displays the core classes were renamed to Oled* instead of SSD1306
- More graphical functions have been added, including drawing of circles, non-vertical lines and a progress bar
- In case you want to use the display for simple log output you can now use print(..) and println(..) and the library will take care of scrolling. See Fabrice’s video below:
For a full list of new features and how to upgrade your existing code please have a look at the comprehensive upgrade guide: https://github.com/squix78/esp8266-oled-ssd1306/blob/master/UPGRADE-3.0.md
Please note: this release will break with your code based on the older 2.0.0 version. In case you have created fonts you’ll have to re-generate them as well. This also affects the Weather Station library!
Many thanks again to Fabrice Weinberg and all other contributors to make this release possible!
I love your post.
From first video I’ve noticed that you half way through (about 16.sec) you are uploading the firmware (OTA). I cannot find that sketch containing the world clock and OTA function. Would you be able to share the code?
Thanks in advance.
I took your question as inspiration for this post. That github project contains the code required to do OTA update with platformio:
I am using your lib really for just basic text output (because the font support is great!). Is there a way to clear text on a line or erase a single line? The only way I have found is by setting the color to black and displaying the exact same text again. This is not convenient when you have no idea what that text might have been (like webpage data).
Displaying space characters in either black or white does nothing, and displaying new text on the same line acts as an OR, and merges the new text into the old data.
Ideally, just using space characters would be the best solution. I would hate to have to do a rectfill or something like that as I imagine that would require more CPU time.
Hi Jim. All your drawing should be between a display.clear() and a display.display() statement. The clear statement will clear the screen buffer and you can draw again whatever you want. So instead of clearing lines you should rather take care of what you want to keep for the next loop iteration. In case you are using the UI class then your code will be within a drawFrame function. There you won’t have to do the display.clear/display stuff, since the UI class takes care of it. Please check out the examples provided by the oled library: https://github.com/squix78/esp8266-oled-ssd1306
Many thanks for your hard work with the weather station project!. I am currently using the previous version of the weather station code in a home built clock/weather station project of my own. I have tried upgrading to the new weather station version but for whatever reason it does not seem to work correctly at the moment – probably a bug on my side! I was wondering though, do you have, or could you make available, a <3.0.0 version of the meteocons font – this would allow me to at least continue with my project until I have worked out why I cannot upgrade. Many thanks again James Vowles
Hi James. What is not working with the new version? What are the symptoms? About the pre-3.0.0 meteocons fonts, there are still available in the history of the github project: https://github.com/squix78/esp8266-weather-station/blob/1.0.5/examples/WeatherStationDemo/WeatherStationFonts.h
OK, thanks for the explanation. So, it looks like this won’t work for my application because I don’t want to be clearing and re-drawing the display. I don’t have access to what was displayed previously, and I need to update just certain lines. I also have a limited amount of CPU time available. I guess I will look at spinning my on routines to poke at the OLED hardware. Rats… I really liked your font setup and tools.
Why not just putting the text into line variables and draw the variables in the drawing routines? Is there a repo or gist where I could understand better what you are trying to do? The library is using a buffer which gets “committed” to the display at once…
Thank you for the quick reply – have installed the fonts and all working really well. Not sure what the problem is with the new version, again think its my end rather than your code. Unlike your system I’m multiplexing the I2C across 6 individual OLEDs – hrs/mins/secs across three, with the other three screens displaying date, weather information, emails connectivity status etc. I suspect the problem may be connected with the I2C speed in the new version – the circuit capacitance may be such that it requires different pull up resistor values on each of the 6 data lines? The version I’m using may be slower? Ive tried the new version out on a single screen with no problems. I’ll get the scope out and check whats happening at the I2C level.
Have you tried the brzo I2C driver with my lib? It is a lot faster than the built in…
Daniel…yes tried the brzo driver also – same sort of symptoms when I ran it – screens flashed solid, text corrupt etc.. Again – I think the problem I’m having is due to me multiplexing the I2C signal. Everything works fine with the version of SSD1306Ui i’m using – looks really good in fact. I’ll track the problem down and let you know when I find the cause. Thanks again!