FINAL Project02 – The Use of Rainwater

Introduction of OLED I2C Display1891524023223_.pic.jpg

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).

Reference from:×64-I2C-display/

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.

屏幕快照 2018-04-18 04.50.39



















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×64-I2C-display/

Here’s the code.

屏幕快照 2018-04-18 05.08.50.png

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



屏幕快照 2018-04-18 05.02.36.png

Then add these code before setup as a intro for the water level sensor.
屏幕快照 2018-04-18 05.03.53.png




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.

Prototype Building


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.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s