Automatic Water Level Control Based on Light Reflection and Refraction Principles

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Abstract

This paper designs an automatic water level control drinking machine based on the principles of light reflection and refraction. The device uses the Arduino UNO microcontroller as the control center to automatically identify different cup shapes at various heights, starting water injection automatically and stopping it when the water surface reaches 1 cm from the cup edge. The device innovatively utilizes the principle of light refraction to achieve non-contact precise control of water levels in different cups by changing the angles of two prisms while keeping the positions of the laser transmitter and receiver unchanged. This device is compact, simple to operate, and can perform fully non-contact automatic water injection and stopping, reducing the risk of cross-infection associated with traditional drinking machines. Additionally, this device is cost-effective and has strong application potential.

Keywords: automatic water level control; law of refraction of light; law of reflection of light; applied physics.

Water is the source of life, and human life cannot be separated from water. In reality, drinking machines have become essential water facilities in households[1]. According to incomplete statistics, about 80% of families in large and medium-sized cities across the country own drinking machines. To facilitate water replacement, the most common floor-standing drinking machines on the market are 1.2 to 1.5 meters high, with the water outlet at about adult leg height, making it inconvenient for most people to bend down to get water, especially for the elderly. Furthermore, traditional drinking machines require users to manually fill cups and stop the water flow, posing significant safety hazards[2-4]. In addition, cross-infection is an important route for the spread of highly infectious viruses; thus, the application of non-contact drinking machines in public places such as hospitals and shopping malls can effectively reduce the transmission of viruses and provide reliable protection for public health and safety.

This paper utilizes the principles of light refraction and reflection. Under the condition that the positions of the laser transmitter and receiver do not change, it detects the cup’s position with an ultrasonic sensor, starts water injection, adjusts the angles of the prisms, and detects the water level in the cup to stop injection when the water reaches the predetermined level. This device is cost-effective, easy to operate, and compact, making it suitable for various scenarios and having strong promotion potential.

1 Function Design

Utilizing the principles of light reflection and refraction, the device achieves automatic detection of different cup shapes, stopping water injection when the water level reaches 1 cm from the cup edge.

A model relationship is established between the height of the cup and the angle of the prism. By adjusting the angle of the servo, the prism rotates to the specified angle, changing the light path. When the ultrasonic sensor detects the cup placed in the designated position, the pump starts injecting water; when the water level reaches the predetermined height, the light is refracted through the prism and reflected off the water surface, allowing the laser receiver to receive the signal and stop the water injection.

2 Device Principles and Model Derivation

2.1 Device Principles

Light travels in a straight line in a uniform medium, and when it encounters the interface between two uniform media, it generally produces both reflection and refraction phenomena[5]. The two prisms can effectively change the light path, achieving light-sensing control.

When light encounters the water surface, glass, and many other surfaces, it will reflect. The reflected light, incident light, and normal line lie in the same plane; the reflected light and incident light are on opposite sides of the normal line; the angle of reflection equals the angle of incidence.

This device uses the principles of light reflection and refraction, with the laser transmitter as the light source. By adjusting the angle of Prism 1, the incident direction of light is changed, allowing the laser light path to be refracted to the center of the cup 1 cm below the cup edge. When the water level reaches the predetermined height (1 cm below the cup edge), light from Prism 1 illuminates the center of the water surface, reflecting the laser light to Prism 2. By adjusting the angle of Prism 2, the light can be directed to a fixed laser receiver. The light path diagram is shown in Figure 1.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

2.2 Model Derivation

This paper establishes the relationship between the angle α of the prism’s rotation from the horizontal direction and the height of the cup h (in cm), with the model derivation as follows:

Assuming the cup has a reference height of a (in cm), the right isosceles triangle prism is exactly at a horizontal position, and the light does not refract, with the point of incidence at the center of the water surface. Now, when calculating the cup height h, the angle α (counterclockwise is positive) that the prism needs to rotate to illuminate the water surface center is equal to the angle of incidence ∠1, as both angles are acute. The light path through the prism is shown in Figure 2.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

According to the definition of the refractive index, the angles of incidence α and refraction β, and the angles of incidence γ and refraction θ satisfy the following relationship:

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Where n is the refractive index of the prism.

From the above conclusions, we obtain:

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Since the prism has a small width, it can be assumed that the reference light ray and the actual light ray from the prism intersect at the same vertical line, as shown in Figure 3. The dark green line is the vertical line through the reference light ray from the prism, and the light blue line is the actual light ray from the prism. Since the distance between the two vertical lines is very small, they can be considered to overlap.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

