Hospital in a Toilet

Embed sensors into your toilet to monitor your health daily

Similar projects worth following
Urinalysis is a non-invasive medical tool that can provide valuable information on a wide range of health concerns. However, while urinalysis is commonly used in a clinical setting it isn’t readily available outside the doctor’s office for individual patient use. The HiT team is creating a daily urinalysis device that can provide long term monitoring of a chronic medical conditions such as diabetes as well as general health and wellness such as hydration. The goal is a functioning Hospital in a Toilet which through a different combination of sensors depending on the user’s health profile, can provide comprehensive daily health monitoring.

Sensor system:

The measurement system consists of a small urine collection device embedded in the user’s toilet. Urine enters the device through a funnel and is collected in a small measurement area. There, a color sensor measures the color of the urine. The color sensor is controlled by an arduino microcontroller. The color sensor communicates with the arduino via a serial connection.

Two gauge pressure sensors are used to calculate the difference in pressure between two points in the column of liquid. The pressure between the two points in a column of a liquid is related by the height between the points, and the density of the liquid. Because the height between the points and the area of the column is fixed, these two pressure measurements give us a method of determining the liquids density, which is directly related to the specific gravity. The pressure sensors are both on a single SPI bus on which the Arduino is the master.

The Arduino individually selects each of the sensors by manipulating the Slave Select line of each sensor, and then proceeds to clock data to receive the readings from the sensors. The pressure measurement is computed by converting the received bit stream into a pressure reading. This measurement is then converted to a measurement of specific gravity by finding the difference between the two pressure readings, given the other parameters of the fluid column and height difference between the pressure sensors.

Other sensors like pH, specific gravity, or absorption spectrum can be incorporated into this embedded device to provide additional functionality. Information from the sensors is then transmitted via bluetooth to the users smartphone. The arduino controls the bluetooth module using a serial connection.

Data management:

The users smartphone receives the data and an application sends it to a modified open EMR server. The open EMR server has been extended with php scripts to store the urine information in a custom table within the database. Other sensor information can easily be added to the table. The smartphone application can also pull data from the server to show the user past hydration data. The server also supports querying for specific data, for example, all urine data between two dates.

Data Interpretation:

The smartphone app uses information from a urine color chart to provide hydration recommendations to the user based on the measured urine color. Currently in the plan, recommendations are based off of a linear model taken from the RGB values of a color chart. The RGB values from the color sensor are averaged and then compared with this linear model. This should provide a rough recommendation based on the users hydration. The specific gravity value is also presented to the user comparing it with the clinically normal values.

