-
Notifications
You must be signed in to change notification settings - Fork 3
010. The Oled Display
You can find several flavors of the SSD1306 Oled display on ebay for a few dollars.
It can be all white, all blue, blue and yellow, but, more importantly, it can come with two different interfaces:
- The four pin I2C interface,
- The seven pin SPI interface.
You'll need the former, four pin interface.
But then watch out, it comes with two different pin settings: GND first (which seems to be more common) or VCC first! The latter has oval holes in the corners, the former has round ones. Both can be used, you'll need to adapt your circuitry in accordance.
Of course I've burnt two before I noticed...
It's rather fragile, be careful not to break the corners of the thin glass sheet covering it, it would destroy it or mess up the display.
It needs 2 pins of your esp8266 board, that you can choose when instanciating the XIOTModule's class (or usually your subclass). I have a note to make this part of the configuration of the module, to allow uploading to different ESP boards without the need to edit the code.
The Xiot framework uses the wonderful https://github.com/ThingPulse/esp8266-oled-ssd1306 library, to which I have added a font editor to design icons that can then be used like regular fonts: https://github.com/ThingPulse/esp8266-oled-ssd1306/blob/master/resources/glyphEditor.html
These icons are defined in the XOLEDIconFont.h file from the XOLEDDisplay repo. You can modify them or add some using the glyphEditor (locally opened in a browser, no need to host it somewhere).
The display is usually managed using the classes from the XIOTDisplay repository (built on top of XOLEDDisplay) higher level classes, which provide methods to set the Title, turn on, off or blinking the relevant icons, and handle 5 lines of text below the title.
Each line of text can be steady, blinking, and display a transient text: message displayed for a couple of seconds before returning to the previous message displayed.
By default, the title line is bigger and can display 4 iconss.
The first line is used to display the wifi ssid name and ip, and is used for transient message especially related to the communication between master and agent.
The second line is used for transient messages.
the fifth line is used to display time and date, updated every second.
To work properly, the display needs to be refreshed each time something changes. The framework takes care of this provided you call the XIOTModule subclass' "loop" method.
A tiny blinking dot is displayed on the top left corner as witness that the screen is being regularly refreshed, which can help make sure the system is working as intended.
For this project, I have printed several cases, for which I have designed a module to keep the oled display in place. It can be imported in any scad project to be reused: https://github.com/reivaxy/iotinator/blob/master/hardware/oledPanel.stl