According to the relationship between the lengths of the triangle sides, we have:

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Where L is the horizontal distance from the prism to the center of the water surface, h is the height difference between the reference water surface and the actual water surface, i.e., h=a-b.

By combining equations (1), (2), and (3), we can obtain the relationship between α and θ:

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Using MATLAB’s vpasolve function, we can solve equations (4) and (5) to obtain α.

This device selects prisms as refractive media, increasing the number of refractions while facilitating angle adjustments, effectively reducing the device’s size.

3 Structural Design

This device consists of a box, two prisms, a laser transmitter and receiver, a water pump, PE pipes, PG90 servos, a relay module, nylon wires, a 5V battery, and various connectors. The names of the device components are shown in Figure 4.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

The rear area of the device is used to place the water supply tank, which houses the water pump to achieve the water supply function; one end of the prism is connected by a hinge, while the other end is connected to the servo. The servo is controlled by the microcontroller to rotate the prism around the hinge, with both prisms treated this way. Adjusting the angle of the left prism changes the input direction of light, refracting the laser light path to the center of the cup 1 cm below the cup edge. By adjusting the angle of the right prism, the light path can be directed to the fixed laser receiver, thus achieving the water level control function for different cup shapes. The physical diagram of the device is shown in Figure 5.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

4 Control System Design

4.1 Control Board Hardware

The control board’s connection diagram primarily consists of the Arduino UNO microcontroller[6], servo control circuit, ultrasonic detection and water pump control circuit[7], and laser sensing circuit, as shown in the hardware design block diagram of the control board in Figure 6. The control part is simulated using Proteus 8 Professional software[8], and the microcontroller connection diagram is shown in Figure 7. The Arduino UNO is a microcontroller based on the ATMEGA328P microprocessor, featuring 14 digital input/output pins, 6 analog inputs, a 16MHz crystal oscillator, USB connection, power socket, ICSP header, and reset button.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

Automatic Water Level Control Based on Light Reflection and Refraction Principles

The servo control circuit utilizes the microcontroller to control the servo, achieving fixed-angle rotation.

The ultrasonic detection and water pump control circuit consists of the HYSRF05 ultrasonic module and an opto-isolated relay drive module. When the ultrasonic sensor detects that an object is within ≤17cm (i.e., the cup is placed in the designated position), the microcontroller connects the Echo pin of the ultrasonic sensor to a high level, controlling the relay switch to open, and the water pump starts injecting water, achieving automation of water injection.

The laser sensing circuit consists of a laser receiver and an opto-isolated relay drive module. When the laser receiver receives a high-level signal, the relay drive module converts this level into a voltage that the microcontroller can respond to, turning the corresponding pin of the microcontroller to high, stopping the water pump, and subsequently disabling the ultrasonic detection circuit.

It should be noted that the laser sensing circuit can only operate when the ultrasonic detection and water pump control circuit is active (i.e., when the cup is placed in the designated position).

4.2 Software Design

This device is programmed using the Arduino IDE software, which can run on three major operating systems: Windows, Macintosh OS X, and Linux, while most other controllers can only be developed on Windows[9,10].

4.2.1 Servo Control Part

The servo is fixed to the prism, utilizing serial communication to drive the microcontroller to rotate the prism at a fixed angle, changing the light path. The relationship between the rotation angle and cup height is as derived in section 2.2.

4.2.2 Water Pump Control Part

The program flow for the water pump control part is shown in Figure 8. When the cup is placed in the designated position, the ultrasonic sensor detects the object (within <17cm), starting water injection (relay 2 opens, water pump operates); the device uses the refraction of light through the two prisms and the reflection off the water surface. When the water level increases to the specified height, the laser receiver receives the signal and stops the water injection.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

5 Experimental Results and Discussion

We tested the feasibility of the device using three cups with actual heights of 15cm, 12cm, and 10cm.

5.1 Theoretical Calculation Results

Using the model in section 2.2, with a prism refractive index of n=1.5, a 30° angle corresponding side length of the prism e=2cm, L=5cm, and large, medium, and small cup heights of 15cm, 12cm, and 10cm respectively, with the large cup height as the reference height, thus the height differences are h1=3cm, h2=5cm.

The results: α1=68.29°, α2=78.62°.

5.2 Experimental Results and Discussion

Each cup type underwent 6 tests, with the results shown in Table 1.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

