Directional Sense with Motion Sensors?

Hi All,

I need inputs on on following scenario.

I have few ST Motion Sensors which work fine as they are intended in terms of detecting motion. What I am looking for is inputs on following:

  • What can be done if I want to be aware of whether the motion happened from Left to Right OR Right to Left. (Eg: Living Room Lights to be turned On when I move from Stairs towards Living Room.).

Motions sensors are not made for that by default. Any way they cane be tweaked to do that (Device Handlers)? Or any other device/Set of devices to do that ?


I think you’d need to put 2 motion sensors in the hall that are carefully aimed to pick you up near the door to each of the rooms without overlap.

Otherwise just have sensors in each room?

@JDRoberts, in my opinion, is an expert in this matter. So I will defer specifics to him. But my initial thought would be that the latency and reset times for motion sensors can vary considerably and may make it difficult to determine direction, especially if that direction changes quickly. I agree with @Adrenalin that sensors placed without overlap may work if the moving object is only moving in one direction from point A to B. Things will get much more difficult if the direction is not uniform.

1 Like

Easy to do in webCoRE.

If Motion A changes to active
Motion B is inactive
Then set Variable “direction”

If Motion B changes to active
Motion A is inactive
Then set Variable “direction”

If Motion A and B are inactive
Then set Variable “direction”

Use the same logic if Motion is active and other Motion changes to active…

Piston below is an example of direction based motion:

1 Like

This usually falls into the “microlocation” issue, although it adds another level of complexity.

As @pantheon mentioned, it all comes down to the small details of the specific setup.

If the detection zone for the two sensors overlap, there’s just no way to do it with standard motion sensors.

In addition, the relatively inexpensive battery operated sensors which are used in most DIY home automation, including smartthings, have an additional issue in that they sleep a lot. It’s not a real time incident notification of “now I detect something, now I don’t.” Most inexpensive sensors have a “cool down“ period Where when motion is detected, they then wait about three minutes before even checking to see if there is still motion. So this tends to be pretty useless for tracking people walking through a house because The notifications Don’t match up with the real time movement.

And if you try to increase the sensitivity to get more accurate reporting, you eat through the batteries.

there are some solutions, but they tend to be more expensive and a lot more work to set up

So almost all real time location, which is generally required to make directional reporting work, either include multiple types of devices, like contacts Sensors mixed into the picture, or use Mains powered sensors without a sleep protocol, or use a different technology all together like a ibeacons Set to only detect within a very short range, like about a meter.

There is a demand for this, particularly from commercial installations like a big department store, but the technology tends to be more expensive and require more devices than most homeowners want to use.

The double beam approach

Hands-down the easiest relatively inexpensive way to do directional detection Is with a device similar to the safety beam used on garage doors. typically infrared. The beam is always operational (no sleep). As long as the beam is contacting a sensor on the other side of the doorway, it’s active. As soon as the beam is broken, you know someone is coming through.

Then if you want directionals you put two of these beams close together and you just keep track of which one got broken first.

This can work quite well and isn’t that expensive to do , but it’s very much a maker type project with a lot of device set up to make it accurate. Not worth it for most people, which is why most Home Automation is just based on “no activity detected in this zone for X minutes” rather than true directionals.

You can see more discussion of this method in the following thread: ( The topic title is a clickable link)

Project Reports

There have been several community members who did do this kind of major tracking project for their own homes, including the “wasp in a box“ project, but they all require that you have a dedicated laptop operating some fairly complex software to keep track of everything. Plus anywhere from 3 to 10 devices in each room.

If you take a look at the threads on the following list, you can see how these different projects were implemented.

But again, it’s just not worth it to most people unless you find this kind of project itself fun to do. It’s a lot of work for what most people want.


Also, as soon as you start having more people in the house, even just visitors, the algorithms tend to just fall apart for pretty much anything except the double beam projects. :scream:

Imagine a person who lives alone and has everything set up just the way they like and it all works fine. Now they have a friend come over to watch a sports event on television.

Everything works fine as they walk into the living room. Person A sits on the couch. Person B leaves the room to go into the kitchen and get popcorn. All the directional logic gets triggered because B is leaving the room and the lights and the television go off while person A is still sitting on the couch. :disappointed_relieved:

So maybe you add a pressure sensor to the couch so you can tell when someone is sitting there. But then it turns out person A isn’t actually sitting on the couch, they’ve walked over to the window to look out. Again, the directionals turn the lights off even though someone is still in the room.

The Future of Microlocation

We’re all waiting for successful microlocation to arrive at a cost that people can afford in DIY home projects, it’s just not here yet. Apple has a patent on one but no market ready technology to go with it yet. A lot of people think it will be A different approach, something like hospital monitoring systems which recognize heartbeats. Some people think the first practical application will have to do with smart watches. Who knows? It could be any or all of these.

Next Steps

For now, if the sensors don’t have overlapping detection zones, the cool down period Isn’t too long, and there’s only one person in the home, You can certainly try a piston like @rontalley Provided, and just see how it works for you.

If you really need it for some particular reason And there’s likely to be more than one person in the house, then I would look into the double beam systems.

Otherwise, I think the standard separate zones maybe combined with a different type of sensor like a pressure Mat to detect continued occupancy works well for most people.

But there are lots of different ways to do it, just depends on how much time, effort, and money you want to put into it. :sunglasses:

Again, take a look at the project reports that have already been posted and you’ll see there are some very creative approaches.


Even the double beam approach has some problems with multiple people. Which direction is detected (and which is important) if two people are passing each other in opposite directions?
I think more than 2 beams would be needed to even detect this case.

1 Like

Yes, if two people go through the same doorway at exactly the same time in two different directions, the double beam method will also fail. But that’s usually the least likely of the various possible scenarios that can trip up most of the other set ups.

For absolute precision, you need to check each individual person by ID in and out of the room. That can be done with I beacons, but it’s expensive And complex and each individual person has to be willing to wear or carry a Beacon.

The method is used for some business applications, including large conventions with multiple rooms, it’s just not usually practical for home use.

image image

1 Like