Making a Restroom Stall Information System

About: University Student

Working in the office or working hard on your paper in the dorm. When nature calls, you want to find the nearest available restroom to use as fast as possible. The problem here though is that most restrooms do not have a sign detailing the availability inside. Making you getting up and walking to the restroom to check, wasting valuable time if you find out that all of the stalls are occupied!

In comes a solution, Stall Sense! Based on Micropython, this wireless solution is flexible and expandable to your restroom status needs! No longer will you have to guess whether a restroom has available stalls for you to use. Instead you can make an informed decision as to which restroom to make the trek to for your needs!

This is a part of a final project for Indiana University Bloomington's ENGR - E101 Course.

Step 1: Materials

For this project, you will need the following items

  • NodeMCU Amica - Amazon or Microcontroller that is WIFI capable
  • WS2812B (Neopixels) LED Panel - Amazon
    • A 8x8 panel is used in this instructable however, with minor tweaks to the code larger sizes can be supported. Note: Take care in selecting the size as some microcontrollers might be unable to control large panels due to memory or cpu limitations.
  • Power Supply - Amazon
    • The power supply used in this instructable was a little overkill. The 5V 3A supply on the same page would work as long as the whole panel is displaying white at full brightness. Note: Make sure to check the power requirements of the panel you have selected so you can choose a compatible power supply.

Other items that can be substituted with what you have available are

  • Jumper Wires
  • Enclosure Material - Wood, Acrylic, etc.
  • Appropriate Glue for the material used
  • Sensors
    • In this instructable the HCSR04 sensor - Amazon - was used for automatic sensing however, this can be substituted for a more capable and reliable sensor such as a Passive Infrared Sensor (PIR Sensor) - Amazon

Step 2: Display Fabrication

Using your material of choice, you can either cut it manually or as done here laser cut the parts that makeup the enclosure for the display. Again, these designs were based off of the led panel used and should be modified based on your needs.

The dimensions used are 8.5 in x 4in x 1.5 in (L x W x H) with the side piece being 5 in tall.

The minimum you need to cut is one of each file. However, if you desire a cover for the top of the enclosure, you can cut another Top or Bottom piece though it may be a little longer than the rest of the display depending how thick your material is.

Afterwards assemble the pieces by gluing them with the appropriate glue for the material you are using.

Step 3: Assembling the Circuits

Provided are the schematics of the circuits used for this project. For the provided enclosure you would need 3 clients for every 1 server circuit.

As this was a temporary project the assembled circuits were larger than they have to be and can be reduced significantly with better refinement of the design.

Note that the two buttons for the server were used for easier debugging - bigger reset switch and code loop stop - and are not necessary for the final product.

In addition in connecting the LED panel, the microcontroller ground needs to be connected even though there is ground already from the power supply it is separate from the data ground.

Step 4: Loading and Configuring Code

Make sure your microcontrollers firmware is setup. If you are using the Nodemcu Amica's and they have not been setup, follow the short guides for your respective computer below.

For Linux and Mac users, there is a guide here on setting up - Link. In addition a script from the open source Crimsonbot2 project - under active development - has been attached for an easier way to setup your devices.

For Windows users, you would first have to install a USB to UART driver located here, checking what the COM port installed as. This can be checked in the device manager and is usually "COM3". Then follow the steps provided in the guide linked above replacing "/dev/ttyUSB0" with the "COM#" you have found when running the commands.

Download Code

Here is the github repository for the files you will need to load. https://github.com/Bloodcloak/Stall_Sense They can be loaded using WebREPL or ampy which have their own setup process documented.

Clients

For clients you will need to load the Client.py, ssconfig.py, and a main.py file that contains this code that calls and starts the client automatically at boot up.

from Client import ssclient
ssclient()

One other note, you will need to modify the client id number for the respective stall number. The apostrophes are necessary because of how the code utilizes this file. For example Client 1 would have:

def client_id():
	idnumber = '1'
	return idnumber

Client 2:

def client_id():
	idnumber = '2' 
	return idnumber

Client 3:

def client_id():
	idnumber = '3'
	return idnumber

This is also applied to the server_id as well if you are running multiple displays in close range

Servers

Similarly for the server you would need to load the Server.py, ssconfig.py and a main.py file with this code that would also start the server once power is applied to the controller.

from Server import start
start()

For the ssconfig.py file you would only need to modify the server_id value if you need to for the reason mentioned in the client setup. The syntax is also the same as the client process above.

Testing

You should now test whether or not the clients can connect to the server and can send data on the status. Do note that the Ultrasonic sensors used are qwerky in their accuracy so sometimes will not trigger a change.

If using Nodemcu Amicas, the two onboard led lights are useful debug tools on the status of the device.

  • Server
    • Both LEDs on - Startup
    • Only Inner - Socket Creation
    • Only Edge - Running
    • LED Panel Full Yellow - Startup Test of necessary colors (Red and Green)
  • Clients
    • Both LEDs on - Startup
    • Only Edge Blinking occasionally - Searching for Server
    • Edge Solid - Connected
      • Inner On - Detecting Occupied Status
      • Inner Off - Detecting Open Status
    • Alternating Blinking - In error, could not connect to server WIFI

Step 5: Assemble the Display

Here the led and electronics panel was secured into place with duct tape inside the enclosure. After everything is assembled you can now mount it onto a wall of your choice using the holes in the side panel and screws in the wall. Similar to mounting a painting or plaque.

Step 6: Running the System

After mounting the Display connect the server and LED Panel to power. Mount the Clients to their respective stalls pointing in the direction of where a person would be standing or sitting then connect them to a power supply.

Now information on the availability of the restroom can be dispersed to all who need it!

Share

    Recommendations

    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Fandom Contest

      Fandom Contest

    Discussions