Person walks into room - light on. Walks out - light off. How to achieve?

WBahn

Joined Mar 31, 2012
30,071
What about something like this?

The one obvious case that they didn't seem to cover is when two people are essentially one. What if two people are carrying a box into the room -- do they get counted as two or as one?
 

dl324

Joined Mar 30, 2015
16,935
"Stupid circuit"? Who said it's stupid?
You took what I said wrong.

I'm not saying the idea is stupid or your eventual solution will be stupid. What I'm saying is that if you do a half a** solution, people will think that of the circuit and you. Step over the "beam" when leaving? Get up and turn off the light manually?

If you want to solve this problem, you should really solve the whole problem.
 

WBahn

Joined Mar 31, 2012
30,071
Now we're back to waving arms like one of those blow up dancing banners at the automart.
So having to get up and walk over to the door and bend down and get a hand out of the room without engaging the sensor and then swinging it back into the room being sure to engage the sensor is better than having to wave your arms from wherever you happen to be?

You can adjust the sensitivity on some of those PIR units until they are quite sensitive.

But, be that as it may, the AB vs BA is not hard to do provided you can ensure clean triggering. But that can be a problem. Since you have mentioned "stepping over" the sensing beam several time, this is presumably mounted down dear the floor, so as people walk in there are two things entering the room (most of the time) and not one -- their legs. What are all the possibilities that can happen as people walk into the room as far as when beams make and break such as one leg blocking one beam while the other leg blocks or unblocks the other. Are the situations where the system could get confused and see and entry as an exit or vice versa? If so, then you could end up with the very empty-room-lights-on situation that you are trying to avoid.

Frankly, even if you get it to work, I would argue that the proper solution is NOT to use it -- teach the kids to turn the lights off when they leave a room. They need to learn to have attention-to-detail and the need to take care of routine "housekeeping" tasks. If they don't get the practice and develop those habits as kids, then they will have a hard time doing so as adults. Far better to learn it when the consequences are a few cents of electricity and some haranguing by their parents then any of a myriad of much more severe consequences years later because they were trained to be absentminded.
 

xox

Joined Sep 8, 2017
838
The one obvious case that they didn't seem to cover is when two people are essentially one. What if two people are carrying a box into the room -- do they get counted as two or as one?
Well sure, but then again, most of the sensor solutions in common use today for that matter can be pretty spotty. If you want a really robust solution, sensor fusion + AI would probably yield the best results.
 

WBahn

Joined Mar 31, 2012
30,071
Not sure how complicated they are to wire up, but it looks like you can get the basic module for under ten bucks off Ebay. Hook it up to a Raspberry Pi Zero and you might be looking at $20 or less. Just a thought...
Hmmm. Let's see. $20 at, say, $0.20/kWh would be 100 kWh of electricity that would have to be saved for breakeven. A 60 W equivalent LED bulb is usually about 8 W, so that's 12,500 hours that it would need to prevent the light from being on, or about 1.4 years. If it saves six hours of use per day (doubtful), then that's over five years before it pays for itself. If, as was stated at one point, the objective is to save money because even saving 15 cents important, then just give them the $20/unit once every four years and they are money ahead.

If the real objective is to play around with a technological solution to a largely non-consequential problem for it's own sake, that's an entirely different matter and needs no justification.
 

Reloadron

Joined Jan 15, 2015
7,523
At one point I was the "guinea pig" for one of those devices in my office at work. It worked great, when I walked into my office the light came on automatically and when the office was unoccupied the light went off. However, when I was quietly sitting at my desk working, after its set time, the lights went off and I would have to wave my arm to get them to come back on. A real pain in the ass! Not to mention feeling like an idiot sitting in the dark waving my arms around. God Forbid anyone would have seen me doing it looking like some moron waving his arms in the dark.
Same here. Especially if I would just kick back for lunch and put my feet up. :)

For what it's worth I would just go to any home improvement store or Amazon and buy the units which replace the existing wall switch. They normally allow you to set a time before lights out. I have seen them on Amazon for $10 to $15 range. The units at work also had a manual override.

