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: https://startingelectronics.org/tutorials/arduino/modules/OLED-128×64-I2C-display/

Testing – 1 Display Text on OLED Screen

arduino-oled-connection.jpg

 

 

 

 

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

 

 

 

1911524023224_.pic_hd.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

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

This is how it shows on the display.

1921524025932_.pic_hd.jpg

Testing – 2   Display Sensor Data on the Screen

 2071524097426_.pic_hd.jpg

Add a water level sensor to the circuit on pin A0.

A Flow Chart for Programing

display.png

 

屏幕快照 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.

https://youtu.be/CXJux2UsGps

And this is the full code for this part.

https://create.arduino.cc/editor/yusu1224/5c4b83ed-bc22-41dd-ab72-c5f25af18e65/preview

Conclusion

As I’ve make the valve and OLED display run perfectly, then I put them into one circuit, and merged the code together.

2061524097424_.pic_hd.jpg

The Full Version Flow Chart

rainwater.png

The full code for this project is here.

https://create.arduino.cc/editor/yusu1224/9c289f2c-b899-421a-b835-d8177f93cb41/preview

Prototype Building

1941524025939_.pic_hd.jpg1951524025944_.pic_hd.jpg1931524025935_.pic_hd.jpg1961524025944_.pic_hd.jpg

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.

https://youtu.be/wwJpjVUDl_8

 

Reference

 

Advertisements

WEEK 9 Project02 – The Use of Rainwater

How to use water level sensor to control a servo?

1821524016781_.pic_hd.jpg

Aim to fill the toilet tank by rainwater by using the non-contact liquid sensor to control the valve. When the toilet tank is empty, the servo will rotate to open the valve for rainwater filling, and it will rotate back to the original position as closing the valve when the tank is filled up.

Testing – 1  Make the Servo Rotate in Clockwise and Anti-clockwise

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

Connect the circuit as above, then upload the “sweep” code for servo testing.

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

Video: https://youtu.be/3wqJruDN9Ck

 

Testing – 2   Use Non-contact Liquid Sensor to Control Servo

1861524020247_.pic_hd.jpg

Add a non-contact liquid sensor at the servo testing circuit on digital pin2, then add the sensor sketch to the servo testing code and upload it.

A Flow Chart for Programing

servo.png

Full code: https://create.arduino.cc/editor/yusu1224/fc8f23ac-638f-4465-afb4-f08a8b7fe0a5/preview

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

Video: https://youtu.be/9k5xN5Z3_V0

This video shows how it works when it’s attached to the prototype, so the valve will open when there is no water detected from the toilet tank, and it will keep shut if water is detected. ( The model will leak water, so I use finger instead of water to show how it works.)

https://youtu.be/DUDP0mPUfiI

Next Step

I’m going to use a OLED I2C display to read the water level sensor in the rainwater tank for people to monitor the water level change .

WEEK 8 Project02 – The Use of Rainwater

Introduction of Reading Sensor Value on Blynk App

How Blynk Works

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, vizualize it and do many other cool things.

There are three major components in the platform:

  • Blynk App – allows to you create amazing interfaces for your projects using various widgets we provide.
  • Blynk Server – responsible for all the communications between the smartphone and hardware. You can use our Blynk Cloud or run your private Blynk server locally. It’s open-source, could easily handle thousands of devices and can even be launched on a Raspberry Pi.
  • Blynk Libraries – for all the popular hardware platforms – enable communication with the server and process all the incoming and outcoming commands.

architecture.png

Features

  • Similar API & UI for all supported hardware & devices
  • Connection to the cloud using:
    • WiFi
    • Bluetooth and BLE
    • Ethernet
    • USB (Serial)
    • GSM
  • Set of easy-to-use Widgets
  • Direct pin manipulation with no code writing
  • Easy to integrate and add new functionality using virtual pins
  • History data monitoring via History Graph widget
  • Device-to-Device communication using Bridge Widget
  • Sending emails, tweets, push notifications, etc.

from: http://docs.blynk.cc/

Introduction of Arduino Ethernet Shield W5100

wiznet-ethernet-shield-500x500.jpg

The Arduino Wiznet Ethernet W5100 Shield allows an Arduino board to connect to the internet. It is based on the Wiznet W5100 ethernet chip providing a network (IP) stack capable of both TCP and UDP. The Arduino Ethernet Shield supports up to four simultaneous socket connections. Use the Ethernet library to write sketches which connect to the internet using the shield.

From: http://www.hobbytronics.co.uk/arduino-wiznet-shield

Testing

From the tutorial provided by Blynk website :https://youtu.be/egGs_jSIKbc

I connected the shield to UNO board, and got a sketch example from: https://examples.blynk.cc/?board=Arduino%20Uno&shield=Ethernet%20Shield%20W5100&example=GettingStarted%2FPushData&auth=07f57ca292e749e488934fb0ff6e87f3

1781523589753_.pic_hd.jpg

屏幕快照 2018-04-13 04.08.23.png
4781523556013_.pic_hd.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

However I can get the IP address, but couldn’t connect to the blynk cloud web.

 

 

 

 

 

 

 

 

 

 

 

 

 

Introduction of ESP-01 / ESP8266 Wifi module

As the ethernet shield is not working, I decided to try the small wifi chip to make the Arduino UNO connect to the internet.

ESP-01.jpg

 

The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any micro controller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.

 

Testing

I Added an adapter to this module and connect it as below.

1791523591597_.pic_hd.jpg

屏幕快照 2018-04-13 04.54.48.png

I got a sketch example from: https://examples.blynk.cc/?board=Arduino%20Uno&shield=ESP8266%20WiFi%20Shield&example=GettingStarted%2FPushData&auth=07f57ca292e749e488934fb0ff6e87f3

