Introduction of OLED I2C Display
How to connect and program the Geekcreit 0.96 inch 4 pin white I2C OLED module with Arduino. OLED display based on a SSD1306 OLED driver IC.
The display connects to Arduino using only four wires – two for power and two for data, making the wiring very simple. The data connection is I2C (I²C, IIC or Inter-Integrated Circuit). This interface is sometimes called TWI (Two Wire Interface).
Testing – 1 Display Text on OLED Screen
Connect the display to UNO board as the image shown.
Before start coding, I need to import two zip libraries for add graphic to the display.
After reading the reviews of this module from Amazon, I’ve done some changes to the raw files, and started coding on a sketch template from https://startingelectronics.org/tutorials/arduino/modules/OLED-128×64-I2C-display/
Here’s the code.
This is how it shows on the display.
Testing – 2 Display Sensor Data on the Screen
Add a water level sensor to the circuit on pin A0.
A Flow Chart for Programing
Then add these code before setup as a intro for the water level sensor.
Also add these to loop to run the program, so the reading will be taken from pin A0 and displayed on the screen.
Here’s the video show how it works.
And this is the full code for this part.
As I’ve make the valve and OLED display run perfectly, then I put them into one circuit, and merged the code together.
The Full Version Flow Chart
The full code for this project is here.
Here’s the video for the working prototype.
The model will leak water, so I use finger instead of water to show how it works.