Ron
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
7,905
So having to get up and walk over to the door and bend down and get a hand out of the room without engaging the sensor and then swinging it back into the room being sure to engage the sensor is better than having to wave your arms from wherever you happen to be?
Sensor array might be 18 inches off the ground. A child going through will trigger the switch.
Yes, but it acts as a toggle. The first AB sets Q, the next AB resets it. BA has no effect.
As I see it - when you block beam A you present D High. While beam A is still blocked and you continue into the room you block beam B and present Clock with a High. With data high when the clock signal occurs - you switch on. When leaving the room, the last state the flip flop (FF) was in was Q = High and /Q = Low. /Q is tied back to D (which is low). As you leave the room the first beam to be broken is B (clock). With D held low, when the clock signal comes - you turn the lights off. Now, suppose the first scenario where you walk into the room and the lights are on. A second person enters. Again, breaking beam A to force a high on D, then breaking beam B you present a clock pulse which, even though the light is already on you are again telling the switch you want the light on. Which it is already. When leaving, the first person out turns the light off. After they've exited, Q is low, making /Q high. However, with the right resistors, beam A is still holding D low. So when the second person exits, the first thing they do is present a clock (again, while D is low). The lights are reaffirmed to be off. A thousand people can exit the room and the light will be off with the first person to leave. And that doesn't mean the room will be pitch black. There's other light from other sources.
Let's see. $20
A single D FF, a couple IR sensors and an IR LED powered and pointed at a reflective surface will give two distinct beams. With just a few more pieces, a light can be connected. Perhaps through an AC Opto and Triac. Turning the opto on turns the triac on, which in turn turns the lights on.

So, sensors & PS. D FF; opto & triac and you have a complete circuit.

Funny, I came here to ask for help figuring how to do this. Instead with all the discussion and disagreement I think I've come up with a workable solution all from stuff I already have on hand. However, if I had to buy all this stuff (including a projects box), just a few bucks.

Here's an overhead view of what I envision:
1595455295440.png
 

WBahn

Joined Mar 31, 2012
30,071
So the dog brushes against the closed door and the lights in the room go out when they walk away? Or perhaps more likely, an ongoing source of tricks being played on one child by the others.
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
7,905
The first AB sets Q, the next AB resets it. BA has no effect.
If on line A, the first resistor is a 10KΩ and the feedback resistor from /Q is 100KΩ then when A is low, D is at 90% low, which is equivalent of a hard low. When B is triggered, because A is effectively low then the clock signal will turn the lights off. The next person exiting will not set A high before the clock pulse (B). No toggling will happen.
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
7,905
So the dog brushes against the closed door and the lights in the room go out when they walk away? Or perhaps more likely, an ongoing source of tricks being played on one child by the others.
If the sensors are close enough to the door the dog can't unbreak A when breaking B. And if the dog is going to be a problem and you don't have children under 30 inches tall, mounting at 30 inches above the ground will eliminate the dog or cat from triggering the lights.

Sure, it's not perfect. If there were someone to invent a fool proof method then someone else would invent a better fool. I don't expect perfection. Just simply when someone leaves the room the lights go out. OK, there may still be others in the room. Just walk over and press a "Set" button to turn the lights on. Or at bed time a person can press a "Reset" button to turn the lights off. OR simply wave your hand inward to turn lights on or outward to turn lights off.

Why am I having such a hard time expressing myself? I think I clearly see this working and being done very cheap. AND low voltages so nobody is at risk. The ONLY high voltage part would be the part that takes the place of the light switch.
 

WBahn

Joined Mar 31, 2012
30,071
Yes, that would be a problem. If the lights are needed, the remaining child(ren) could simply wave their hand past the sensor to turn the lights back on. May be a pain for them, but so what?! They're kids. They can learn to live with adversity. Or jump over the beam so as to not turn the lights off on others. Make a game out of it.

And you KNOW kids are going to mess with each other, turning the lights on and off and being a general pain. The whole point is to turn the light off on the way out.

Using the flip flop idea, here's a basic drawing of what I think will work:
View attachment 212823
I think this is going to give you all kinds of grief, or at least has the potential to.

First off, you have a voltage divider formed between A and the \Q output, so how are you going to ensure that the voltage at the D input is always a valid voltage level and not within the disallowed zone?

Next, the state will change only on the rising edge of the clock. But are you sure that the state of A will ALWAYS be what you need it to be?

Also, you are likely to get a lot of bounce on your clock signal and since the FF is (mostly) configured as a toggle flip flop, it may flail an unpredictable number of time on each B pulse.
 

jpanhalt

Joined Jan 18, 2008
11,087
Hey Tony,

As father of three beautiful daughters and ten fantastic grandchildren (so far)*, I can't imagine making something that would make them think any less of me. It needs to work as proposed. The HF business model doesn't cut it. Not with my girls.

* I also have a son who is not married yet and has no children to speak of. ;)
 

WBahn

Joined Mar 31, 2012
30,071
If on line A, the first resistor is a 10KΩ and the feedback resistor from /Q is 100KΩ then when A is low, D is at 90% low, which is equivalent of a hard low. When B is triggered, because A is effectively low then the clock signal will turn the lights off. The next person exiting will not set A high before the clock pulse (B). No toggling will happen.
If you use a 10 kΩ and 100 kΩ resistors, then your /Q output is accomplishing nothing. You haven't said (that I've seen) what logic family you are using, but let's assume 5 V CMOS and that your PIR output is also 5 V logic (and let's assume that it is actually a solid 0 V and a solid 5 V).

If A is 5 V and /Q is 5 V, then D is 5 V, which is a logic HI. But if /Q is 0 V then D is 4.5 V, which is also HI.

If B is 0 V and /Q is 0 V, then D is 0 V, which is a logic LO. But if /Q is 5 V then D is 0.5 V, which is also LO.

So the connection to /Q has zero effect on circuit operation.
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
7,905
@WBahn That's why I'm here asking for assistance.

When Q is low /Q will be high. When you walk into A data D will be confirmed to be high. When you walk into B Q will be set high and /Q set low. With Q high the lights are on. As you exit, B reestablishes itself and there is no clock pulse. With Q high, /Q is held low. Upon exiting you walk into B. /Q is low, D is low. So the clock signal will drive Q low. Lights out.

Look! If I'm wrong - I'm wrong. Can someone present a better way without suggesting PIR's or counters or other things? I'm willing to listen. I haven't listened so far because it seems nobody sees what I believe I see. I think AB will turn lights on and BA will turn them off. The key is the feedback resistor from /Q. At least I think that's the way it will work.
 

WBahn

Joined Mar 31, 2012
30,071
Hey Tony,

As father of three beautiful daughters and ten fantastic grandchildren (so far)*, I can't imagine making something that would make them think any less of me. It needs to work as proposed. The HF business model doesn't cut it. Not with my girls.

* I also have a son who is not married yet and has no children to speak of. ;)
There is something to be said for the point being made here.

If this turns out to be annoying and flaky, the take-away that your grandkids are going to have is that grandpa makes things that are annoying and flaky. Unlike something that you give them for Christmas that doesn't work well and gets set aside before New Years never to be touched again, this would be something that would be reinforcing this impression every time it misbehaves or annoys. It really could have the potential to establish their opinion of grandpa's competence pretty strongly such that overcoming it might take a very long time.

On the other hand, it also has the potential to form lifelong shared memories for all involved -- "These are almost as bad as those those automatic light switches that Grandpa saddled us with when we were kids...."
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
7,905
OK, I'm not seeing something here. Perhaps this is a bad idea after all. I know - I know - I know. You told me so (somebody said).

As for what family of chips - this isn't even in the planning stage, it's in the hypostulation phase. This is where one decides to go further or to let it go. Perhaps it's time to breadboard my idea and prove to myself it works or it doesn't. Then I can decide what's next.
 

WBahn

Joined Mar 31, 2012
30,071
@WBahn That's why I'm here asking for assistance.

When Q is low /Q will be high. When you walk into A data D will be confirmed to be high. When you walk into B Q will be set high and /Q set low. With Q high the lights are on. As you exit, B reestablishes itself and there is no clock pulse. With Q high, /Q is held low. Upon exiting you walk into B. /Q is low, D is low. So the clock signal will drive Q low. Lights out.

Look! If I'm wrong - I'm wrong. Can someone present a better way without suggesting PIR's or counters or other things? I'm willing to listen. I haven't listened so far because it seems nobody sees what I believe I see. I think AB will turn lights on and BA will turn them off. The key is the feedback resistor from /Q. At least I think that's the way it will work.
HOW is the key the feedback resistor from /Q???

I've just shown you that it will either have NO impact on the signal at D (it will be determined solely by the signal at A), or that D will be determined solely by the signal at /Q (and hence the signal at A will have no impact), or that the interplay will result in a signal at D that is in the disallowed range and the behavior of the flip flop will be unknown.
 
Top