Electronics Shower System
Electronics Shower System
Evansville, Indiana
Acknowledgements
I would like to thank Dr. Marc Mitchell for advice on creating the demo for this project.
I would like to thank Naser Alangery for advice on programming the valves.
Table of Contents
I. Introduction
A. Design
B. Costs
IV. Results
V. Conclusion
VI. References
VII. Appendix A
List of Figures
List of Tables
After having lived in houses with both reliable and not so reliable showers, a solution is
needed in order to fix the problems that some showers have. The solution is an electronically
controlled shower system that can automatically control temperature for the user and several
options for flow rate are included for water conservation. The need comes from the common
person being able to have a more relaxing way to finish the day, as showers are meant to be
relaxing in the first place. There are also those out there who can’t afford a lot of running water
due to low incomes and high bills. The intention is to deliver a project that can make the
temperature selecting process less meticulous in order for the showering experience to be more
enjoyable. Also, the intention is for the project to have options for different rates of water flow
so that those who may need to save a little extra money now have the means to do so.
From an engineer’s perspective, the problem is that everybody has to spend several
minutes to get their shower to operate at the exact temperature that they think is relaxing. In the
process of finding the right temperature, everybody uses up water because they don’t know what
temperature they want the water to be without conducting a trial and error session. This problem
is important to solve because not only would it allow for others to immediately find the
temperature that is right for them, but will also cut back on their water bills since they won’t
have to let water run for several minutes each time they take a shower.
A. Design
A picture of the final design is shown in Figure 1. Two valves are inserted into the pipes
leading toward the shower head. The valves are connected to the microprocessor and powered
using a separate battery voltage supply. The microprocessor itself is inside of a container unit.
This unit is attached on the wall much like a thermostat is in a standard home. The LCD screen is
at the top of the container, flashing its various messages when the time comes. The front of the
unit has several buttons. These buttons are wired into the microprocessor and allow the user to
control the water temperature, control the water pressure, and allow for saving certain settings
that can be recalled if needed later. All of the client’s requirements of temperature control and
pressure control are met using this design. A block diagram of the hardware design is shown in
Figure 2.
The circuit diagram is shown in Figure 3. The bulk of the circuit work is done through the
H-bridge. The H-bridge takes the values from the port pins of the microprocessor and outputs
them to the pins that the valves are connected to. Both of the logic pins are hooked to power in
order to enable the input/output values for each side. The sending of these values from port pins
to valve pins allow the valves to open and close as necessary. All of the buttons and sensors are
with several if statements inside of it. These if statements are conditional depending on which
button the user pushes. The program has target values for both temperature and water flow. By
pushing one of the buttons, the program increments or decrements the target values. The
microprocessor then moves the valves to change based on which target was changed. If the user
pushes one of the buttons relating to temperature, the program slightly closes one valve and
slightly opens the other depending on whether the user wants the water to be hotter or colder.
Both valves must change positions in order to preserve the flow rate. If the user pushes one of
the buttons relating to flow rate, the program opens or closes both valves at the same proportion
in order to keep the temperature constant and just change the amount of water coming through.
A standard valve cannot be used for this project because it has only two configurations:
open or close. The valve will remain open if the water flow is running normally. The valve can
be closed if there is a problem with the plumbing system so that the water won’t damage the
surrounding area. Therefore, an electronically controlled thermostatic valve fits this project the
best because it allows for both temperature control and flow rate control through very precise
movements. The valve that has been chosen for this project is a 5V brass motorized ball valve,
This motorized electrical valve allows full 90 degree rotation from a starting point, which can
allow the water flowing through the pipes to either be all the way open or all the way closed.
When placed in the pipe that transfers hot water and another on the cold water pipe, this allows
for any water temperature to be possible so long as the house is capable of providing the
temperature in the first place. A set of these valves also allows for flow rate control. If the user
wishes to turn the flow rate up, the valves both open the same amount, allowing more water to
flow out of the shower head while preserving the temperature the user had previously selected.
In order for the system to know what temperature and flow rate the shower is operating
at, two sensors are used. The temperature sensor used is a DS18B20 waterproof temperature
sensor, which can be seen in Figure 5 [2]. This sensor operates between 3-5.5V and is
completely waterproof. It is able to measure any reading from -131 to 257 degrees Fahrenheit
with an accuracy to about 0.2 degrees. Since the optimal showering temperature is 112 degrees
[3], the sensor can easily measure any realistic showering temperature. It also has one wire
interface to make the circuit easy. The sensor is placed further away from the rest of the circuit
into the area right before the shower head. This placement is necessary due to the fact that
showers get one pipe for hot water and one for cold water. If the temperature sensor is put where
the two pipes converge, an inaccurate reading occurs because the water hasn’t mixed yet. This
would result in the sensor reading very hot water or very cold temperatures. By putting it near
the shower head, the water has plenty of time to mix into its final temperature and an accurate
reading is recorded. The flow rate sensor selected for this project is the YF-S201 water flow
sensor, which can be seen in Figure 6 [4]. This sensor can measure flow rate between 1-30 liters
per minute. Since the average American uses about 8 liters per minute while showering [5], this
sensor is more than capable of accurately measuring the flow rate. It can also work in the range
of -77 to 176 degrees Fahrenheit with an accuracy of plus or minus ten percent. It is capable of
reacting to changes in flow rate in microseconds, so depending on how much it is checked, the
sensor quickly informs the user of the new pressure setting. This sensor is part of the piping itself
in order for the wheel in the sensor to turn and report data. It has been placed right after the two
pipes converge because all of the water will be flowing in one pipe at that point.
The final piece of this project is a microprocessor board that allows for the execution of
the project. The microprocessor board selected for this project is the AT89C52 microcontroller,
which can be seen in Figure 7 [6]. This microcontroller was selected due to having extensive
previous experience with it. The language for the microcontroller is also easy to understand
when compared to others. This has allowed for quick and efficient programming. However, the
settings can’t be saved in the event that power is lost to the system, requiring a reentry of the
settings.
much the shower valves cost. Depending on the needed quality, the shower valve could be semi-
expensive. The other materials, such as a microprocessor board, LCD screen, and buttons, are
not very expensive. The main health and safety restraint is making sure that the valve is able to
adjust the pressure and temperature correctly. If it fails at adjusting the temperature, the user
could get doused in scalding hot water and get burned. If the valve fails when it comes to
pressure, the user could get hit with water that has similar pressure to a firefighting hose, which
could come out with such force that can strip the bark off trees. The sustainability restraint
should be as standard as any other shower valve. When dealing with water, the valves used are
The biggest concern with this project is how to minimize the risk of electrocution
considering electricity and water don’t mix. The proportional motorized electrical valves have
the valve and electrical section separated off from each other. Additionally, the wires running out
of the valve are insulated to prevent dripping water from shorting them out. The temperature
sensor is waterproof, eliminating the possibility of shortages there. The water flow sensor also
has the wires running separately from the water. In this case, the wires are connected to a wheel
that will spin from the water flow. The sections of the wires right next to the wheel and in the
connections are insulated to prevent shortages. Finally, the container that holds the circuit is 3D
printed and super glued together so that the steam from the shower will not cause any buildup of
moisture inside the box. To make sure the waterproofing was done successfully, I looked at the
standard set by the IEEE AdHoc meeting [7]. They talked about the construction of a connector
The testing for the parts was done at the beginning of the building process. In order to
accurately test the valves and sensors, a system resembling a shower had to be constructed.
Thanks to Dr. Marc Mitchell, the parts necessary for a system resembling a shower were
procured. For testing purposes, all that was needed was a supply of water and piping. Both the
sensors and the valves were integrated into the pipe. The programming of the valves came next.
Once the valve programming was finished, the box housing the circuit was made to resemble a
finished product.
In order to demo the project, a setup had been made. The project was attached underneath
the sink in the optics lab. Each valve was placed on the hot and cold faucets while the sensors
were placed accordingly. While not exactly a shower, this setup proved that the project can
adjust temperature and flow rate for a running water supply while still having the features as
listed before.
B. Costs
Cost Needed
Sensor
YF-S201 Water Flow $7.57 1 $7.57
Sensor
Total: $70.60
The cost of the project is described in Table 1. Each of the brass motorized valves cost
$24.99, so two of them were $49.98. The waterproof temperature sensor costs $13.05, while the
water flow sensor costs $7.57. Since the AT89C52 microcontroller is already built, its cost is
neglected. Altogether, the project costs $70.60. Compared to the proposal, the project cost less
because cheaper valves were found than what was previously envisioned.
IV. Results
Through working on this project, electronically controlled shower valves have been
integrated into a shower head. These valves are connected to a microprocessor, power, and
ground. The microprocessor is connected to several buttons that allow the user to change the
various settings available. The entire circuit fits into a small unit that is mounted on the wall like
a thermostat. This unit allows control over water temperature and water pressure.
In conclusion, this electronically controlled shower system allows users to enjoy a more
relaxing shower without worrying about getting the temperature just right. In houses with several
people living in them, being able to instantly get the shower to how you like it is a way to
alleviate even the smallest bit of stress from their day. Finally, for those who are looking to save
a little bit of money, this system allows them to pay as little money as possible for water so that
they can budget more of it for other important expenses. For possible future work on this system,
it is recommended that a water powered generator also be created. This way, the system would
not have to have its batteries changed and reduce the possibility of it shorting out. It is
recommended that multiple user memory be implemented that uses non-volatile memory so that
settings are saved even if power is lost to the system. Also, it is recommended that letters be built
into the system’s user interface so that each person can enter their own name as opposed to being
[1] Hydraulics & Pneumatics. (2009, June 8). Proportional Control Valves. [Online].
Available: http://hydraulicspneumatics.com/other-technologies/book-2-chapter-14-proportional-
control-valves
Available: http://www.globalspec.com/learnmore/sensors_transducers_detectors/temperature_se
nsing/temperature_sensors
[3] H. Mitchell. (2016, January 4). Burning Question: What Is the Best Water Temperature for
is-the-best-water-temperature-for-your-bath-or-shower-1451931152
works.org/indoor-use/showers
Available: http://www.circuitstoday.com/8051-microcontroller
[7] Minutes IEEE 802.3cg AdHoc Meeting. (2017, February 22). IEEE Standards Association.
[Online]. Available:
http://grouper.ieee.org/groups/802/3/cg/public/adhoc/8023cg_adhoc_minutes_00a_2017_02_17.
pdf
Appendix A
//
#include <at89c51cc03.h>
#include <stdio.h>
//
void reset(void);
void GetTemp(void);
void receive(void);
void display(void);
void openall(void);
void closeall(void);
void openright(void);
void openleft(void);
void closeright(void);
void closeleft(void);
unsigned char a;
char upflag;
char downflag;
char upflow;
char downflow;
//
void Main()
{
// int i;
P1_6 = 1;
CR = 0;
IEN0 |= 0xC0;
CMOD = 0x01;
CCAPM3 = 0x48;
IEN0 |= 0x01;
IT0 = 1;
IEN0 |= 0x02;
TMOD = 0x01;
CKCON = 0x01;
SCON = 0x40;
RCLK = 1;
TCLK = 1;
RCAP2H = 0xFE;
RCAP2L = 0x91;
TR2 = 1;
REN = 0;
RI = 0;
P1_6 = 0;
while (1)
GetTemp();
calculate();
cal = calculate();
calculateFlow();
flowrate = calculateFlow();
display();
target++;
upflag = 0;
else
upflag = 1;
target--;
downflag = 0;
else
downflag = 1;
targetflow++;
upflow = 0;
else
upflow = 1;
{
targetflow--;
downflow = 0;
else
downflow = 1;
closeright();
openleft();
else
closeright();
openleft();
openright();
closeleft();
}
else
openright();
closeleft();
closeall();
openall();
if(CF)
overflow++;
CF = 0;
TR0 = 0;
TH0 = 0;
TL0 = 0;
overflowF = 0;
TR0 = 1;
overflowF++;
int l;
P1_6 = 1;;
CCAP3L = 5%256;
CCAP3H = 5/256;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
P1_6 = 0;
CCAP3L = 5%256;
CCAP3H = 5/256;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
CCAP3L = 282%256;
CCAP3H = 282/256;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
P1_6 = 1;
void reset(void)
P1_6 = 1;
P1_6 = 0;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
P1_6 = 1;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
void GetTemp(void)
reset();
Transmit(0xCC);
Transmit(0x44);
P1_6 = 1;
CL = 0;
CH = 0;
overflow = 0;
CR = 1;
while(overflow<58);
CR = 0;
CCF3 = 0;
reset();
Transmit(0xCC);
Transmit(0xBE);
receive();
reset();
void receive(void)
unsigned int m = 0;
rdata = 0;
for(m=0;m<bits;m++)
P1_6 = 0;
CCAP3L = 5 % 256;
CCAP3H = 5 / 256;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
P1_6 = 1;
CCAP3L = 47 % 256;
CCAP3H = 47 / 256;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
integer = P1_6;
CL = 0;
CH = 0;
CR = 1;
while(CCF3==0);
CR = 0;
CCF3 = 0;
return deg;
return flow;
void display(void)
unsigned char a;
// CKCON = 0x01;
// SCON = 0x40;
// RCLK = 1;
// TCLK = 1;
// RCAP2H = 0xFF;
// RCAP2L = 0xA4;
// TR2 = 1;
// REN = 0;
// RI = 0;
a = 0;
while(Array[a] != 0)
TI = 0;
SBUF = Array[a];
a++;
while(TI==0);
{int y;
unsigned char l;
for(l = 0;l<x;l++)
for(y=0;y<1000;y++);
return;
void openall(void)
P1_2 /*2*/ = 0;
P1_3 /*7*/= 1;
P1_4 /*15*/= 0;
P1_5 /*10*/= 1;
//Delay(50000000);
}
void closeall(void)
P1_2 /*2*/ = 1;
P1_3 /*7*/= 0;
P1_4 /*15*/= 1;
P1_5 /*10*/= 0;
//Delay(50000000);
void openright(void)
P1_2 /*2*/ = 0;
P1_3 /*7*/= 1;
Delay(50000000);
P1_2 = 1;
void openleft(void)
P1_4 /*15*/= 0;
P1_5 /*10*/= 1;
Delay(50000000);
P1_4 = 1;
void closeright(void)
P1_2 /*2*/ = 1;
P1_3 /*7*/= 0;
Delay(50000000);
P1_2 = 0;
void closeleft(void)
P1_4 /*15*/= 1;
P1_5 /*10*/= 0;
Delay(50000000);
P1_4 = 0;