However the network kept showing “not responding”, it doesn’t work as well. Probably because the module wasn’t in the latest firmware, it should be flashed.

Next Step

As reading the sensor on App seems quite difficult to come true, I ‘m planning on reading sensor data on a LCD or OLED display.

 

 

 

 

 

WEEK 7 Project02 – The Use of Rainwater

Introduce Water Level Sensor

NO.1 Testing

15-1.jpg

Water level sensor is a module that can sense the depth of water, whose core part is an amplification circuit composed of a transistor and several comb-shape PCB cables. When placed in water, the comb-shape cable will change its resistance with the depth of the water and convert the depth signal into an electrical signal. With an ADC on the SunFounder Uno board dealing with that signal, we can know the water depth changes.

From: https://www.sunfounder.com/learn/lesson-15-water-level-sensor-rfid-v1-0-for-arduino.html

屏幕快照 2018-04-12 21.13.03.png

Connect the circuit like above. Connect the sensor to A0, and led to pin3.

屏幕快照 2018-04-12 21.14.22.png

Select the AnalogInOutSerial code in Example, and make sure the Output pin is correct.

Reference from: https://www.youtube.com/watch?v=3Qvdl0q9soE

Video:

https://youtu.be/CyA6pyqFk_U

 

NO.2 Non-contact Liquid Level Sensor

SEN0204.jpgSEN0204_adapter.jpg

The non-contact liquid level sensor utilizes advanced signal processing technology by using a powerful chip with high-speed operation capacity to achieve non-contact liquid level detection. No contact with liquid makes the module suitable for hazardous applications such as detecting toxic substances, strong acid, strong alkali and all kinds of liquid in an airtight container under high pressure. There are no special requirements for the liquid or container and the sensor is easy to use and easy to install.
The liquid level sensor is equipped with an interface adapter that makes it compatible with DFRobot “Gravity” interface. There are 4 levels of sensitivity which are set by pressing the SET button.

from: https://www.dfrobot.com/wiki/index.php/Non-contact_Liquid_Level_Sensor_XKC-Y25-T12V_SKU:_SEN0204

Testing

Using the same connection and code as the previous one to test the non-contact liquid sensor.

video:

https://youtu.be/81gTjEkq6CE

Next Step

I’m going to work out how to use water level sensor to control a servo for valve opening and closing, also have a look at how to read sensor data on a smart phone App.

WEEK 6 Project02 – The Use of Rainwater

Project Aim

By collecting rainwater for home using to reduce the water consumption and make our lives more sustainable.

Initial Idea

1471521414816_.pic_hd.jpg

To create a smart toilet flushing system by using collected rainwater. When the toilet water tank is empty, the Valve1 will open to let rainwater flush the toilet. If the rainwater tank is empty as well, the Valve2 will open to use city tap water to flush.

Developing Concept

1741523560149_.pic_hd.jpg

Using one water level sensor in toilet tank to control the valve in the rainwater tank for opening and closing, and using smart phone app to observe the volume of the water in the tank by reading the value from the sensor in the rainwater tank.

Component needed:

Arduino UNO Board

Cables

Water Level Sensor x2

Servo

Wifi Shield / Wifi Module / Bluetooth Module

Smart Phone App

 

WEEK 5 Project02 – The Use of Rainwater

20170222_eauxdePluieLinge.png

Introduction

Water consumption is always a big problem for our human in nowadays. How to use water efficiently in our lives should be an important aim for everyone. Therefore it reminds me that we can use rainwater to reduce the pressure of city water supply. Rainwater itself is generally clean, but it can pick up microorganisms, pollutants and debris when it hits the roof. This is why systems for rainwater use inside home often include filtration or other treatments for safety.

Uses for Rainwater

Flushing Toilets

This is another huge water drain. Toilets use almost 27 percent of water in your home. To use collected rainwater instead, try keeping a bucket of it next to your toilet. When you need to flush, pour the rainwater straight into the bowl of the toilet. This will automatically flush your toilet. Make sure your bucket can hold the amount of your toilet’s tank. For instance, if you have a toilet with a 6 gallon (22.7 liter) tank, use at least a 6 gallon bucket of water

Another option is to plumb a pipe for rainwater directly into your house and connect it to your toilet for flushing.

Watering Lawns, Gardens and Houseplants

Rainwater is naturally designed to water plants, and it can easily be used for your indoor and outdoor gardens. You can use rainwater in watering cans to water plants by hand. You can also attach any rainwater storage tanks directly to an automatic irrigation system.

Passive systems to conserve and collect water in your soil are also helpful. Plant garden beds along the edges of your driveway, or at the bottom of a hill, to take advantage of water’s natural movement. Also, try planting a rain garden at the ends of your eavestroughs to catch any excess runoff.

Rinsing Vegetables

Dirty rainwater is great for rinsing vegetables straight from your garden, especially root vegetables. Try filling a large bucket with rainwater, adding some carrots, potatoes, beets or other hard vegetables, and swish them together to knock the soil off.

Washing Vehicles and Equipment

Washing outdoor items is another excellent use for untreated rainwater. Cars, garden tools, lawnmowers, tractors and even the driveway and sides of your house are all perfect candidates.

Reference from:https://www.care2.com/greenliving/10-uses-for-rainwater.html

Rainwater harvesting

Rainwater from roofs and hard surfaces such as car parks can be stored and used in and around properties. The simple rainwater butt, used for garden watering, is a familiar method of storage.

There has been a recent growth in the use of the collected water for a range of non-potable uses, particularly for flushing toilets. Stored water is generally held in a suitably sized underground tank and pumped to the point of use. A mains water supply is usually provided as a back-up if rainwater is not available.

rainwater-harvesting-diagra.jpg

Reference from:https://www.sudswales.com/types/source-control/rainwater-harvesting/