HOW DOES IT WORK?
Good question! It's quite simple really. It can be done in as little as 2 steps:
1) Log in
2) Start either the bath or shower with your previously saved settings!
And that's it!
WHAT HAPPENS BEHIND THE SCENES?
You will begin by entering your pass-code in the GUI in order to load all of your desired settings from the MySQL database running on the server. Once you're logged in, you'll select the bathroom menu. Here, you'll have two sections to choose from: Bath or Shower. As mentioned before, all your desired settings will be preloaded on the screen but you'll still have the option to adjust any of the 4 variables. For the shower, you have water temperature and water flow. For the bath, you have water temperature and water level. Once you press the start button, the magic begins.
Let's assume first that you selected a shower. Your command will be sent to the server. From there the server communicates with the bathroom node and makes sure everything is going as planned. If all is good, the bathroom node will start adjusting the hot and cold water and try to achieve the desired temperature and flow. Until the desired temperature is reached, the water will be directed to the drain before even coming out of the shower head. This water will be cold so it's better to divert it to the drain instead of on you.
Within a few seconds, the water will have reached the temperature and will be redirected to the shower head. You will be able to adjust the water temperature from within the shower via a few buttons. You will also have the option to pause the water while you're shampooing and whatnot for extreme energy and water conservation. Once you're done, simply press a button and it all stops and is ready for next time.
The bath works pretty much the same way. It reaches the desired temperature at maximum flow and also keeps track of how much water is in the bath via a flow sensor. Once it's reached the desired water level it stops. After you're done, press a button and the water drains away.
IT'S A MUST
These are the criteria that must be met in order for the system to be functional. The system must:
-Be user friendly. Anybody that is able to use a shower or bath by themselves must be able to operate the system without any difficulty.
-Be easily expandable so that future nodes for other rooms and systems can be added to reach the end goal of having a fully automated home.
-Operate faster than the average person in order to be considered useful.
-Be more efficient than the typical system in order to save water and the energy used to heat the water which converts to money in our pockets.
-Be easily put back to the boring manual mode in case of an extended power outage or the system malfunctions.
There are three main hardware components to the system. There's the server, the user interface and the node. The server and user interface will both run on the same Raspberry Pi for now but will be on different Pi's in the future as the system expands and gets more nodes. They will all be connected together through a router and will communicate using TCP/IP. Let's go into more detail for each of them.
The server consists of a Raspberry Pi. The server will hold all of the users preferences and also communicate with all the nodes. In our case, there will only be 1 node but as said before, I want it to be expandable in the future.
The user interface will consist of a Raspberry Pi that will run the user interface software and display it on a capacitive touch screen mounted on the wall. I chose the Raspberry Pi for it's small size to be hidden behind a wall and also, of course, for it's very low cost.
The node has final control of all the bath and shower functions. Its the only device that knows what's going on and that can activate servos and solenoids. It consists of an ATmega328P chip with the Arduino bootloader. It receives commands from the server and also sends back updates on it's status to the server. It will get input from sensors such as temperature and flow sensors. It will then adjust it's outputs such as servo motors and solenoid valves as a result.
All of this nice looking hardware is useless without the software so here's what I've chosen for each device.
The operating system used on the Raspberry Pi will be Raspbian. The software running on the server will be Apache, MySQL and PHP. The web interface that will allow us to control the bathroom from any web enabled device in the house will be hosted on the server. All of the user preferences will be stored in a MySQL database. The main server software that will be sending and receiving all the commands will be created with PHP. Not many people know this, but PHP can be ran as a socket server. Although this might not be the best approach, I'm very comfortable using PHP.
Again, the Raspberry Pi will be using Raspbian as a operating system. I've decided to use Python along with Pygame to create the GUI. I'm using Pygame because it makes it a lot easier to draw images to the screen and also to get input from users.
As for the node, I will simply be using the Arduino IDE along with various examples and libraries to make the sensors function correctly.
More to follow!