making simple scrolling pages on the OLED I2C screen with ESP8266 boards
In this project we will make simple temperature and humidity monitor with DHT sensor and NodeMCU wi-fi board with I2C OLED screen. This scrolling pages library is very handy and can be used in many other projects.
As you can see there is three main parts we need:
- NodeMCU board (or other based on ESP8266)
- DHT sensor
- OLED I2C screen
Scrolling pages and OLED
First of all to use the I2C oled display with ESP8266 we need a library called "esp8266-oled-ssd1306-master".
When the library installed (read about installation here) let's make scrolling pages. When library installed everything is ready to be assembled.
About scrolling pages:
Library example called "SSD1306UiDemo"
The code of this example is demonstrate how to make scrolling pages. The frame which will stay in the screen and don't moving like the others is called msOverlay :
When the other pages will move the word "static" will statically printed in the right corner. The numbers of this frames can be changed in "overlaysCounter". When new frame is added its name must be here:
// Overlays are statically drawn on top of a frame eg. a clock
OverlayCallback overlays[] = { msOverlay };
int overlaysCount = 1;
All moving pages are in functions "drawFrame"
The numbers of the pages should be in the frameCount
// how many frames are there?
int frameCount = 5;
If you want to create your own pages just copy the other code and modify this functions.
To use the DHT sensor you need the DHT library.
Then connect the DHT sensor to the SD2 pin (digital pin 10) on the board. Now everything is ready to operate.
The code: https://github.com/AlexNoyanov/ArduinoProjects/tree/master/NODE_OLED_DHT_ui_pages
Important aspects
This project should be modified in the future to use wi-fi
Comments