IoT Smart Bathroom

Introduction: IoT Smart Bathroom

This project aims to develop a “smart” bathroom making use of relevant capacity utilization data, such as: people flow during a pre-established time interval; facility utilization data (number of visitors versus time they stayed in the bathroom), and, according to the physical space utilization rate, trigger “on demand” cleaning process alert (via Twitter). This kind of technological solution can be applied in areas with intense flow of people, such as hospital hallways, restaurants, museums and similar ones. As result, a better cleaning team dimensioning is expected, which leads to optimization of resources utilization.

Before reading the next steps, make sure that your Intel Edison is configured with the newest firmware.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Create the Circuit on the Protoboard and Fix It!

For this step, you will need:

- 1 Protoboard

- 1 Ultrasonic Sensor HCSR04

- 4 Jumpers

- 1 Intel Edison

- A wi-fi network

Fix the ultrasonic sensor in the protoboard, then connect the jumpers into the right pins (gnd to gnd, 5V to 5V, trig to output and echo to input).

Make sure that the Ultrasonic Sensor is set in front of the bathroom door looking to the door. It has to be able to detect when someone passes between the sensor and the door.

Step 2: Using Python

The whole code of the project makes use of Python, so make sure you have installed the following API's:

- Pip Python.

$ opkg install python-pip

- TwitterAPI.

$ pip install 'TwitterAPI' 

You can check the TwitterAPI documentation here:

Attention: Make sure you have the newest version of the firmware, because you have to use the library "mraa", and it doesn't work with older versions.

Step 3: Conect Your Edison in a Wi-Fi Network

Copy this code to the terminal and set a Wi-Fi network:

$ configure_edison --wifi

Find your wi-fi network, write the password and connect your Edison to it.

Step 4: Requiriments to Include TwitterAPI to Your Code

For this step, you will need a Twitter account.

1. Sign in your Twitter account

2. Enter this link:

3. Input a name, any description, a website url and agree with the terms.

4. Click on "Keys and Acess Tokens"

5. Save the following information: Consumer Key, Consumer Secret, Acces Token Key and Acces Token Secret.

Those steps are necessary and they will be included on this part of the code:

from TwitterAPI import TwitterAPI




r = api.request('statuses/update', {'status': TWEET_TEXT})

print('SUCCESS' if r.status_code == 200 else 'FAILURE')

Step 5: The Interface

A web interface is used to check the status and information given by the SmartBathroom.

Here is the code for ToiletDash.json:

Step 6: Run the Code

Download the code from the link, change the data of your Twitter account, compile to your Edison and you will have your Smart Bathroom!

Important Note: The complete code is commented, thus you get the explanation on how it works.

Be the First to Share


    • Toys and Games Challenge

      Toys and Games Challenge
    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge

    2 Discussions


    4 years ago

    Cool idea! Thanks for sharing the details.