In a few days I will start to build a hand railing for my stairs out of bamboo with a built in LED strip. I want to be able to indicate the position of a person standing on the staircase by illuminating an LED at the corresponding distance along the length of the hand railing. Of course I will be needing an individually addressable LED strip for this but that is not the issue, neither is the micro controller I will be using (I figured an ESP8266-01 would do nicely, hoping to also being able to switch the led strip wirelessly).

Rough sketch of my idea.

I am kinda stuck on the measuring distances part. The best case scenario would be that the measuring sensor(s?) would be integrated in the railing itself, which would mean sensing from the side. I don't know if this is possible other than using multiple ultrasonic sensors but this would mean that components will be visible through holes in the bamboo and that kind of takes away the magic. It also means that the code will be more complex since I have to check how close the person is to one sensor compared to the other to get a more precise distance. I am looking for the most elegant solution here.

Another option is to measure from the top or bottom of the staircase but the only sensors I came across were either the ones that couldn't measure more than a few feet or this really expensive one:

My questions are: What is the best way to approach this? What sensor(s) do I need in order to keep costs at a minimum?

This is my first post and my drawings are awful so, please be gentle :).

  • 1
    \$\begingroup\$ There are ultrasonic-based rangefinders, under $10 on ebay. \$\endgroup\$ Nov 12, 2016 at 1:42
  • \$\begingroup\$ Will they work as far as 12 ft? I also thought they need a relatively flat surface. \$\endgroup\$
    – d1che
    Nov 12, 2016 at 1:57
  • \$\begingroup\$ ebay.com/itm/… \$\endgroup\$ Nov 12, 2016 at 2:00
  • \$\begingroup\$ Throwing ideas in here: Maybe a combination of a cheap lens + infrared photodiode to detect heat in one direction from the rail? Can you make use of the fact that a person on the rail will be deflecting light from the rail and/or block light which comes from the other side? Do you have rails on both sides? \$\endgroup\$ Mar 22, 2017 at 10:00

2 Answers 2


Ultrasound sensor becomes erratic at distances greater than few feet, since the echo comes back from several angles and objects. Use a visual aid, or by employing a cheap video camera at an angle close to the rail and calculating the person's distance by the displacement of the person on the image, or, by observing the LED light reflection on the person, you would need to flash the LEDs very fast and observe when the person gets illuminated.

An infrared emitter and sensor could be included per each one or two step(s) of the stairs, also in the rail, and observing which feedback is stronger, thus turning on the corresponding LED.

There are capacitive sensors, but the actual technology works fine for touching distance.

Pressure sensors could also be used (bare flat switch contact) under the carpet of the stair steps, once the person steps on it, closes electrical contact.

Or, maybe the original idea of ultrasound sensors on the under the rail, sensing if the person is closer, but you could not use a bunch of sensors, except if the sensors are triggered individually with time.

Unrelated note: Dogs hate ultrasonic sensors.

  • Measuring with your required accuracy is feasible in digital form for $50usd from Bosch at Home Depot. But interfacing might not be feasible unless you have excellent reverse engineer skills to the test points inside. The other catch is you need a motion sensor to trigger it.

    enter image description here

  • Another way but far less accurate with more range errors from wall reflections is ultrasonic from Sparkfun or Digikey $30usd enter image description here

    Ultrasonic range finder with effective detection range of 6 in - 255 in (15 cm - 648 cm)

  •  Detect object distance with 1.0 in (2.54 cm) resolution up to 20 ft away

  •  Continuous measurement (free run) operation
  •  Three options for sending range data: UART, analog and PWM
  •  Small PCB size for flexible designs 0.9 in × 0.8 in (2.3 cm × 2.0 cm)
  •  6-pin Pmod port with UART interface
  •  Library and example code available in resource center

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.