From Table 1, we can see that the measurement results have relative measurement errors within 5%, indicating that the measurement data is accurate and the device can fulfill its functions.

Initially, we used acrylic sheets as media plates 1 and 2, with adjustable cup heights of 12~16cm, requiring the stacking of 5 media plates. The device was optimized by using prisms, allowing for adjustable cup heights ranging from 4.5003~14.656cm (theoretical analysis results shown in Figure 9), significantly increasing the adjustable range. As the prism’s size is slightly larger, future experiments may involve selecting materials with higher refractive indices for the refractive media plates, increasing the refractive index to reduce the thickness of the media plates for easier adjustments; or applying anti-reflective or anti-reflective coatings on media 1 and 2 to increase the intensity of refracted light, which can reduce the intensity of incident light and lower the device’s power consumption.

Automatic Water Level Control Based on Light Reflection and Refraction Principles

6 Conclusion

This paper achieves automatic water injection and water level control for different cup types using the principles of light reflection and refraction. The device uses Arduino as the control center, utilizing servo control circuits, ultrasonic detection, and water pump control circuits to form the control part; while the light path part consists of a laser transmitter, prisms, and laser receivers. After testing with different cup types, the device can accurately identify when the water level in the cup reaches the specified position and can automatically inject and stop water for different cup types, with the error between the injected water level and the set theoretical water level within 5%; the adjustable range for cup types is from 4.5003 to 14.656cm. This device specifically addresses issues of inconvenience in getting water and safety hazards, with advantages of low cost, compact size, and ease of operation. Moreover, it is highly inclusive, operating in parallel with other functional control systems without interference, has a large market application, and is expected to be mass-produced.

References

[1] Ma Peisong, Tao Huawei, Li Yimin, et al. Design of multifunctional Water dispenser based on single-chip microcomputer[J]. Henan Science and Technology, 2022, 41(17): 20-23.

[2] Zhao Yupeng, Zhu Hai, Liu Fusheng, et al. A full-automatic Water dispenser with cup dividing function[J]. Machinery Manufacturing, 2021, 59(8): 32-34, 49.

[3] Tang Bin, Deng Jie, Li Junhong. Design and implementation of a new type of water outlet control device for Water dispenser[J]. Electronics World, 2020(11): 127-128.

[4] Liu Yuanming, Gao Xiao. Automatic water level controller with alarm function[J]. Electronic production, 2011(3): 48-50.

[5] Ma Wenwei, Zhou Yuqing, Xie Xishun. Physics Volume II[M]. 6th Edition. Beijing: Higher Education Press, 2014, 162.

[6] Li Guangming, Sun Yingshuang, Dang Xiaojuan. Design and implementation of a remote monitoring system based on LabVIEW and Arduino[J]. Computer Measurement and Control, 2015, 23(10): 3522-3524, 3528.

[7] Huang Bin. Design of a fully automatic water level controller[C].//Proceedings of the 2012 National Industrial Control Computer Annual Conference, 2012: 262-267.

[8] Zhang Chao, Zheng Yuqiang. Research on Fire Water Pump Monitoring System Based on Joint Simulation of Prototypes and LabVIEW[J]. Journal of Shijiazhuang Tiedao University (Natural Science Edition), 2019, 32(4): 46-50.

[9] Wu Meng, Zhao Zhijie, Li Peng, et al. Design and Implementation of PID Control Program in Arduino IDE[J]. Modern Manufacturing Technology and Equipment, 2017(12): 73-75.

[10] Zhang Benren, Xiong Yong, Zhang Jia, et al. Design of unmanned boat control system based on Arduino development environment[J]. Ship Science and Technology, 2019, 41(3): 83-87.

Funding Project: Beijing Higher Education Undergraduate Teaching Reform Innovation Project (202010019004); Research on the Core Competency System of Agricultural and Forestry Science and Technology.

Author Profile: Li Haiyan, female, lecturer at China Agricultural University, mainly engaged in physics teaching and research, with research interests in middle and upper atmospheric dynamics, [email protected].

Citation format: Yan Yifei, Zhang Sitian, Liu Yuying, et al. Automatic water level control water dispenser based on the principle of light refraction and reflection[J]. Physics and Engineering, 2023, 33(3): 93-98.

Cite this article: YAN Y F, ZHANG S T, LIU Y Y, et al. Automatic water level control water dispenser based on the principle of light refraction and reflection[J]. Physics and Engineering, 2023, 33(3): 93-98.

Leave a Comment