Lavatory Signal

Lavatory signal

How it works

Sometime It is very convinience that one toilet is occupied or not.
There is a human detect sensor like EKMC1601111.
We create html that showing lavatory signal (like in airplane ) by collaborating with this sensor.

Materials

  1. obniz – 1
  2. EKMC1601111 – 1
  3. battery or usb adaptor & cable – 1

Steps

Step 1

connect EKMC1601111 to an obniz.

Now we connect like
io0: GND,
io1: Signal,
io2: VDD

Step 2

put this on toilet.

Code

This is a html/script for this.

<div id="online-status"></div>
<div id="a"><img src="https://www.dropbox.com/s/e7nqlug3wz4ku5v/in_notuse.jpg?raw=1" id="image" width="100%"></div>
<h1 id="print"></h1>
<div id="sens1"></div>
  
  <script>
    var obniz = new Obniz("<OBNIZ ID HERE>");
    obniz.onconnect = async function () {
      obniz.reset();
      obniz.io0.output(false);
      obniz.io2.output(true);
      obniz.io1.pulldown();
      var sensorAdd = 0;
      
      obniz.io1.input(function(value){
        console.log("here"+value);
        if (value) {
          sensorAdd += 1;
          $("#sens1").text("sensorAdd:"+sensorAdd);
        }
      });
      
      function update() {
        if (sensorAdd == 0) {
          $("#print").text("Empty");
          $("#image").attr("src", "https://www.dropbox.com/s/e7nqlug3wz4ku5v/in_notuse.jpg?raw=1");
        } else if (sensorAdd != 0) {
          $("#print").text("Occupied");
          $("#image").attr("src", "https://www.dropbox.com/s/x5wlr6kwmq15mrp/in_use.jpg?raw=1");
        }
        sensorAdd = 0;
        $("#sens1").text("sensorAdd:"+sensorAdd);
      }
      
      setInterval(update, 2000) 
    }
  </script>

See the Pen Cookbook: LavatorySignal by obniz (@obniz) on CodePen.

Working video

Leave a Comment

%d bloggers like this: