Looking for sensor to tell if something (not moving) is in front of it

So I know theres motion detectors, which I have, but if you stand still in front of them, they turn off as your not in motion.

Whats out there that can detect if something is in front of it and not moving?

For example;
I have motion sensor in our bathroom. Motion sensed, turn on. No motion sensed for 3 min, turn off. But then run into issue where if your on the toilet for a while, lights go out on you and you gotta wave your hand. Wife doesnt like this.

Yes I can icrease the 3min to 6, or 12, or 60. But then that kinda defeats purpose of not wasting energy with lights being left on when no one is in room.

Is there some sort of sensor I can mount that will detect if someone is sitting on the toilet?

Camera with person detection. I’m guessing that won’t be a popular choice either …

If you have LED lighting, the extra minutes amount to very little additional energy consumption. It’s certainly better than forgetting to turn off the lights for several hours.

FWIW, the arrangement I’ve created allows the user to temporarily suspend the auto-off function by simply changing the light’s brightness from the default value (i.e. the value the motion-control function automatically sets it to). Walk in, light turns on, you use the wall-switch to change it to some other level (brighter/dimmer), auto-off is suspended (it reactivates itself 20 minutes later). Now you can take a shower or ponder life on the toilet (for up to 20 minutes before the light is automatically turned off if it detects no motion).


EDIT

If you want to get fancy, you’ll need extra sensors to detect presence on the toilet and/or in the shower (photoelectric beam, more motion sensors, contact sensors, load sensor under the tub, etc).

I have something similar, as long as exhaust fan is on, lights wont turn off.

WAF will be very low on this, lol!

infrared sensor, used also by garage doors as a security contact, that will watch the line close above the toilet. That’s exactly doing, what you need. Just shining one straight line, when the line is interrupted, contact will toggle.

Time of flight sensor in the ceiling, pointing straight downwards. It measures the distance to whatever is below. If it becomes much smaller, someone is uhh… using the device below :slight_smile:

The VL53 series are popular and cheap. Alternatively, ultrasonic or pulsed coherent radar.

1 Like

This has a pretty short range (300mm to 1000mm) the ceiling might be a bit high. Mounted on the wall behind or beside the toilet might be better.

The VL53L0X goes up to 2m, the VL53L1CX up to 4m and the VL53L1CB up to 8m, that should cover a pretty high ceiling :slight_smile:

But yeah you can also mount it in the walls.

1 Like

Any links showing a setup of how it would work. Would I connect the tof sensor to an esp32?

Yep. ESPHome has a component for it. VL53L0X Time Of Flight Distance Sensor — ESPHome

1 Like

Edit: Figured it out. I had a VL53L1X not a 0X. I found this and it worked; GitHub - jardous/tof_vl53l1x: ESPHome custom sensor utilizing the VL53L1X Time of Flight distance module


Any guesses as to why my TOF sensor isnt reading anything?
image

Here my yaml for the esp32 device:

esphome:
  name: master-bathroom-toilet-sensor
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "0a403df9f63f237278c1030a7f42c5b5"

wifi:
  ssid: "MYNETWORK"
  password: "MYPASSWORD"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Master-Bathroom-Toilet-Sensor"
    password: "979P1TqQ2TDn"

captive_portal:

i2c:
  sda: 21
  scl: 22
  scan: True
  id: bus_a
  
sensor:
  - platform: vl53l0x
    name: "VL53L0x Distance"
    address: 0x29
    update_interval: 60s
    long_range: True

Heres the sensor I bought: https://www.amazon.com/gp/product/B07F3TV3G4/ref=ppx_yo_dt_b_asin_image_o02_s00?ie=UTF8&psc=1

Heres the board I am using: https://www.amazon.com/gp/product/B07Q576VWZ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

VCC wire on sensor connected to 3.3v pin on ESP32
GND wire on sensor connected to GND pin on ESP32
SDA wire on sensor connected to GPIO21 pin on ESP32
SCL wire on sensor connected to GPIO22 pin on ESP32

Where exactly where the home-brew device be installed in the bathroom and how will it be powered? (Many bathrooms don’t have an outlet near the toilet.) Just curious to know how you intend to manage the aesthetic and practical aspects of the installation.

Force or load sensor under toilet seat cover (not the cover, that second part where you sit on it :smile:)

The VL53L1X sensor is not supported in ESPhome, but it is planned. Only VL53L0X is supported which works well up to a distance of 1.2 m.