The app will also be able to show hydration trends to the user using information from the server. The team plans to use personal historical hydration data to provide smart recommendations which are tailored to the user.

  • 1 × Arduino Embedded microcontroller
  • 1 × Color Sensor Measures the RGB values associated with the urine
  • 1 × Bluetooth Module Communicates with GUI on cellphone
  • 2 × Pressure Sensors For measuring specific gravity

  • Open EMR Server

    Evan Dougal08/20/2014 at 21:08 0 comments

    Data is collected from the embedded sensors and sent to the user’s smartphone via bluetooth. An application running on the phone sends it to an Open EMR server (, which is an open source electronic medical records server, based on a LAMP stack. 

    The open EMR server has space in the database for storing the urine information, and several php scripts are used to store urine information. Other sensor information can easily be added to the database. The smartphone application can also pull data from the server to show the user past hydration data. The server also supports querying for specific data, for example, all urine data between two dates. 

    A major concern for the future is security. Protecting people's medical information is of utmost importance, so in the future all of the communications with the server should be encrypted. Additionally, it would be better not to store all of the information on a centralized server (where hackers that break into the server can access all of the data at once), but rather use the patient's own personal computer for storage. 

  • The Android App

    Abhipray Sahoo08/20/2014 at 20:03 0 comments

    On the Arduino side, we used the Bluetooth Mate Silver ( to send sensor data to an Android app. We created the prototype app with a simple user interface. 

    It has a slider control that allows the user to see all past history. In the initial version, we also developed a visualization of the RGB values with the ColorMatrix class.  This gives a visual representation of the RGB color value that the sensor sees and is useful for calibration purposes.  

    We decided to not store any data locally, and instead have a single Open EMR server store all user data. So the app connects with this server, pulls in data asynchronously and loads the user data history into the UI. 

    Using the Bluetooth class, we connect with the Arduino. A button allows the user to initiate the connection between the Arduino and the phone. Once the connection is established, the Arduino continues to transmit RGB values from the color sensor and pressure values from the differential pressure sensor. After a couple of seconds, when the sensor data coming in has stabilized, the user can hit the stop button. The app will use a mvong average filter and compare it to a linear model. It'll then produce the recommendation based on that final moving average. 

    Here's a video demonstrating it in action:

  • Hydration Metrics Research

    Abhipray Sahoo08/17/2014 at 01:14 0 comments

    We decided to first target hydration monitoring largely because the sensor system would be easy to develop and for quick prototyping of the concept. We did some research on how hydration is currently monitored. As a side note, It has been reported that 70% of Americans are chronically dehydrated so hydration monitoring is a useful tool for the average person.  

    We looked at two metrics-- specific gravity and urine color. 

    Specific gravity:

    Urine specific gravity, the density of urine compared to water density, is utilized to measure how effectively the kidneys are diluting urine. This metric is commonly used in a clincal setting for determining hydration levels. According to National Collegiate Athletic Association (NCAA), it is he most practical, cost-efficient measurement of hydration status for athletes. For healthy adults, urine specific gravity generally ranges from 1.000 to 1.030 (Urine Specific Gravity). 

    Figure: The graph shows the effect on specific gravity as an individual is dehydrated from baseline B to 1%, 3%, and 5% less body weight. The last two bars show results after rehydration period of 30 and 60 minutes.

    A significant correlation can be seen between urine specific gravity and loss of body weight due to dehydration. Urine specific gravity has been proven to be a reliable and accurate metric for clinical standard hydration assessment.

    Urine Color:

    Figure: Correlation between urine color and urine specific gravity

    Urine color is often used in recreational settings to determine hydration level, is best considered in comparison to each individuals relative normal color. Research has shown the correlation between urine color and other metrics that indicate a persons hydration level. For example, the figure above shows that there is a 0.77-0.96 correlation between urine color and urine specific gravity [Armstrong LE. Hydration assessment techniques. Nutr Rev. 2005;63:S40-S54]. Additionally, studies have shown that a pale yellow color of urine indicates that a person is within 1% of euhydrated body mass. Although color may not have the precision of urine specific gravity, and depends on a variety of factors, when utilized in conjunction with other metrics and in comparison to a patients relative normal, it can be an inexpensive and reliable indicator of hydration [Armstrong].

    The two metrics that we incorporated aim to provide hydration information for both clinical and non-clinical settings with a straightforward process that requires no additional usage of chemicals or dipsticks to improve the users ease of experience and reducing cost.

  • Designing the Toilet Attachment

    Abhipray Sahoo08/17/2014 at 00:42 0 comments

    We first designed a preliminary model of the container of the device and fabricated it using 3-D printing. The electronics sit in a small box adjacent to the urine collection cylinder. A large funnel collects the urine into the measurement cylinder. Urine in the collection cylinder is held by a servo controlled blocking mechanism. A small LED illuminates the collection chamber from the bottom, while the color sensor enters the collection chamber from the rear. Two pressure sensors enter the measurement chamber from the side. The entire device is held to the toilet bowl via two arms. 

    This is a very basic design that needs a lot of improvements especially with user-friendliness. First of all, it is too big and bulky. We plan on brainstorming ideas for a more non-intrusive, user-friendly urine collection receptacle. 

    Fig1: The Design (with lid removed, exposing the Arduino)

    Fig2: Design Showing Servo Controlled Release Mechanism

View all 4 project logs

Enjoy this project?



bettygdurand wrote 05/09/2023 at 18:11 point

"Excellent project! I recently came across a project that featured a beer/urine color chart, and I think it would be interesting to see more projects that involve networking. Here's the link to the project:

I'm also curious about what can be done with the urine after it's been used - such as filtering or recycling it in some way."

  Are you sure? yes | no

bettygdurand wrote 05/06/2023 at 16:54 point

Wow, this project looks amazing! I came across a similar project on this platform earlier that had a beer/urine color chart. It would be fascinating to explore more projects in this area. Check it out at

Additionally, I am intrigued by the idea of finding innovative ways to utilize the urine collected from such projects. Perhaps, the urine could be filtered and recycled for some other useful purpose. It would be interesting to see what creative ideas others might have in this regard.

  Are you sure? yes | no

Rashidali62019 wrote 05/05/2023 at 06:09 point

You are really great [job](

  Are you sure? yes | no

helge wrote 04/07/2020 at 15:34 point

Finally someone is building this. A few years back we were stuck with the idea of using colorimetry and XRF to determine urine composition :)

  Are you sure? yes | no

davedarko wrote 08/12/2014 at 07:52 point
Great project! I've seen a project here that had a beer/urine color chart and it would be cool to see projects networking.. here it is:
I'm also interested with what someone can come up with to do with the urine afterwards - filtering/"recycling".

  Are you sure? yes | no

Evan Dougal wrote 08/12/2014 at 14:30 point
Interesting... it looks like we've definitely stumbled into some of the same issues, especially in regards to finding accurate color charts to base our algorithm off of. I could see our Hospital in a Toilet device actually being fairly useful for monitoring brewing operations. Thanks for the link!

  Are you sure? yes | no

davedarko wrote 08/12/2014 at 15:07 point
hehe.. "hospital in a toilet beer - tastes better than it sounds" now that would be a low expectation to crush :) But I think it is also time for an intelligent "Doctor Toilet", not exactly like this one, of course

I would definitely try to build a HiT someday.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates